OpenWrt packages
Sign in or create your account | Project List | Help
OpenWrt packages Git Source Tree
Root/
| 1 | Index: allegro-4.4.2/src/linux/lkeybd.c |
| 2 | =================================================================== |
| 3 | --- allegro-4.4.2.orig/src/linux/lkeybd.c 2011-06-19 11:32:20.000000000 +0200 |
| 4 | +++ allegro-4.4.2/src/linux/lkeybd.c 2012-03-29 03:58:32.357827856 +0200 |
| 5 | @@ -143,7 +143,10 @@ |
| 6 | /* convert Allegro format scancodes into key_shifts flag bits */ |
| 7 | static unsigned short modifier_table[__allegro_KEY_MAX - __allegro_KEY_MODIFIERS] = |
| 8 | { |
| 9 | - __allegro_KB_SHIFT_FLAG, __allegro_KB_SHIFT_FLAG, __allegro_KB_CTRL_FLAG, |
| 10 | + __allegro_KB_SHIFT_FLAG, __allegro_KB_SHIFT_FLAG, |
| 11 | + /* note: we drop LCONTROL here, as the NanoNote uses it as modifier key |
| 12 | + 'Fn', passing it as CTRL causes problems with ASE's key bindings */ |
| 13 | + /*__allegro_KB_CTRL_FLAG*/ 0, |
| 14 | __allegro_KB_CTRL_FLAG, __allegro_KB_ALT_FLAG, __allegro_KB_ALT_FLAG, |
| 15 | __allegro_KB_LWIN_FLAG, __allegro_KB_RWIN_FLAG, __allegro_KB_MENU_FLAG, |
| 16 | __allegro_KB_SCROLOCK_FLAG, __allegro_KB_NUMLOCK_FLAG, __allegro_KB_CAPSLOCK_FLAG |
| 17 | @@ -204,7 +207,10 @@ |
| 18 | map = 0; |
| 19 | if (key[__allegro_KEY_LSHIFT] || key[__allegro_KEY_RSHIFT]) map |= 1; |
| 20 | if (key[__allegro_KEY_ALTGR]) map |= 2; |
| 21 | - if (key[__allegro_KEY_LCONTROL] || key[__allegro_KEY_RCONTROL]) map |= 4; |
| 22 | + |
| 23 | + /* fixes for nanonote's keyboard: LCONTROL is 'Fn' modifier */ |
| 24 | + if (key[__allegro_KEY_LCONTROL]) map |= (1<<6); |
| 25 | + if (key[__allegro_KEY_RCONTROL]) map |= 4; |
| 26 | if (key[__allegro_KEY_ALT]) map |= 8; |
| 27 | |
| 28 | /* Map scancode to type and value */ |
| 29 | @@ -304,6 +310,7 @@ |
| 30 | { |
| 31 | unsigned char buf[128]; |
| 32 | int bytes_read; |
| 33 | + int avail; |
| 34 | fd_set set; |
| 35 | struct timeval tv = { 0, 0 }; |
| 36 | |
| 37 | @@ -312,12 +319,26 @@ |
| 38 | |
| 39 | FD_ZERO(&set); |
| 40 | FD_SET(std_keyboard.fd, &set); |
| 41 | - if (select (FD_SETSIZE, &set, NULL, NULL, &tv) <= 0) |
| 42 | - return 0; |
| 43 | |
| 44 | - bytes_read = read(std_keyboard.fd, &buf, sizeof(buf)); |
| 45 | - if (bytes_read < 1) |
| 46 | - return 0; |
| 47 | + /* Possible heisenbug here. when doing readkey(), the main thread does |
| 48 | + select with timeout and causes us EINTR here. One lost select() an we |
| 49 | + already hit that "select() is not fully level triggered" lost-wakeup |
| 50 | + deadlock!? Also note EINTR problem with read() below. */ |
| 51 | + |
| 52 | + do |
| 53 | + { |
| 54 | + avail = select (FD_SETSIZE, &set, NULL, NULL, &tv); |
| 55 | + if ((avail < 0 && errno != EINTR) || avail == 0) |
| 56 | + { |
| 57 | + return 0; |
| 58 | + } |
| 59 | + } while (avail < 0); |
| 60 | + |
| 61 | + do { |
| 62 | + bytes_read = read(std_keyboard.fd, &buf, sizeof(buf)); |
| 63 | + if ((bytes_read < 1 && errno != EINTR) || bytes_read == 0) |
| 64 | + return 0; |
| 65 | + } while (bytes_read < 0); |
| 66 | |
| 67 | process_keyboard_data(buf, bytes_read); |
| 68 | |
| 69 | Index: allegro-4.4.2/src/keyboard.c |
| 70 | =================================================================== |
| 71 | --- allegro-4.4.2.orig/src/keyboard.c 2012-03-29 02:21:50.328523081 +0200 |
| 72 | +++ allegro-4.4.2/src/keyboard.c 2012-03-29 02:22:58.768808442 +0200 |
| 73 | @@ -625,6 +625,11 @@ |
| 74 | _DRIVER_INFO *driver_list; |
| 75 | int i; |
| 76 | |
| 77 | + /* readkey() uses rest(1) which deadlocks unless we call install_timer() |
| 78 | + first. this bug occurs e.g. with exhello (but not with any of the |
| 79 | + event-loop driven allegro games) */ |
| 80 | + install_timer(); |
| 81 | + |
| 82 | if (keyboard_driver) |
| 83 | return 0; |
| 84 | |
| 85 |
