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