Changes in / [3b2e387:40f606b] in mainline
- Files:
-
- 14 added
- 8 deleted
- 45 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/amd64/Makefile.inc
r3b2e387 r40f606b 35 35 36 36 RD_SRVS_NON_ESSENTIAL += \ 37 $(USPACE_PATH)/srv/bd/ata_bd/ata_bd 37 $(USPACE_PATH)/srv/bd/ata_bd/ata_bd \ 38 $(USPACE_PATH)/srv/hid/char_mouse/char_ms 38 39 39 40 RD_DRVS += \ -
boot/arch/ppc32/Makefile.inc
r3b2e387 r40f606b 43 43 $(USPACE_PATH)/srv/hw/bus/cuda_adb/cuda_adb 44 44 45 RD_SRVS_NON_ESSENTIAL += \ 46 $(USPACE_PATH)/srv/hid/adb_mouse/adb_ms 47 45 48 RD_DRVS += \ 46 49 infrastructure/rootmac -
uspace/Makefile
r3b2e387 r40f606b 81 81 srv/fs/devfs \ 82 82 srv/fs/ext2fs \ 83 srv/hid/adb_mouse \ 84 srv/hid/char_mouse \ 83 85 srv/hid/s3c24xx_ts \ 84 86 srv/hid/fb \ -
uspace/app/init/init.c
r3b2e387 r40f606b 275 275 srv_start("/srv/i8042"); 276 276 srv_start("/srv/s3c24ser"); 277 srv_start("/srv/adb_ms"); 278 srv_start("/srv/char_ms"); 277 279 srv_start("/srv/s3c24ts"); 278 280 279 281 spawn("/srv/fb"); 280 282 spawn("/srv/input"); 281 console("hid /input");283 console("hid_in/input"); 282 284 283 285 spawn("/srv/clip"); -
uspace/app/klog/klog.c
r3b2e387 r40f606b 143 143 * Receives kernel klog notifications. 144 144 * 145 * @param callid 146 * @param call 147 * @param arg 145 * @param callid IPC call ID 146 * @param call IPC call structure 147 * @param arg Local argument 148 148 * 149 149 */ -
uspace/app/mkbd/main.c
r3b2e387 r40f606b 280 280 size_t actual_size; 281 281 int event_nr; 282 282 283 283 while (true) { 284 284 /** @todo Try blocking call. */ -
uspace/app/trace/trace.c
r3b2e387 r40f606b 792 792 proto_register(SERVICE_VFS, p); 793 793 794 #if 0795 794 p = proto_new("console"); 796 795 … … 828 827 proto_console = p; 829 828 proto_register(SERVICE_CONSOLE, p); 830 #endif831 829 } 832 830 -
uspace/drv/bus/usb/usbhid/mouse/mousedev.c
r3b2e387 r40f606b 44 44 #include <async_obsolete.h> 45 45 #include <str_error.h> 46 #include <ipc/mouse ev.h>46 #include <ipc/mouse.h> 47 47 #include <io/console.h> 48 48 … … 270 270 if ((shift_x != 0) || (shift_y != 0)) { 271 271 async_obsolete_req_2_0(mouse_dev->mouse_phone, 272 M OUSEEV_MOVE_EVENT, shift_x, shift_y);272 MEVENT_MOVE, shift_x, shift_y); 273 273 } 274 274 … … 296 296 && field->value != 0) { 297 297 async_obsolete_req_2_0(mouse_dev->mouse_phone, 298 M OUSEEV_BUTTON_EVENT, field->usage, 1);298 MEVENT_BUTTON, field->usage, 1); 299 299 mouse_dev->buttons[field->usage - field->usage_minimum] 300 300 = field->value; 301 } else if (mouse_dev->buttons[field->usage - field->usage_minimum] != 0 301 } else if ( 302 mouse_dev->buttons[field->usage - field->usage_minimum] != 0 302 303 && field->value == 0) { 303 304 M OUSEEV_BUTTON_EVENT, field->usage, 0);305 mouse_dev->buttons[field->usage - field->usage_minimum] =306 field->value;307 304 async_obsolete_req_2_0(mouse_dev->mouse_phone, 305 MEVENT_BUTTON, field->usage, 0); 306 mouse_dev->buttons[field->usage - field->usage_minimum] 307 = field->value; 308 } 308 309 309 310 field = usb_hid_report_get_sibling( -
uspace/drv/bus/usb/usbmouse/mouse.c
r3b2e387 r40f606b 38 38 #include <errno.h> 39 39 #include <str_error.h> 40 #include <ipc/mouse ev.h>40 #include <ipc/mouse.h> 41 41 #include <async.h> 42 42 #include "mouse.h" … … 86 86 87 87 async_exch_t *exch = async_exchange_begin(mouse->console_sess); 88 async_req_2_0(exch, M OUSEEV_MOVE_EVENT, -shift_x / 10, -shift_y / 10);88 async_req_2_0(exch, MEVENT_MOVE, -shift_x / 10, -shift_y / 10); 89 89 async_exchange_end(exch); 90 90 } … … 93 93 94 94 async_exch_t *exch = async_exchange_begin(mouse->console_sess); 95 async_req_2_0(exch, M OUSEEV_BUTTON_EVENT, 1, 1);96 async_req_2_0(exch, M OUSEEV_BUTTON_EVENT, 1, 0);95 async_req_2_0(exch, MEVENT_BUTTON, 1, 1); 96 async_req_2_0(exch, MEVENT_BUTTON, 1, 0); 97 97 async_exchange_end(exch); 98 98 } -
uspace/lib/c/generic/async.c
r3b2e387 r40f606b 213 213 * This function is defined as a weak symbol - to be redefined in user code. 214 214 * 215 * @param callid 216 * @param call 217 * @param arg 215 * @param callid Hash of the incoming call. 216 * @param call Data of the incoming call. 217 * @param arg Local argument 218 218 * 219 219 */ … … 228 228 * This function is defined as a weak symbol - to be redefined in user code. 229 229 * 230 * @param callid 231 * @param call 232 * @param arg 230 * @param callid Hash of the incoming call. 231 * @param call Data of the incoming call. 232 * @param arg Local argument. 233 233 * 234 234 */ … … 709 709 * @param cfibril Fibril function that should be called upon opening the 710 710 * connection. 711 * @param carg 711 * @param carg Extra argument to pass to the connection fibril 712 712 * 713 713 * @return New fibril id or NULL on failure. -
uspace/lib/c/generic/str.c
r3b2e387 r40f606b 540 540 541 541 dstr_size = str_size(dest); 542 if (dstr_size >= size) 542 if (dstr_size >= size) { 543 543 return; 544 544 } 545 545 str_cpy(dest + dstr_size, size - dstr_size, src); 546 546 } -
uspace/lib/c/generic/task.c
r3b2e387 r40f606b 190 190 191 191 return EOK; 192 193 192 error: 194 193 /* Error exit */ -
uspace/lib/c/include/async.h
r3b2e387 r40f606b 55 55 /** Client connection handler 56 56 * 57 * @param callid 58 * 59 * @param call 60 * @param arg 61 * 57 * @param callid ID of incoming call or 0 if connection initiated from 58 * inside using async_connect_to_me() 59 * @param call Incoming call or 0 if connection initiated from inside 60 * @param arg Local argument passed from async_new_connection() or 61 * async_connect_to_me() 62 62 */ 63 63 typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *, void *); -
uspace/lib/c/include/ipc/services.h
r3b2e387 r40f606b 43 43 SERVICE_PCI, 44 44 SERVICE_VIDEO, 45 SERVICE_CONSOLE, 45 46 SERVICE_VFS, 46 47 SERVICE_DEVMAP, -
uspace/lib/usb/src/debug.c
r3b2e387 r40f606b 68 68 if (rc > 0) { 69 69 log_stream = fopen(fname, "w"); 70 if (log_stream != NULL) 70 if (log_stream != NULL) { 71 71 setvbuf(log_stream, NULL, _IOFBF, BUFSIZ); 72 72 } 73 73 free(fname); 74 74 } -
uspace/lib/usbvirt/src/device.c
r3b2e387 r40f606b 49 49 /** Main IPC call handling from virtual host controller. 50 50 * 51 * @param iid 52 * @param icall 53 * @param arg 51 * @param iid Caller identification 52 * @param icall Initial incoming call 53 * @param arg Local argument 54 54 */ 55 55 static void callback_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg) -
uspace/srv/fs/fat/fat_idx.c
r3b2e387 r40f606b 59 59 typedef struct { 60 60 link_t link; 61 devmap_handle_t 61 devmap_handle_t devmap_handle; 62 62 63 63 /** Next unassigned index. */ 64 fs_index_t 64 fs_index_t next; 65 65 /** Number of remaining unassigned indices. */ 66 uint64_t 66 uint64_t remaining; 67 67 68 68 /** Sorted list of intervals of freed indices. */ 69 list_t 69 list_t freed_list; 70 70 } unused_t; 71 71 … … 97 97 return u; 98 98 } 99 99 100 100 if (lock) 101 101 fibril_mutex_unlock(&unused_lock); -
uspace/srv/hid/console/console.c
r3b2e387 r40f606b 482 482 retval = ENOENT; 483 483 } 484 485 484 async_answer_0(callid, retval); 486 485 } … … 748 747 749 748 /* NB: The callback connection is slotted for removal */ 750 rc = async_connect_to_me(exch, 0, 0, 0, input_events, NULL); 749 rc = async_connect_to_me(exch, SERVICE_CONSOLE, 0, 0, input_events, 750 NULL); 751 751 752 752 async_exchange_end(exch); -
uspace/srv/hid/input/Makefile
r3b2e387 r40f606b 36 36 generic/input.c \ 37 37 generic/layout.c \ 38 generic/mouse.c \ 38 39 generic/stroke.c \ 39 40 layout/cz.c \ … … 41 42 layout/us_dvorak.c \ 42 43 port/adb.c \ 43 port/adb_mouse.c \44 44 port/chardev.c \ 45 port/chardev_mouse.c \46 45 port/gxemul.c \ 47 46 port/msim.c \ … … 52 51 port/ski.c \ 53 52 port/z8530.c \ 54 proto/adb.c \55 proto/mousedev.c \56 proto/ps2.c \57 53 ctl/apple.c \ 58 54 ctl/gxe_fb.c \ -
uspace/srv/hid/input/ctl/apple.c
r3b2e387 r40f606b 33 33 /** 34 34 * @file 35 * @brief 35 * @brief Apple ADB keyboard controller driver. 36 36 */ 37 37 … … 42 42 #include <kbd_port.h> 43 43 44 static void apple_ctl_parse (sysarg_t);44 static void apple_ctl_parse_scancode(int); 45 45 static int apple_ctl_init(kbd_dev_t *); 46 static void apple_ctl_set_ind(kbd_dev_t *, unsigned int);46 static void apple_ctl_set_ind(kbd_dev_t *, unsigned); 47 47 48 48 kbd_ctl_ops_t apple_ctl = { 49 .parse = apple_ctl_parse,49 .parse_scancode = apple_ctl_parse_scancode, 50 50 .init = apple_ctl_init, 51 51 .set_ind = apple_ctl_set_ind … … 64 64 } 65 65 66 static void apple_ctl_parse (sysarg_t scancode)66 static void apple_ctl_parse_scancode(int scancode) 67 67 { 68 68 kbd_event_type_t type; 69 69 unsigned int key; 70 70 71 if (scancode >= 0x100)71 if (scancode < 0 || scancode >= 0x100) 72 72 return; 73 73 … … 81 81 key = scanmap[scancode]; 82 82 if (key != 0) 83 kbd_push_ev ent(kbd_dev, type, key);83 kbd_push_ev(kbd_dev, type, key); 84 84 } 85 85 -
uspace/srv/hid/input/ctl/gxe_fb.c
r3b2e387 r40f606b 44 44 #include <stroke.h> 45 45 46 static void gxe_fb_ctl_parse (sysarg_t);46 static void gxe_fb_ctl_parse_scancode(int); 47 47 static int gxe_fb_ctl_init(kbd_dev_t *); 48 static void gxe_fb_ctl_set_ind(kbd_dev_t *, unsigned int);48 static void gxe_fb_ctl_set_ind(kbd_dev_t *, unsigned); 49 49 50 50 kbd_ctl_ops_t gxe_fb_ctl = { 51 .parse = gxe_fb_ctl_parse,51 .parse_scancode = gxe_fb_ctl_parse_scancode, 52 52 .init = gxe_fb_ctl_init, 53 53 .set_ind = gxe_fb_ctl_set_ind … … 229 229 } 230 230 231 static void gxe_fb_ctl_parse (sysarg_t scancode)231 static void gxe_fb_ctl_parse_scancode(int scancode) 232 232 { 233 233 unsigned mods, key; -
uspace/srv/hid/input/ctl/kbdev.c
r3b2e387 r40f606b 53 53 54 54 static int kbdev_ctl_init(kbd_dev_t *); 55 static void kbdev_ctl_set_ind(kbd_dev_t *, unsigned int);55 static void kbdev_ctl_set_ind(kbd_dev_t *, unsigned); 56 56 57 57 static void kbdev_callback_conn(ipc_callid_t, ipc_call_t *, void *arg); 58 58 59 59 kbd_ctl_ops_t kbdev_ctl = { 60 .parse = NULL,60 .parse_scancode = NULL, 61 61 .init = kbdev_ctl_init, 62 62 .set_ind = kbdev_ctl_set_ind … … 116 116 sess = fd_session(EXCHANGE_SERIALIZE, fd); 117 117 if (sess == NULL) { 118 printf( "%s: Failed starting session with '%s'\n", NAME, pathname);118 printf(NAME ": Failed starting session with '%s'\n", pathname); 119 119 close(fd); 120 120 return -1; … … 123 123 kbdev = kbdev_new(kdev); 124 124 if (kbdev == NULL) { 125 printf( "%s: Failed allocating device structure for '%s'.\n",126 NAME,pathname);125 printf(NAME ": Failed allocating device structure for '%s'.\n", 126 pathname); 127 127 return -1; 128 128 } … … 133 133 exch = async_exchange_begin(sess); 134 134 if (exch == NULL) { 135 printf( "%s: Failed starting exchange with '%s'.\n", NAME, pathname);135 printf(NAME ": Failed starting exchange with '%s'.\n", pathname); 136 136 kbdev_destroy(kbdev); 137 137 return -1; … … 140 140 rc = async_connect_to_me(exch, 0, 0, 0, kbdev_callback_conn, kbdev); 141 141 if (rc != EOK) { 142 printf( "%s: Failed creating callback connection from '%s'.\n",143 NAME,pathname);142 printf(NAME ": Failed creating callback connection from '%s'.\n", 143 pathname); 144 144 async_exchange_end(exch); 145 145 kbdev_destroy(kbdev); … … 193 193 type = IPC_GET_ARG1(call); 194 194 key = IPC_GET_ARG2(call); 195 kbd_push_ev ent(kbdev->kbd_dev, type, key);195 kbd_push_ev(kbdev->kbd_dev, type, key); 196 196 break; 197 197 default: -
uspace/srv/hid/input/ctl/pc.c
r3b2e387 r40f606b 43 43 #include <gsp.h> 44 44 45 static void pc_ctl_parse (sysarg_t);45 static void pc_ctl_parse_scancode(int); 46 46 static int pc_ctl_init(kbd_dev_t *); 47 static void pc_ctl_set_ind(kbd_dev_t *, unsigned int);47 static void pc_ctl_set_ind(kbd_dev_t *, unsigned); 48 48 49 49 kbd_ctl_ops_t pc_ctl = { 50 .parse = pc_ctl_parse,50 .parse_scancode = pc_ctl_parse_scancode, 51 51 .init = pc_ctl_init, 52 52 .set_ind = pc_ctl_set_ind … … 215 215 } 216 216 217 static void pc_ctl_parse (sysarg_t scancode)217 static void pc_ctl_parse_scancode(int scancode) 218 218 { 219 219 kbd_event_type_t type; … … 257 257 } 258 258 259 if ((s ize_t) scancode >= map_length)259 if ((scancode < 0) || ((size_t) scancode >= map_length)) 260 260 return; 261 261 262 262 key = map[scancode]; 263 263 if (key != 0) 264 kbd_push_ev ent(kbd_dev, type, key);264 kbd_push_ev(kbd_dev, type, key); 265 265 } 266 266 -
uspace/srv/hid/input/ctl/stty.c
r3b2e387 r40f606b 33 33 /** 34 34 * @file 35 * @brief 35 * @brief Serial TTY-like keyboard controller driver. 36 36 */ 37 37 … … 43 43 #include <stroke.h> 44 44 45 static void stty_ctl_parse (sysarg_t);45 static void stty_ctl_parse_scancode(int); 46 46 static int stty_ctl_init(kbd_dev_t *); 47 static void stty_ctl_set_ind(kbd_dev_t *, unsigned int);47 static void stty_ctl_set_ind(kbd_dev_t *, unsigned); 48 48 49 49 kbd_ctl_ops_t stty_ctl = { 50 .parse = stty_ctl_parse,50 .parse_scancode = stty_ctl_parse_scancode, 51 51 .init = stty_ctl_init, 52 52 .set_ind = stty_ctl_set_ind … … 228 228 } 229 229 230 static void stty_ctl_parse (sysarg_t scancode)230 static void stty_ctl_parse_scancode(int scancode) 231 231 { 232 232 unsigned mods, key; -
uspace/srv/hid/input/ctl/sun.c
r3b2e387 r40f606b 34 34 /** 35 35 * @file 36 * @brief 36 * @brief Sun keyboard controller driver. 37 37 */ 38 38 … … 43 43 #include <kbd_port.h> 44 44 45 static void sun_ctl_parse (sysarg_t);45 static void sun_ctl_parse_scancode(int); 46 46 static int sun_ctl_init(kbd_dev_t *); 47 static void sun_ctl_set_ind(kbd_dev_t *, unsigned int);47 static void sun_ctl_set_ind(kbd_dev_t *, unsigned); 48 48 49 49 kbd_ctl_ops_t sun_ctl = { 50 .parse = sun_ctl_parse,50 .parse_scancode = sun_ctl_parse_scancode, 51 51 .init = sun_ctl_init, 52 52 .set_ind = sun_ctl_set_ind … … 66 66 } 67 67 68 static void sun_ctl_parse (sysarg_t scancode)68 static void sun_ctl_parse_scancode(int scancode) 69 69 { 70 70 kbd_event_type_t type; 71 71 unsigned int key; 72 72 73 if (scancode >= 0x100)73 if (scancode < 0 || scancode >= 0x100) 74 74 return; 75 75 … … 86 86 key = scanmap_simple[scancode]; 87 87 if (key != 0) 88 kbd_push_ev ent(kbd_dev, type, key);88 kbd_push_ev(kbd_dev, type, key); 89 89 } 90 90 -
uspace/srv/hid/input/generic/input.c
r3b2e387 r40f606b 58 58 #include <kbd_port.h> 59 59 #include <kbd_ctl.h> 60 #include <mouse_proto.h>61 60 #include <layout.h> 62 61 #include <mouse.h> … … 66 65 67 66 /* In microseconds */ 68 #define DISCOVERY_POLL_INTERVAL (10 * 1000 * 1000) 69 70 #define NUM_LAYOUTS 3 67 #define DISCOVERY_POLL_INTERVAL (10*1000*1000) 68 69 static void kbd_devs_yield(void); 70 static void kbd_devs_reclaim(void); 71 72 static void input_event_key(int, unsigned int, unsigned, wchar_t); 73 74 int client_phone = -1; 75 76 /** List of keyboard devices */ 77 static list_t kbd_devs; 78 79 /** List of mouse devices */ 80 list_t mouse_devs; 81 82 bool irc_service = false; 83 int irc_phone = -1; 84 85 #define NUM_LAYOUTS 3 71 86 72 87 static layout_ops_t *layout[NUM_LAYOUTS] = { … … 76 91 }; 77 92 78 static void kbd_devs_yield(void); 79 static void kbd_devs_reclaim(void); 80 81 int client_phone = -1; 82 83 /** List of keyboard devices */ 84 static list_t kbd_devs; 85 86 /** List of mouse devices */ 87 static list_t mouse_devs; 88 89 bool irc_service = false; 90 int irc_phone = -1; 91 92 void kbd_push_data(kbd_dev_t *kdev, sysarg_t data) 93 { 94 (*kdev->ctl_ops->parse)(data); 95 } 96 97 void mouse_push_data(mouse_dev_t *mdev, sysarg_t data) 98 { 99 (*mdev->proto_ops->parse)(data); 100 } 101 102 void kbd_push_event(kbd_dev_t *kdev, int type, unsigned int key) 93 void kbd_push_scancode(kbd_dev_t *kdev, int scancode) 94 { 95 /* printf("scancode: 0x%x\n", scancode);*/ 96 (*kdev->ctl_ops->parse_scancode)(scancode); 97 } 98 99 void kbd_push_ev(kbd_dev_t *kdev, int type, unsigned int key) 103 100 { 104 101 kbd_event_t ev; 105 unsigned intmod_mask;106 102 unsigned mod_mask; 103 107 104 switch (key) { 108 105 case KC_LCTRL: mod_mask = KM_LCTRL; break; … … 114 111 default: mod_mask = 0; break; 115 112 } 116 113 117 114 if (mod_mask != 0) { 118 115 if (type == KEY_PRESS) … … 121 118 kdev->mods = kdev->mods & ~mod_mask; 122 119 } 123 120 124 121 switch (key) { 125 122 case KC_CAPS_LOCK: mod_mask = KM_CAPS_LOCK; break; … … 128 125 default: mod_mask = 0; break; 129 126 } 130 127 131 128 if (mod_mask != 0) { 132 129 if (type == KEY_PRESS) { … … 138 135 kdev->mods = kdev->mods ^ (mod_mask & ~kdev->lock_keys); 139 136 kdev->lock_keys = kdev->lock_keys | mod_mask; 140 137 141 138 /* Update keyboard lock indicator lights. */ 142 139 (*kdev->ctl_ops->set_ind)(kdev, kdev->mods); … … 145 142 } 146 143 } 147 144 /* 145 printf("type: %d\n", type); 146 printf("mods: 0x%x\n", mods); 147 printf("keycode: %u\n", key); 148 */ 148 149 if (type == KEY_PRESS && (kdev->mods & KM_LCTRL) && 149 150 key == KC_F1) { 150 151 layout_destroy(kdev->active_layout); 151 152 kdev->active_layout = layout_create(layout[0]); 152 153 return; 153 154 } 154 155 155 156 if (type == KEY_PRESS && (kdev->mods & KM_LCTRL) && 156 157 key == KC_F2) { 157 158 layout_destroy(kdev->active_layout); 158 159 kdev->active_layout = layout_create(layout[1]); 159 160 return; 160 161 } 161 162 162 163 if (type == KEY_PRESS && (kdev->mods & KM_LCTRL) && 163 164 key == KC_F3) { 164 165 layout_destroy(kdev->active_layout); 165 166 kdev->active_layout = layout_create(layout[2]); 166 167 return; 167 168 } 168 169 169 170 ev.type = type; 170 171 ev.key = key; 171 172 ev.mods = kdev->mods; 172 173 173 174 ev.c = layout_parse_ev(kdev->active_layout, &ev); 174 async_obsolete_msg_4(client_phone, INPUT_EVENT_KEY, ev.type, ev.key, 175 ev.mods, ev.c); 175 input_event_key(ev.type, ev.key, ev.mods, ev.c); 176 } 177 178 /** Key has been pressed or released. */ 179 static void input_event_key(int type, unsigned int key, unsigned mods, 180 wchar_t c) 181 { 182 async_obsolete_msg_4(client_phone, INPUT_EVENT_KEY, type, key, 183 mods, c); 176 184 } 177 185 178 186 /** Mouse pointer has moved. */ 179 void mouse_push_event_move(mouse_dev_t *mdev,int dx, int dy)187 void input_event_move(int dx, int dy) 180 188 { 181 189 async_obsolete_msg_2(client_phone, INPUT_EVENT_MOVE, dx, dy); … … 183 191 184 192 /** Mouse button has been pressed. */ 185 void mouse_push_event_button(mouse_dev_t *mdev,int bnum, int press)193 void input_event_button(int bnum, int press) 186 194 { 187 195 async_obsolete_msg_2(client_phone, INPUT_EVENT_BUTTON, bnum, press); … … 193 201 ipc_call_t call; 194 202 int retval; 195 203 196 204 async_answer_0(iid, EOK); 197 205 198 206 while (true) { 199 207 callid = async_get_call(&call); … … 229 237 retval = EINVAL; 230 238 } 231 232 239 async_answer_0(callid, retval); 233 } 240 } 234 241 } 235 242 236 243 static kbd_dev_t *kbd_dev_new(void) 237 244 { 238 kbd_dev_t *kdev = calloc(1, sizeof(kbd_dev_t)); 245 kbd_dev_t *kdev; 246 247 kdev = calloc(1, sizeof(kbd_dev_t)); 239 248 if (kdev == NULL) { 240 printf( "%s: Error allocating keyboard device. "241 "Out of memory.\n" , NAME);249 printf(NAME ": Error allocating keyboard device. " 250 "Out of memory.\n"); 242 251 return NULL; 243 252 } 244 253 245 254 link_initialize(&kdev->kbd_devs); 246 255 247 256 kdev->mods = KM_NUM_LOCK; 248 257 kdev->lock_keys = 0; 249 258 kdev->active_layout = layout_create(layout[0]); 250 259 251 260 return kdev; 252 }253 254 static mouse_dev_t *mouse_dev_new(void)255 {256 mouse_dev_t *mdev = calloc(1, sizeof(mouse_dev_t));257 if (mdev == NULL) {258 printf("%s: Error allocating keyboard device. "259 "Out of memory.\n", NAME);260 return NULL;261 }262 263 link_initialize(&mdev->mouse_devs);264 265 return mdev;266 261 } 267 262 … … 269 264 static void kbd_add_dev(kbd_port_ops_t *port, kbd_ctl_ops_t *ctl) 270 265 { 271 kbd_dev_t *kdev = kbd_dev_new(); 266 kbd_dev_t *kdev; 267 268 kdev = kbd_dev_new(); 272 269 if (kdev == NULL) 273 270 return; 274 271 275 272 kdev->port_ops = port; 276 273 kdev->ctl_ops = ctl; 277 274 kdev->dev_path = NULL; 278 275 279 276 /* Initialize port driver. */ 280 277 if ((*kdev->port_ops->init)(kdev) != 0) 281 278 goto fail; 282 279 283 280 /* Initialize controller driver. */ 284 281 if ((*kdev->ctl_ops->init)(kdev) != 0) { … … 286 283 goto fail; 287 284 } 288 285 289 286 list_append(&kdev->kbd_devs, &kbd_devs); 290 287 return; 291 292 288 fail: 293 289 free(kdev); 294 290 } 295 291 296 /** Add new legacy mouse device. */297 static void mouse_add_dev(mouse_port_ops_t *port, mouse_proto_ops_t *proto)298 {299 mouse_dev_t *mdev = mouse_dev_new();300 if (mdev == NULL)301 return;302 303 mdev->port_ops = port;304 mdev->proto_ops = proto;305 mdev->dev_path = NULL;306 307 /* Initialize port driver. */308 if ((*mdev->port_ops->init)(mdev) != 0)309 goto fail;310 311 /* Initialize protocol driver. */312 if ((*mdev->proto_ops->init)(mdev) != 0) {313 /* XXX Uninit port */314 goto fail;315 }316 317 list_append(&mdev->mouse_devs, &mouse_devs);318 return;319 320 fail:321 free(mdev);322 }323 324 292 /** Add new kbdev device. 325 293 * 326 * @param dev_path Filesystem path to the device (/dev/class/...) 327 * 294 * @param dev_path Filesystem path to the device (/dev/class/...) 328 295 */ 329 296 static int kbd_add_kbdev(const char *dev_path) 330 297 { 331 kbd_dev_t *kdev = kbd_dev_new(); 298 kbd_dev_t *kdev; 299 300 kdev = kbd_dev_new(); 332 301 if (kdev == NULL) 333 302 return -1; 334 303 335 304 kdev->dev_path = dev_path; 336 305 kdev->port_ops = NULL; 337 306 kdev->ctl_ops = &kbdev_ctl; 338 307 339 308 /* Initialize controller driver. */ 340 309 if ((*kdev->ctl_ops->init)(kdev) != 0) { 341 310 goto fail; 342 311 } 343 312 344 313 list_append(&kdev->kbd_devs, &kbd_devs); 345 314 return EOK; 346 347 315 fail: 348 316 free(kdev); 349 return -1;350 }351 352 /** Add new mousedev device.353 *354 * @param dev_path Filesystem path to the device (/dev/class/...)355 *356 */357 static int mouse_add_mousedev(const char *dev_path)358 {359 mouse_dev_t *mdev = mouse_dev_new();360 if (mdev == NULL)361 return -1;362 363 mdev->dev_path = dev_path;364 mdev->port_ops = NULL;365 mdev->proto_ops = &mousedev_proto;366 367 /* Initialize controller driver. */368 if ((*mdev->proto_ops->init)(mdev) != 0) {369 goto fail;370 }371 372 list_append(&mdev->mouse_devs, &mouse_devs);373 return EOK;374 375 fail:376 free(mdev);377 317 return -1; 378 318 } … … 435 375 } 436 376 437 /** Add legacy drivers/devices. */438 static void mouse_add_legacy_devs(void)439 {440 /*441 * Need to add these drivers based on config unless we can probe442 * them automatically.443 */444 #if defined(UARCH_amd64)445 mouse_add_dev(&chardev_mouse_port, &ps2_proto);446 #endif447 #if defined(UARCH_ia32)448 mouse_add_dev(&chardev_mouse_port, &ps2_proto);449 #endif450 #if defined(MACHINE_i460GX)451 mouse_add_dev(&chardev_mouse_port, &ps2_proto);452 #endif453 #if defined(UARCH_ppc32)454 mouse_add_dev(&adb_mouse_port, &adb_proto);455 #endif456 /* Silence warning on abs32le about mouse_add_dev() being unused */457 (void) mouse_add_dev;458 }459 460 377 static void kbd_devs_yield(void) 461 378 { … … 464 381 kbd_dev_t *kdev = list_get_instance(kdev_link, kbd_dev_t, 465 382 kbd_devs); 466 383 467 384 /* Yield port */ 468 385 if (kdev->port_ops != NULL) … … 477 394 kbd_dev_t *kdev = list_get_instance(kdev_link, kbd_dev_t, 478 395 kbd_devs); 479 396 480 397 /* Reclaim port */ 481 398 if (kdev->port_ops != NULL) … … 488 405 * Looks under /dev/class/keyboard and /dev/class/mouse. 489 406 * 490 * @param arg Ignored 491 * 407 * @param arg Ignored 492 408 */ 493 409 static int dev_discovery_fibril(void *arg) … … 497 413 size_t mouse_id = 1; 498 414 int rc; 499 415 500 416 while (true) { 501 417 async_usleep(DISCOVERY_POLL_INTERVAL); 502 418 503 419 /* 504 420 * Check for new keyboard device … … 507 423 if (rc < 0) 508 424 continue; 509 425 510 426 if (kbd_add_kbdev(dev_path) == EOK) { 511 printf( "%s: Connected keyboard device '%s'\n",512 NAME,dev_path);513 427 printf(NAME ": Connected keyboard device '%s'\n", 428 dev_path); 429 514 430 /* XXX Handle device removal */ 515 431 ++kbd_id; 516 432 } 517 433 518 434 free(dev_path); 519 435 520 436 /* 521 437 * Check for new mouse device … … 524 440 if (rc < 0) 525 441 continue; 526 527 if (mouse_add_ mousedev(dev_path) == EOK) {528 printf( "%s: Connected mouse device '%s'\n",529 NAME,dev_path);530 442 443 if (mouse_add_dev(dev_path) == EOK) { 444 printf(NAME ": Connected mouse device '%s'\n", 445 dev_path); 446 531 447 /* XXX Handle device removal */ 532 448 ++mouse_id; 533 449 } 534 450 535 451 free(dev_path); 536 452 } 537 453 538 454 return EOK; 539 455 } … … 542 458 static void input_start_dev_discovery(void) 543 459 { 544 fid_t fid = fibril_create(dev_discovery_fibril, NULL); 460 fid_t fid; 461 462 fid = fibril_create(dev_discovery_fibril, NULL); 545 463 if (!fid) { 546 printf("%s: Failed to create device discovery fibril.\n", 547 NAME); 464 printf(NAME ": Failed to create device discovery fibril.\n"); 548 465 return; 549 466 } 550 467 551 468 fibril_add_ready(fid); 552 469 } … … 573 490 /* Add legacy keyboard devices. */ 574 491 kbd_add_legacy_devs(); 575 576 /* Add legacy mouse devices. */577 mouse_add_legacy_devs();492 493 /* Add legacy (devmap-style) mouse device. */ 494 (void) mouse_add_dev("/dev/hid_in/mouse"); 578 495 579 496 /* Register driver */ … … 592 509 return -1; 593 510 } 594 511 595 512 /* Start looking for new input devices */ 596 513 input_start_dev_discovery(); 597 598 printf( "%s: Accepting connections\n", NAME);514 515 printf(NAME ": Accepting connections\n"); 599 516 async_manager(); 600 517 601 518 /* Not reached. */ 602 519 return 0; -
uspace/srv/hid/input/generic/layout.c
r3b2e387 r40f606b 48 48 layout = calloc(1, sizeof(layout_t)); 49 49 if (layout == NULL) { 50 printf( "%s: Out of memory.\n", NAME);50 printf(NAME ": Out of memory.\n"); 51 51 return NULL; 52 52 } -
uspace/srv/hid/input/generic/stroke.c
r3b2e387 r40f606b 60 60 while (mods_keys[i][0] != 0) { 61 61 if (mod & mods_keys[i][0]) { 62 kbd_push_ev ent(kdev, KEY_PRESS, mods_keys[i][1]);62 kbd_push_ev(kdev, KEY_PRESS, mods_keys[i][1]); 63 63 } 64 64 ++i; … … 67 67 /* Simulate key press and release. */ 68 68 if (key != 0) { 69 kbd_push_ev ent(kdev, KEY_PRESS, key);70 kbd_push_ev ent(kdev, KEY_RELEASE, key);69 kbd_push_ev(kdev, KEY_PRESS, key); 70 kbd_push_ev(kdev, KEY_RELEASE, key); 71 71 } 72 72 … … 75 75 while (mods_keys[i][0] != 0) { 76 76 if (mod & mods_keys[i][0]) { 77 kbd_push_ev ent(kdev, KEY_RELEASE, mods_keys[i][1]);77 kbd_push_ev(kdev, KEY_RELEASE, mods_keys[i][1]); 78 78 } 79 79 ++i; -
uspace/srv/hid/input/include/input.h
r3b2e387 r40f606b 42 42 43 43 #define NAME "input" 44 #define NAMESPACE "hid "44 #define NAMESPACE "hid_in" 45 45 46 46 extern bool irc_service; 47 47 extern int irc_phone; 48 49 extern list_t mouse_devs; 50 51 void input_event_move(int, int); 52 void input_event_button(int bnum, int press); 48 53 49 54 #endif -
uspace/srv/hid/input/include/kbd.h
r3b2e387 r40f606b 71 71 } kbd_dev_t; 72 72 73 extern void kbd_push_ data(kbd_dev_t *, sysarg_t);74 extern void kbd_push_ev ent(kbd_dev_t *, int, unsigned int);73 extern void kbd_push_scancode(kbd_dev_t *, int); 74 extern void kbd_push_ev(kbd_dev_t *, int, unsigned int); 75 75 76 76 #endif -
uspace/srv/hid/input/include/kbd_ctl.h
r3b2e387 r40f606b 28 28 29 29 /** @addtogroup inputgen generic 30 * @brief 31 * @ingroup input30 * @brief Keyboard controller driver interface. 31 * @ingroup input 32 32 * @{ 33 33 */ … … 43 43 44 44 typedef struct kbd_ctl_ops { 45 void (*parse )(sysarg_t);45 void (*parse_scancode)(int); 46 46 int (*init)(struct kbd_dev *); 47 void (*set_ind)(struct kbd_dev *, unsigned int);47 void (*set_ind)(struct kbd_dev *, unsigned); 48 48 } kbd_ctl_ops_t; 49 49 … … 59 59 /** 60 60 * @} 61 */ 61 */ 62 -
uspace/srv/hid/input/include/kbd_port.h
r3b2e387 r40f606b 28 28 29 29 /** @addtogroup inputgen generic 30 * @brief 31 * @ingroup input30 * @brief Keyboard port driver interface. 31 * @ingroup input 32 32 * @{ 33 33 */ … … 51 51 extern kbd_port_ops_t adb_port; 52 52 extern kbd_port_ops_t chardev_port; 53 extern kbd_port_ops_t dummy_port; 53 54 extern kbd_port_ops_t gxemul_port; 54 55 extern kbd_port_ops_t msim_port; … … 64 65 /** 65 66 * @} 66 */ 67 */ 68 -
uspace/srv/hid/input/include/mouse.h
r3b2e387 r40f606b 40 40 #include <adt/list.h> 41 41 42 struct mouse_port_ops;43 struct mouse_proto_ops;44 45 42 typedef struct mouse_dev { 46 43 /** Link to mouse_devs list */ 47 44 link_t mouse_devs; 48 49 /** Path to the device (only for mouseev devices)*/45 46 /** Path to the device */ 50 47 const char *dev_path; 51 52 /** Port ops */53 struct mouse_port_ops *port_ops;54 55 /** Protocol ops */56 struct mouse_proto_ops *proto_ops;57 48 } mouse_dev_t; 58 49 59 extern void mouse_push_data(mouse_dev_t *, sysarg_t); 60 extern void mouse_push_event_move(mouse_dev_t *, int, int); 61 extern void mouse_push_event_button(mouse_dev_t *, int, int); 50 int mouse_add_dev(const char *dev_path); 62 51 63 52 #endif -
uspace/srv/hid/input/layout/cz.c
r3b2e387 r40f606b 391 391 cz_state = malloc(sizeof(layout_cz_t)); 392 392 if (cz_state == NULL) { 393 printf( "%s: Out of memory.\n", NAME);393 printf(NAME ": Out of memory.\n"); 394 394 return ENOMEM; 395 395 } -
uspace/srv/hid/input/port/adb.c
r3b2e387 r40f606b 93 93 async_exchange_end(exch); 94 94 if (rc != EOK) { 95 printf( "%s: Failed to create callback from device\n", NAME);95 printf(NAME ": Failed to create callback from device\n"); 96 96 async_hangup(dev_sess); 97 97 return rc; … … 142 142 static void adb_kbd_reg0_data(uint16_t data) 143 143 { 144 uint8_t b0 = (data >> 8) & 0xff; 145 uint8_t b1 = data & 0xff; 146 144 uint8_t b0, b1; 145 146 b0 = (data >> 8) & 0xff; 147 b1 = data & 0xff; 148 147 149 if (b0 != 0xff) 148 kbd_push_data(kbd_dev, b0); 149 150 kbd_push_scancode(kbd_dev, b0); 150 151 if (b1 != 0xff) 151 kbd_push_ data(kbd_dev, b1);152 kbd_push_scancode(kbd_dev, b1); 152 153 } 153 154 -
uspace/srv/hid/input/port/chardev.c
r3b2e387 r40f606b 108 108 109 109 if (rc != 0) { 110 printf( "%s: Failed to create callback from device\n", NAME);110 printf(NAME ": Failed to create callback from device\n"); 111 111 async_hangup(dev_sess); 112 112 return -1; … … 153 153 switch (IPC_GET_IMETHOD(call)) { 154 154 case CHAR_NOTIF_BYTE: 155 kbd_push_ data(kbd_dev, IPC_GET_ARG1(call));155 kbd_push_scancode(kbd_dev, IPC_GET_ARG1(call)); 156 156 break; 157 157 default: -
uspace/srv/hid/input/port/gxemul.c
r3b2e387 r40f606b 108 108 109 109 /** Process data sent when a key is pressed. 110 * 111 * @param keybuffer Buffer of pressed keys. 112 * @param call IPC call. 110 113 * 111 * @param keybuffer Buffer of pressed keys. 112 * @param call IPC call. 113 * 114 * @return Always 1. 114 115 */ 115 116 static void gxemul_irq_handler(ipc_callid_t iid, ipc_call_t *call) 116 117 { 117 kbd_push_data(kbd_dev, IPC_GET_ARG2(*call)); 118 int scan_code = IPC_GET_ARG2(*call); 119 120 kbd_push_scancode(kbd_dev, scan_code); 118 121 } 119 122 -
uspace/srv/hid/input/port/msim.c
r3b2e387 r40f606b 109 109 static void msim_irq_handler(ipc_callid_t iid, ipc_call_t *call) 110 110 { 111 kbd_push_data(kbd_dev, IPC_GET_ARG2(*call)); 111 int scan_code = IPC_GET_ARG2(*call); 112 kbd_push_scancode(kbd_dev, scan_code); 112 113 } 113 114 114 115 /** @} 115 116 */ -
uspace/srv/hid/input/port/niagara.c
r3b2e387 r40f606b 148 148 c = input_buffer->data[input_buffer->read_ptr]; 149 149 input_buffer->read_ptr = 150 151 kbd_push_ data(kbd_dev, c);150 ((input_buffer->read_ptr) + 1) % INPUT_BUFFER_SIZE; 151 kbd_push_scancode(kbd_dev, c); 152 152 } 153 153 } -
uspace/srv/hid/input/port/ns16550.c
r3b2e387 r40f606b 156 156 static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call) 157 157 { 158 kbd_push_data(kbd_dev, IPC_GET_ARG2(*call)); 158 int scan_code = IPC_GET_ARG2(*call); 159 kbd_push_scancode(kbd_dev, scan_code); 159 160 160 161 if (irc_service) -
uspace/srv/hid/input/port/pl050.c
r3b2e387 r40f606b 137 137 static void pl050_irq_handler(ipc_callid_t iid, ipc_call_t *call) 138 138 { 139 kbd_push_data(kbd_dev, IPC_GET_ARG2(*call)); 139 int scan_code = IPC_GET_ARG2(*call); 140 141 kbd_push_scancode(kbd_dev, scan_code); 142 return; 140 143 } 141 144 142 145 /** 143 146 * @} 144 */ 147 */ -
uspace/srv/hid/input/port/sgcn.c
r3b2e387 r40f606b 183 183 *in_rdptr_ptr = (((*in_rdptr_ptr) - begin + 1) % size) + begin; 184 184 buf_ptr = (volatile char *) 185 186 kbd_push_ data(kbd_dev, c);185 SGCN_BUFFER(char, SGCN_BUFFER_HEADER->in_rdptr); 186 kbd_push_scancode(kbd_dev, c); 187 187 } 188 188 } -
uspace/srv/hid/input/port/ski.c
r3b2e387 r40f606b 110 110 if (c == 0) 111 111 break; 112 kbd_push_ data(kbd_dev, c);112 kbd_push_scancode(kbd_dev, c); 113 113 } 114 114 -
uspace/srv/hid/input/port/z8530.c
r3b2e387 r40f606b 142 142 static void z8530_irq_handler(ipc_callid_t iid, ipc_call_t *call) 143 143 { 144 kbd_push_data(kbd_dev, IPC_GET_ARG2(*call)); 144 int scan_code = IPC_GET_ARG2(*call); 145 kbd_push_scancode(kbd_dev, scan_code); 145 146 146 147 if (irc_service) -
uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c
r3b2e387 r40f606b 42 42 #include <io/console.h> 43 43 #include <vfs/vfs.h> 44 #include <ipc/mouse ev.h>44 #include <ipc/mouse.h> 45 45 #include <async.h> 46 46 #include <async_obsolete.h> … … 57 57 58 58 #define NAME "s3c24ser" 59 #define NAMESPACE "hid "59 #define NAMESPACE "hid_in" 60 60 61 61 static irq_cmd_t ts_irq_cmds[] = { … … 284 284 button = 1; 285 285 press = 0; 286 async_obsolete_msg_2(ts->client_phone, M OUSEEV_BUTTON_EVENT, button, press);286 async_obsolete_msg_2(ts->client_phone, MEVENT_BUTTON, button, press); 287 287 288 288 s3c24xx_ts_wait_for_int_mode(ts, updn_down); … … 325 325 326 326 /* Send notifications to client. */ 327 async_obsolete_msg_2(ts->client_phone, M OUSEEV_MOVE_EVENT, dx, dy);328 async_obsolete_msg_2(ts->client_phone, M OUSEEV_BUTTON_EVENT, button, press);327 async_obsolete_msg_2(ts->client_phone, MEVENT_MOVE, dx, dy); 328 async_obsolete_msg_2(ts->client_phone, MEVENT_BUTTON, button, press); 329 329 330 330 ts->last_x = x_pos;
Note:
See TracChangeset
for help on using the changeset viewer.