Changeset db96017 in mainline for uspace/srv/hid/input
- Timestamp:
- 2012-04-07T17:41:44Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b6913b7
- Parents:
- b69e4c0 (diff), 6bb169b5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/srv/hid/input
- Files:
-
- 2 deleted
- 13 edited
-
Makefile (modified) (2 diffs)
-
ctl/kbdev.c (modified) (2 diffs)
-
generic/input.c (modified) (8 diffs)
-
include/mouse.h (modified) (1 diff)
-
include/mouse_proto.h (modified) (1 diff)
-
port/chardev.c (modified) (1 diff)
-
port/chardev_mouse.c (deleted)
-
port/gxemul.c (modified) (4 diffs)
-
port/msim.c (modified) (4 diffs)
-
port/niagara.c (modified) (3 diffs)
-
port/ns16550.c (modified) (4 diffs)
-
port/pl050.c (modified) (4 diffs)
-
proto/adb.c (modified) (1 diff)
-
proto/mousedev.c (modified) (7 diffs)
-
proto/ps2.c (deleted)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/input/Makefile
rb69e4c0 rdb96017 43 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 proto/adb.c \ 53 52 proto/mousedev.c \ 54 proto/ps2.c \55 53 ctl/apple.c \ 56 54 ctl/gxe_fb.c \ -
uspace/srv/hid/input/ctl/kbdev.c
rb69e4c0 rdb96017 111 111 printf("%s: Failed allocating device structure for '%s'.\n", 112 112 NAME, kdev->svc_name); 113 async_hangup(sess); 113 114 return -1; 114 115 } … … 169 170 callid = async_get_call(&call); 170 171 if (!IPC_GET_IMETHOD(call)) { 171 /* XXX Handle hangup */172 kbdev_destroy(kbdev); 172 173 return; 173 174 } -
uspace/srv/hid/input/generic/input.c
rb69e4c0 rdb96017 39 39 #include <adt/list.h> 40 40 #include <bool.h> 41 #include <fibril_synch.h> 41 42 #include <ipc/services.h> 42 43 #include <ipc/input.h> … … 83 84 async_sess_t *irc_sess = NULL; 84 85 86 static FIBRIL_MUTEX_INITIALIZE(discovery_lock); 87 85 88 void kbd_push_data(kbd_dev_t *kdev, sysarg_t data) 86 89 { … … 172 175 173 176 /** Mouse pointer has moved. */ 174 void mouse_push_event_move(mouse_dev_t *mdev, int dx, int dy )177 void mouse_push_event_move(mouse_dev_t *mdev, int dx, int dy, int dz) 175 178 { 176 179 async_exch_t *exch = async_exchange_begin(client_sess); 177 async_msg_2(exch, INPUT_EVENT_MOVE, dx, dy); 180 if (dx || dy) 181 async_msg_2(exch, INPUT_EVENT_MOVE, dx, dy); 182 if (dz) { 183 // TODO: Implement proper wheel support 184 keycode_t code = dz > 0 ? KC_UP : KC_DOWN; 185 for (int i = 0; i < 3; ++i) { 186 async_msg_4(exch, INPUT_EVENT_KEY, KEY_PRESS, code, 0, 0); 187 } 188 async_msg_4(exch, INPUT_EVENT_KEY, KEY_RELEASE, code, 0, 0); 189 } 178 190 async_exchange_end(exch); 179 191 } … … 397 409 * them automatically. 398 410 */ 399 #if defined(UARCH_amd64)400 kbd_add_dev(&chardev_port, &pc_ctl);401 #endif402 411 #if defined(UARCH_arm32) && defined(MACHINE_gta02) 403 412 kbd_add_dev(&chardev_port, &stty_ctl); … … 411 420 #if defined(UARCH_arm32) && defined(MACHINE_integratorcp) 412 421 kbd_add_dev(&pl050_port, &pc_ctl); 413 #endif414 #if defined(UARCH_ia32)415 kbd_add_dev(&chardev_port, &pc_ctl);416 #endif417 #if defined(MACHINE_i460GX)418 kbd_add_dev(&chardev_port, &pc_ctl);419 422 #endif 420 423 #if defined(MACHINE_ski) … … 450 453 * them automatically. 451 454 */ 452 #if defined(UARCH_amd64)453 mouse_add_dev(&chardev_mouse_port, &ps2_proto);454 #endif455 #if defined(UARCH_ia32)456 mouse_add_dev(&chardev_mouse_port, &ps2_proto);457 #endif458 #if defined(MACHINE_i460GX)459 mouse_add_dev(&chardev_mouse_port, &ps2_proto);460 #endif461 455 #if defined(UARCH_ppc32) 462 456 mouse_add_dev(&adb_mouse_port, &adb_proto); … … 602 596 int rc; 603 597 598 fibril_mutex_lock(&discovery_lock); 599 604 600 rc = dev_check_new_kbdevs(); 605 if (rc != EOK) 601 if (rc != EOK) { 602 fibril_mutex_unlock(&discovery_lock); 606 603 return rc; 604 } 607 605 608 606 rc = dev_check_new_mousedevs(); 609 if (rc != EOK) 607 if (rc != EOK) { 608 fibril_mutex_unlock(&discovery_lock); 610 609 return rc; 611 610 } 611 612 fibril_mutex_unlock(&discovery_lock); 613 612 614 return EOK; 613 615 } … … 658 660 659 661 /* Register driver */ 660 int rc = loc_server_register(NAME, client_connection); 662 async_set_client_connection(client_connection); 663 int rc = loc_server_register(NAME); 661 664 if (rc < 0) { 662 665 printf("%s: Unable to register server (%d)\n", NAME, rc); -
uspace/srv/hid/input/include/mouse.h
rb69e4c0 rdb96017 62 62 63 63 extern void mouse_push_data(mouse_dev_t *, sysarg_t); 64 extern void mouse_push_event_move(mouse_dev_t *, int, int );64 extern void mouse_push_event_move(mouse_dev_t *, int, int, int); 65 65 extern void mouse_push_event_button(mouse_dev_t *, int, int); 66 66 -
uspace/srv/hid/input/include/mouse_proto.h
rb69e4c0 rdb96017 48 48 49 49 extern mouse_proto_ops_t adb_proto; 50 extern mouse_proto_ops_t ps2_proto;51 50 extern mouse_proto_ops_t mousedev_proto; 52 51 -
uspace/srv/hid/input/port/chardev.c
rb69e4c0 rdb96017 63 63 /** List of devices to try connecting to. */ 64 64 static const char *in_devs[] = { 65 "char/ps2a",66 65 "char/s3c24ser" 67 66 }; -
uspace/srv/hid/input/port/gxemul.c
rb69e4c0 rdb96017 57 57 static kbd_dev_t *kbd_dev; 58 58 59 static irq_pio_range_t gxemul_ranges[] = { 60 { 61 .base = 0, 62 .size = 1 63 } 64 }; 65 59 66 static irq_cmd_t gxemul_cmds[] = { 60 67 { … … 69 76 70 77 static irq_code_t gxemul_kbd = { 78 sizeof(gxemul_ranges) / sizeof(irq_pio_range_t), 79 gxemul_ranges, 71 80 sizeof(gxemul_cmds) / sizeof(irq_cmd_t), 72 81 gxemul_cmds … … 81 90 82 91 sysarg_t addr; 83 if (sysinfo_get_value("kbd.address. virtual", &addr) != EOK)92 if (sysinfo_get_value("kbd.address.physical", &addr) != EOK) 84 93 return -1; 85 94 … … 89 98 90 99 async_set_interrupt_received(gxemul_irq_handler); 100 gxemul_ranges[0].base = addr; 91 101 gxemul_cmds[0].addr = (void *) addr; 92 register_irq(inr, device_assign_devno(), 0, &gxemul_kbd);102 irq_register(inr, device_assign_devno(), 0, &gxemul_kbd); 93 103 return 0; 94 104 } -
uspace/srv/hid/input/port/msim.c
rb69e4c0 rdb96017 57 57 static kbd_dev_t *kbd_dev; 58 58 59 static irq_pio_range_t msim_ranges[] = { 60 { 61 .base = 0, 62 .size = 1 63 } 64 }; 65 59 66 static irq_cmd_t msim_cmds[] = { 60 67 { … … 69 76 70 77 static irq_code_t msim_kbd = { 78 sizeof(msim_ranges) / sizeof(irq_pio_range_t), 79 msim_ranges, 71 80 sizeof(msim_cmds) / sizeof(irq_cmd_t), 72 81 msim_cmds … … 79 88 kbd_dev = kdev; 80 89 81 sysarg_t vaddr;82 if (sysinfo_get_value("kbd.address. virtual", &vaddr) != EOK)90 sysarg_t paddr; 91 if (sysinfo_get_value("kbd.address.physical", &paddr) != EOK) 83 92 return -1; 84 93 … … 87 96 return -1; 88 97 89 msim_cmds[0].addr = (void *) vaddr; 98 msim_ranges[0].base = paddr; 99 msim_cmds[0].addr = (void *) paddr; 90 100 async_set_interrupt_received(msim_irq_handler); 91 register_irq(inr, device_assign_devno(), 0, &msim_kbd);101 irq_register(inr, device_assign_devno(), 0, &msim_kbd); 92 102 93 103 return 0; -
uspace/srv/hid/input/port/niagara.c
rb69e4c0 rdb96017 63 63 #define POLL_INTERVAL 10000 64 64 65 /**66 * Virtual address mapped to the buffer shared with the kernel counterpart.67 */68 static uintptr_t input_buffer_addr;69 70 65 /* 71 66 * Kernel counterpart of the driver pushes characters (it has read) here. … … 102 97 return -1; 103 98 104 input_buffer_addr = (uintptr_t) as_get_mappable_page(PAGE_SIZE); 105 int rc = physmem_map((void *) paddr, (void *) input_buffer_addr, 106 1, AS_AREA_READ | AS_AREA_WRITE); 107 99 int rc = physmem_map((void *) paddr, 1, 100 AS_AREA_READ | AS_AREA_WRITE, (void *) &input_buffer); 108 101 if (rc != 0) { 109 102 printf("Niagara: uspace driver couldn't map physical memory: %d\n", … … 111 104 return rc; 112 105 } 113 114 input_buffer = (input_buffer_t) input_buffer_addr;115 106 116 107 thread_id_t tid; -
uspace/srv/hid/input/port/ns16550.c
rb69e4c0 rdb96017 70 70 #define LSR_DATA_READY 0x01 71 71 72 static irq_pio_range_t ns16550_ranges[] = { 73 { 74 .base = 0, 75 .size = 8 76 } 77 }; 78 72 79 static irq_cmd_t ns16550_cmds[] = { 73 80 { … … 98 105 99 106 irq_code_t ns16550_kbd = { 107 sizeof(ns16550_ranges) / sizeof(irq_pio_range_t), 108 ns16550_ranges, 100 109 sizeof(ns16550_cmds) / sizeof(irq_cmd_t), 101 110 ns16550_cmds … … 105 114 106 115 static uintptr_t ns16550_physical; 107 static uintptr_t ns16550_kernel;108 116 109 117 static kbd_dev_t *kbd_dev; … … 124 132 return -1; 125 133 126 if (sysinfo_get_value("kbd.address.kernel", &ns16550_kernel) != EOK)127 return -1;128 129 134 sysarg_t inr; 130 135 if (sysinfo_get_value("kbd.inr", &inr) != EOK) 131 136 return -1; 132 137 133 ns16550_kbd.cmds[0].addr = (void *) (ns16550_kernel + LSR_REG); 134 ns16550_kbd.cmds[3].addr = (void *) (ns16550_kernel + RBR_REG); 138 ns16550_kbd.ranges[0].base = ns16550_physical; 139 ns16550_kbd.cmds[0].addr = (void *) (ns16550_physical + LSR_REG); 140 ns16550_kbd.cmds[3].addr = (void *) (ns16550_physical + RBR_REG); 135 141 136 142 async_set_interrupt_received(ns16550_irq_handler); 137 register_irq(inr, device_assign_devno(), inr, &ns16550_kbd);143 irq_register(inr, device_assign_devno(), inr, &ns16550_kbd); 138 144 139 145 return pio_enable((void *) ns16550_physical, 8, &vaddr); -
uspace/srv/hid/input/port/pl050.c
rb69e4c0 rdb96017 61 61 static kbd_dev_t *kbd_dev; 62 62 63 #define PL050_STAT 4 64 #define PL050_DATA 8 65 63 66 #define PL050_STAT_RXFULL (1 << 4) 67 68 static irq_pio_range_t pl050_ranges[] = { 69 { 70 .base = 0, 71 .size = 9, 72 } 73 }; 64 74 65 75 static irq_cmd_t pl050_cmds[] = { … … 91 101 92 102 static irq_code_t pl050_kbd = { 103 sizeof(pl050_ranges) / sizeof(irq_pio_range_t), 104 pl050_ranges, 93 105 sizeof(pl050_cmds) / sizeof(irq_cmd_t), 94 106 pl050_cmds … … 102 114 103 115 sysarg_t addr; 104 if (sysinfo_get_value("kbd.address. status", &addr) != EOK)116 if (sysinfo_get_value("kbd.address.physical", &addr) != EOK) 105 117 return -1; 106 118 107 pl050_kbd.cmds[0].addr = (void *) addr; 108 109 if (sysinfo_get_value("kbd.address.data", &addr) != EOK) 110 return -1; 111 112 pl050_kbd.cmds[3].addr = (void *) addr; 119 pl050_kbd.ranges[0].base = addr; 120 pl050_kbd.cmds[0].addr = (void *) addr + PL050_STAT; 121 pl050_kbd.cmds[3].addr = (void *) addr + PL050_DATA; 113 122 114 123 sysarg_t inr; … … 117 126 118 127 async_set_interrupt_received(pl050_irq_handler); 119 register_irq(inr, device_assign_devno(), 0, &pl050_kbd);128 irq_register(inr, device_assign_devno(), 0, &pl050_kbd); 120 129 121 130 return 0; -
uspace/srv/hid/input/proto/adb.c
rb69e4c0 rdb96017 82 82 83 83 if (dx != 0 || dy != 0) 84 mouse_push_event_move(mouse_dev, dx, dy );84 mouse_push_event_move(mouse_dev, dx, dy, 0); 85 85 } 86 86 -
uspace/srv/hid/input/proto/mousedev.c
rb69e4c0 rdb96017 54 54 /** Link to generic mouse device */ 55 55 mouse_dev_t *mouse_dev; 56 57 /** Session to mouse device */58 async_sess_t *sess;59 56 } mousedev_t; 60 57 … … 72 69 static void mousedev_destroy(mousedev_t *mousedev) 73 70 { 74 if (mousedev->sess != NULL)75 async_hangup(mousedev->sess);76 77 71 free(mousedev); 78 72 } … … 89 83 90 84 if (!IPC_GET_IMETHOD(call)) { 91 /* XXX Handle hangup */85 mousedev_destroy(mousedev); 92 86 return; 93 87 } … … 97 91 switch (IPC_GET_IMETHOD(call)) { 98 92 case MOUSEEV_MOVE_EVENT: 99 mouse_push_event_move(mousedev->mouse_dev, IPC_GET_ARG1(call), 100 IPC_GET_ARG2(call)); 93 mouse_push_event_move(mousedev->mouse_dev, 94 IPC_GET_ARG1(call), IPC_GET_ARG2(call), 95 IPC_GET_ARG3(call)); 101 96 retval = EOK; 102 97 break; 103 98 case MOUSEEV_BUTTON_EVENT: 104 mouse_push_event_button(mousedev->mouse_dev, IPC_GET_ARG1(call),105 IPC_GET_ARG 2(call));99 mouse_push_event_button(mousedev->mouse_dev, 100 IPC_GET_ARG1(call), IPC_GET_ARG2(call)); 106 101 retval = EOK; 107 102 break; … … 129 124 printf("%s: Failed allocating device structure for '%s'.\n", 130 125 NAME, mdev->svc_name); 126 async_hangup(sess); 131 127 return -1; 132 128 } 133 134 mousedev->sess = sess;135 129 136 130 async_exch_t *exch = async_exchange_begin(sess); … … 139 133 mdev->svc_name); 140 134 mousedev_destroy(mousedev); 135 async_hangup(sess); 141 136 return -1; 142 137 } … … 144 139 int rc = async_connect_to_me(exch, 0, 0, 0, mousedev_callback_conn, mousedev); 145 140 async_exchange_end(exch); 141 async_hangup(sess); 146 142 147 143 if (rc != EOK) {
Note:
See TracChangeset
for help on using the changeset viewer.
