Changeset 79ae36dd in mainline for uspace/srv/hid/kbd
- Timestamp:
- 2011-06-08T19:01:55Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0eff68e
- Parents:
- 764d71e
- Location:
- uspace/srv/hid/kbd
- Files:
-
- 12 edited
-
ctl/apple.c (modified) (1 diff)
-
ctl/pc.c (modified) (1 diff)
-
ctl/sun.c (modified) (1 diff)
-
generic/kbd.c (modified) (7 diffs)
-
include/layout.h (modified) (1 diff)
-
layout/cz.c (modified) (5 diffs)
-
layout/us_dvorak.c (modified) (2 diffs)
-
layout/us_qwerty.c (modified) (2 diffs)
-
port/adb.c (modified) (5 diffs)
-
port/chardev.c (modified) (5 diffs)
-
port/ns16550.c (modified) (2 diffs)
-
port/z8530.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/kbd/ctl/apple.c
r764d71e r79ae36dd 52 52 void kbd_ctl_parse_scancode(int scancode) 53 53 { 54 console_ev_type_t type;54 kbd_event_type_t type; 55 55 unsigned int key; 56 56 -
uspace/srv/hid/kbd/ctl/pc.c
r764d71e r79ae36dd 205 205 void kbd_ctl_parse_scancode(int scancode) 206 206 { 207 console_ev_type_t type;207 kbd_event_type_t type; 208 208 unsigned int key; 209 209 int *map; -
uspace/srv/hid/kbd/ctl/sun.c
r764d71e r79ae36dd 53 53 void kbd_ctl_parse_scancode(int scancode) 54 54 { 55 console_ev_type_t type;55 kbd_event_type_t type; 56 56 unsigned int key; 57 57 -
uspace/srv/hid/kbd/generic/kbd.c
r764d71e r79ae36dd 43 43 #include <stdlib.h> 44 44 #include <stdio.h> 45 #include <ipc/ns.h> 45 #include <ns.h> 46 #include <ns_obsolete.h> 46 47 #include <async.h> 48 #include <async_obsolete.h> 47 49 #include <errno.h> 48 50 #include <adt/fifo.h> … … 50 52 #include <io/keycode.h> 51 53 #include <devmap.h> 52 53 54 #include <kbd.h> 54 55 #include <kbd_port.h> 55 56 #include <kbd_ctl.h> 56 57 #include <layout.h> 58 59 // FIXME: remove this header 60 #include <kernel/ipc/ipc_methods.h> 57 61 58 62 #define NAME "kbd" … … 88 92 void kbd_push_ev(int type, unsigned int key) 89 93 { 90 console_event_t ev;94 kbd_event_t ev; 91 95 unsigned mod_mask; 92 96 … … 163 167 ev.c = layout[active_layout]->parse_ev(&ev); 164 168 165 async_ msg_4(client_phone, KBD_EVENT, ev.type, ev.key, ev.mods, ev.c);169 async_obsolete_msg_4(client_phone, KBD_EVENT, ev.type, ev.key, ev.mods, ev.c); 166 170 } 167 171 … … 174 178 async_answer_0(iid, EOK); 175 179 176 while ( 1) {180 while (true) { 177 181 callid = async_get_call(&call); 178 switch (IPC_GET_IMETHOD(call)) {179 case IPC_M_PHONE_HUNGUP:182 183 if (!IPC_GET_IMETHOD(call)) { 180 184 if (client_phone != -1) { 181 async_ hangup(client_phone);185 async_obsolete_hangup(client_phone); 182 186 client_phone = -1; 183 187 } … … 185 189 async_answer_0(callid, EOK); 186 190 return; 191 } 192 193 switch (IPC_GET_IMETHOD(call)) { 187 194 case IPC_M_CONNECT_TO_ME: 188 195 if (client_phone != -1) { … … 222 229 if (irc_service) { 223 230 while (irc_phone < 0) 224 irc_phone = service_ connect_blocking(SERVICE_IRC, 0, 0);231 irc_phone = service_obsolete_connect_blocking(SERVICE_IRC, 0, 0); 225 232 } 226 233 -
uspace/srv/hid/kbd/include/layout.h
r764d71e r79ae36dd 43 43 typedef struct { 44 44 void (*reset)(void); 45 wchar_t (*parse_ev)( console_event_t *);45 wchar_t (*parse_ev)(kbd_event_t *); 46 46 } layout_op_t; 47 47 -
uspace/srv/hid/kbd/layout/cz.c
r764d71e r79ae36dd 39 39 40 40 static void layout_reset(void); 41 static wchar_t layout_parse_ev( console_event_t *ev);41 static wchar_t layout_parse_ev(kbd_event_t *ev); 42 42 43 43 enum m_state { … … 273 273 } 274 274 275 static wchar_t parse_ms_hacek( console_event_t *ev)275 static wchar_t parse_ms_hacek(kbd_event_t *ev) 276 276 { 277 277 wchar_t c; … … 291 291 } 292 292 293 static wchar_t parse_ms_carka( console_event_t *ev)293 static wchar_t parse_ms_carka(kbd_event_t *ev) 294 294 { 295 295 wchar_t c; … … 309 309 } 310 310 311 static wchar_t parse_ms_start( console_event_t *ev)311 static wchar_t parse_ms_start(kbd_event_t *ev) 312 312 { 313 313 wchar_t c; … … 384 384 } 385 385 386 static wchar_t layout_parse_ev( console_event_t *ev)386 static wchar_t layout_parse_ev(kbd_event_t *ev) 387 387 { 388 388 if (ev->type != KEY_PRESS) -
uspace/srv/hid/kbd/layout/us_dvorak.c
r764d71e r79ae36dd 38 38 39 39 static void layout_reset(void); 40 static wchar_t layout_parse_ev( console_event_t *ev);40 static wchar_t layout_parse_ev(kbd_event_t *ev); 41 41 42 42 layout_op_t us_dvorak_op = { … … 210 210 } 211 211 212 static wchar_t layout_parse_ev( console_event_t *ev)212 static wchar_t layout_parse_ev(kbd_event_t *ev) 213 213 { 214 214 wchar_t c; -
uspace/srv/hid/kbd/layout/us_qwerty.c
r764d71e r79ae36dd 38 38 39 39 static void layout_reset(void); 40 static wchar_t layout_parse_ev( console_event_t *ev);40 static wchar_t layout_parse_ev(kbd_event_t *ev); 41 41 42 42 layout_op_t us_qwerty_op = { … … 204 204 } 205 205 206 static wchar_t layout_parse_ev( console_event_t *ev)206 static wchar_t layout_parse_ev(kbd_event_t *ev) 207 207 { 208 208 wchar_t c; -
uspace/srv/hid/kbd/port/adb.c
r764d71e r79ae36dd 30 30 * @ingroup kbd 31 31 * @{ 32 */ 32 */ 33 33 /** @file 34 34 * @brief ADB keyboard port driver. … … 37 37 #include <ipc/adb.h> 38 38 #include <async.h> 39 #include <async_obsolete.h> 39 40 #include <kbd_port.h> 40 41 #include <kbd.h> … … 42 43 #include <fcntl.h> 43 44 #include <errno.h> 45 #include <devmap.h> 46 #include <devmap_obsolete.h> 44 47 45 48 static void kbd_port_events(ipc_callid_t iid, ipc_call_t *icall); … … 52 55 int kbd_port_init(void) 53 56 { 54 const char *input = "/dev/adb/kbd"; 55 int input_fd; 56 57 printf(NAME ": open %s\n", input); 58 59 input_fd = open(input, O_RDONLY); 60 if (input_fd < 0) { 61 printf(NAME ": Failed opening %s (%d)\n", input, input_fd); 62 return false; 57 const char *dev = "adb/kbd"; 58 devmap_handle_t handle; 59 60 int rc = devmap_device_get_handle(dev, &handle, 0); 61 if (rc == EOK) { 62 dev_phone = devmap_obsolete_device_connect(handle, 0); 63 if (dev_phone < 0) { 64 printf("%s: Failed to connect to device\n", NAME); 65 return dev_phone; 66 } 67 } else 68 return rc; 69 70 /* NB: The callback connection is slotted for removal */ 71 rc = async_obsolete_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events); 72 if (rc != EOK) { 73 printf(NAME ": Failed to create callback from device\n"); 74 return rc; 63 75 } 64 65 dev_phone = fd_phone(input_fd); 66 if (dev_phone < 0) { 67 printf(NAME ": Failed to connect to device\n"); 68 return false; 69 } 70 71 /* NB: The callback connection is slotted for removal */ 72 if (async_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events) != 0) { 73 printf(NAME ": Failed to create callback from device\n"); 74 return false; 75 } 76 77 return 0; 76 77 return EOK; 78 78 } 79 79 … … 100 100 101 101 int retval; 102 103 switch (IPC_GET_IMETHOD(call)) { 104 case IPC_M_PHONE_HUNGUP: 102 103 if (!IPC_GET_IMETHOD(call)) { 105 104 /* TODO: Handle hangup */ 106 105 return; 106 } 107 108 switch (IPC_GET_IMETHOD(call)) { 107 109 case ADB_REG_NOTIF: 108 110 adb_kbd_reg0_data(IPC_GET_ARG1(call)); -
uspace/srv/hid/kbd/port/chardev.c
r764d71e r79ae36dd 30 30 * @ingroup kbd 31 31 * @{ 32 */ 32 */ 33 33 /** @file 34 34 * @brief Chardev keyboard port driver. … … 37 37 #include <ipc/char.h> 38 38 #include <async.h> 39 #include <async_obsolete.h> 39 40 #include <kbd_port.h> 40 41 #include <kbd.h> 41 #include <vfs/vfs.h> 42 #include <sys/stat.h> 43 #include <fcntl.h> 42 #include <devmap.h> 43 #include <devmap_obsolete.h> 44 44 #include <errno.h> 45 #include <stdio.h> 46 47 #define NAME "kbd/chardev" 45 48 46 49 static void kbd_port_events(ipc_callid_t iid, ipc_call_t *icall); … … 48 51 static int dev_phone; 49 52 50 #define NAME "kbd"51 52 53 /** List of devices to try connecting to. */ 53 54 static const char *in_devs[] = { 54 " /dev/char/ps2a",55 " /dev/char/s3c24ser"55 "char/ps2a", 56 "char/s3c24ser" 56 57 }; 57 58 58 static const int num_devs = sizeof(in_devs) / sizeof(in_devs[0]);59 static const unsigned int num_devs = sizeof(in_devs) / sizeof(in_devs[0]); 59 60 60 61 int kbd_port_init(void) 61 62 { 62 int input_fd;63 int i;64 65 input_fd = -1;63 devmap_handle_t handle; 64 unsigned int i; 65 int rc; 66 66 67 for (i = 0; i < num_devs; i++) { 67 struct stat s; 68 69 if (stat(in_devs[i], &s) == EOK) 68 rc = devmap_device_get_handle(in_devs[i], &handle, 0); 69 if (rc == EOK) 70 70 break; 71 71 } 72 72 73 73 if (i >= num_devs) { 74 printf( NAME ": Could not find any suitable input device.\n");74 printf("%s: Could not find any suitable input device\n", NAME); 75 75 return -1; 76 76 } 77 78 input_fd = open(in_devs[i], O_RDONLY); 79 if (input_fd < 0) { 80 printf(NAME ": failed opening device %s (%d).\n", in_devs[i], 81 input_fd); 82 return -1; 77 78 dev_phone = devmap_obsolete_device_connect(handle, IPC_FLAG_BLOCKING); 79 if (dev_phone < 0) { 80 printf("%s: Failed connecting to device\n", NAME); 81 return ENOENT; 83 82 } 84 85 dev_phone = fd_phone(input_fd); 86 if (dev_phone < 0) { 87 printf(NAME ": Failed connecting to device\n"); 88 return -1; 89 } 90 83 91 84 /* NB: The callback connection is slotted for removal */ 92 if (async_ connect_to_me(dev_phone, 0, 0, 0, kbd_port_events) != 0) {85 if (async_obsolete_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events) != 0) { 93 86 printf(NAME ": Failed to create callback from device\n"); 94 87 return -1; … … 108 101 void kbd_port_write(uint8_t data) 109 102 { 110 async_ msg_1(dev_phone, CHAR_WRITE_BYTE, data);103 async_obsolete_msg_1(dev_phone, CHAR_WRITE_BYTE, data); 111 104 } 112 105 … … 118 111 ipc_call_t call; 119 112 ipc_callid_t callid = async_get_call(&call); 113 114 if (!IPC_GET_IMETHOD(call)) { 115 /* TODO: Handle hangup */ 116 return; 117 } 120 118 121 119 int retval; 122 120 123 121 switch (IPC_GET_IMETHOD(call)) { 124 case IPC_M_PHONE_HUNGUP:125 /* TODO: Handle hangup */126 return;127 122 case CHAR_NOTIF_BYTE: 128 123 kbd_push_scancode(IPC_GET_ARG1(call)); -
uspace/srv/hid/kbd/port/ns16550.c
r764d71e r79ae36dd 37 37 #include <ipc/irc.h> 38 38 #include <async.h> 39 #include <async_obsolete.h> 39 40 #include <sysinfo.h> 40 41 #include <kbd.h> … … 121 122 122 123 if (irc_service) 123 async_ msg_1(irc_phone, IRC_CLEAR_INTERRUPT,124 async_obsolete_msg_1(irc_phone, IRC_CLEAR_INTERRUPT, 124 125 IPC_GET_IMETHOD(*call)); 125 126 } -
uspace/srv/hid/kbd/port/z8530.c
r764d71e r79ae36dd 37 37 #include <ipc/irc.h> 38 38 #include <async.h> 39 #include <async_obsolete.h> 39 40 #include <sysinfo.h> 40 41 #include <kbd.h> … … 109 110 110 111 if (irc_service) 111 async_ msg_1(irc_phone, IRC_CLEAR_INTERRUPT,112 async_obsolete_msg_1(irc_phone, IRC_CLEAR_INTERRUPT, 112 113 IPC_GET_IMETHOD(*call)); 113 114 }
Note:
See TracChangeset
for help on using the changeset viewer.
