Changeset f991b6b in mainline
- Timestamp:
- 2012-01-14T09:53:41Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6d8455d
- Parents:
- 0a549cc (diff), d5c60a2 (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. - Files:
-
- 18 added
- 3 deleted
- 15 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/amd64/Makefile.inc
r0a549cc rf991b6b 28 28 29 29 RD_SRVS_ESSENTIAL += \ 30 $(USPACE_PATH)/srv/hw/char/i8042/i8042 \31 30 $(USPACE_PATH)/srv/hw/irc/apic/apic \ 32 31 $(USPACE_PATH)/srv/hw/irc/i8259/i8259 … … 39 38 bus/pci/pciintel \ 40 39 bus/isa \ 40 char/i8042 \ 41 41 char/ns8250 \ 42 char/ps2mouse \ 43 char/xtkbd \ 42 44 bus/usb/ehci\ 43 45 bus/usb/ohci \ -
boot/arch/ia64/Makefile.inc
r0a549cc rf991b6b 37 37 RD_SRVS_NON_ESSENTIAL += 38 38 39 RD_SRVS_ESSENTIAL += \ 40 $(USPACE_PATH)/srv/hw/char/i8042/i8042 39 RD_SRVS_ESSENTIAL += 41 40 42 41 SOURCES = \ -
uspace/Makefile
r0a549cc rf991b6b 93 93 srv/hid/fb \ 94 94 srv/hid/input \ 95 srv/hw/char/i8042 \96 95 srv/hw/char/s3c24xx_uart \ 97 96 srv/net/il/arp \ … … 105 104 drv/infrastructure/root \ 106 105 drv/infrastructure/rootvirt \ 106 drv/char/i8042 \ 107 drv/char/ps2mouse \ 108 drv/char/xtkbd \ 107 109 drv/test/test1 \ 108 110 drv/test/test2 \ -
uspace/app/init/init.c
r0a549cc rf991b6b 302 302 spawn("/srv/obio"); 303 303 srv_start("/srv/cuda_adb"); 304 srv_start("/srv/i8042");305 304 srv_start("/srv/s3c24ser"); 306 305 srv_start("/srv/s3c24ts"); -
uspace/drv/bus/isa/isa.c
r0a549cc rf991b6b 52 52 #include <dirent.h> 53 53 #include <fcntl.h> 54 #include <ipc/irc.h> 55 #include <ipc/services.h> 56 #include <sysinfo.h> 57 #include <ns.h> 54 58 #include <sys/stat.h> 55 59 #include <ipc/irc.h> … … 109 113 sysarg_t apic; 110 114 sysarg_t i8259; 111 115 112 116 async_sess_t *irc_sess = NULL; 113 117 114 118 if (((sysinfo_get_value("apic", &apic) == EOK) && (apic)) 115 119 || ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259))) { … … 117 121 SERVICE_IRC, 0, 0); 118 122 } 119 123 120 124 if (!irc_sess) 121 125 return false; 122 126 123 127 assert(isa_fun); 124 128 const hw_resource_list_t *res = &isa_fun->hw_resources; … … 127 131 if (res->resources[i].type == INTERRUPT) { 128 132 const int irq = res->resources[i].res.interrupt.irq; 129 133 130 134 async_exch_t *exch = async_exchange_begin(irc_sess); 131 135 const int rc = 132 136 async_req_1_0(exch, IRC_ENABLE_INTERRUPT, irq); 133 137 async_exchange_end(exch); 134 138 135 139 if (rc != EOK) { 136 140 async_hangup(irc_sess); … … 139 143 } 140 144 } 141 145 142 146 async_hangup(irc_sess); 143 147 return true; … … 397 401 398 402 val = skip_spaces(val); 399 irq = (int)strtol(val, &end, 0x10);403 irq = (int)strtol(val, &end, 10); 400 404 401 405 if (val != end) -
uspace/drv/bus/isa/isa.dev
r0a549cc rf991b6b 9 9 io_range 2f8 8 10 10 11 keyboard:12 match 100 isa/ keyboard11 i8042: 12 match 100 isa/i8042 13 13 irq 1 14 io_range 060 10 14 irq 12 15 io_range 060 5 16 15 17 16 18 ne2k: -
uspace/drv/bus/usb/usbhid/mouse/mousedev.c
r0a549cc rf991b6b 52 52 #include "../usbhid.h" 53 53 54 /** Number of simulated arrow-key presses for singel wheel step. */55 #define ARROWS_PER_SINGLE_WHEEL 356 57 54 #define NAME "mouse" 58 55 … … 69 66 70 67 const char *HID_MOUSE_FUN_NAME = "mouse"; 71 const char *HID_MOUSE_WHEEL_FUN_NAME = "mouse-wheel";72 68 const char *HID_MOUSE_CATEGORY = "mouse"; 73 const char *HID_MOUSE_WHEEL_CATEGORY = "keyboard";74 69 75 70 /** Default idle rate for mouses. */ … … 126 121 127 122 usb_log_debug("%s: fun->name: %s\n", __FUNCTION__, fun->name); 128 usb_log_debug("%s: mouse_sess: %p, wheel_sess: %p\n", 129 __FUNCTION__, mouse_dev->mouse_sess, mouse_dev->wheel_sess); 130 131 async_sess_t **sess_ptr = (fun == mouse_dev->mouse_fun) ? 132 &mouse_dev->mouse_sess : &mouse_dev->wheel_sess; 123 usb_log_debug("%s: mouse_sess: %p\n", 124 __FUNCTION__, mouse_dev->mouse_sess); 133 125 134 126 async_sess_t *sess = 135 127 async_callback_receive_start(EXCHANGE_SERIALIZE, icall); 136 128 if (sess != NULL) { 137 if ( *sess_ptr== NULL) {138 *sess_ptr= sess;129 if (mouse_dev->mouse_sess == NULL) { 130 mouse_dev->mouse_sess = sess; 139 131 usb_log_debug("Console session to %s set ok (%p).\n", 140 132 fun->name, sess); … … 144 136 fun->name); 145 137 async_answer_0(icallid, ELIMIT); 138 async_hangup(sess); 146 139 } 147 140 } else { … … 150 143 } 151 144 } 152 153 /*----------------------------------------------------------------------------*/ 154 155 static void usb_mouse_send_wheel(const usb_mouse_t *mouse_dev, int wheel) 156 { 157 unsigned int key = (wheel > 0) ? KC_UP : KC_DOWN; 158 159 if (mouse_dev->wheel_sess == NULL) { 160 usb_log_warning( 161 "Connection to console not ready, wheel roll discarded.\n"); 162 return; 163 } 164 165 const unsigned count = 166 ((wheel < 0) ? -wheel : wheel) * ARROWS_PER_SINGLE_WHEEL; 167 for (unsigned i = 0; i < count; i++) { 168 /* Send arrow press and release. */ 169 usb_log_debug2("Sending key %d to the console\n", key); 170 171 async_exch_t *exch = async_exchange_begin(mouse_dev->wheel_sess); 172 173 async_msg_4(exch, KBDEV_EVENT, KEY_PRESS, key, 0, 0); 174 async_msg_4(exch, KBDEV_EVENT, KEY_RELEASE, key, 0, 0); 175 176 async_exchange_end(exch); 177 } 178 } 179 180 /*----------------------------------------------------------------------------*/ 181 145 /*----------------------------------------------------------------------------*/ 182 146 static int get_mouse_axis_move_value(uint8_t rid, usb_hid_report_t *report, 183 147 int32_t usage) … … 203 167 return result; 204 168 } 205 169 /*----------------------------------------------------------------------------*/ 206 170 static bool usb_mouse_process_report(usb_hid_dev_t *hid_dev, 207 171 usb_mouse_t *mouse_dev) … … 221 185 &hid_dev->report, USB_HIDUT_USAGE_GENERIC_DESKTOP_WHEEL); 222 186 223 if ( (shift_x != 0) || (shift_y != 0)) {187 if (shift_x || shift_y || wheel) { 224 188 async_exch_t *exch = 225 189 async_exchange_begin(mouse_dev->mouse_sess); 226 190 if (exch != NULL) { 227 async_req_2_0(exch, MOUSEEV_MOVE_EVENT, shift_x, shift_y); 191 async_msg_3(exch, MOUSEEV_MOVE_EVENT, 192 shift_x, shift_y, wheel); 228 193 async_exchange_end(exch); 229 194 } 230 195 } 231 232 if (wheel != 0)233 usb_mouse_send_wheel(mouse_dev, wheel);234 196 235 197 /* Buttons */ … … 341 303 mouse->mouse_fun = fun; 342 304 343 /*344 * Special function for acting as keyboard (wheel)345 */346 usb_log_debug("Creating DDF function %s...\n",347 HID_MOUSE_WHEEL_FUN_NAME);348 fun = ddf_fun_create(hid_dev->usb_dev->ddf_dev, fun_exposed,349 HID_MOUSE_WHEEL_FUN_NAME);350 if (fun == NULL) {351 usb_log_error("Could not create DDF function node `%s'.\n",352 HID_MOUSE_WHEEL_FUN_NAME);353 FUN_UNBIND_DESTROY(mouse->mouse_fun);354 mouse->mouse_fun = NULL;355 return ENOMEM;356 }357 358 /*359 * Store the initialized HID device and HID ops360 * to the DDF function.361 */362 fun->ops = &mouse->ops;363 fun->driver_data = mouse;364 365 rc = ddf_fun_bind(fun);366 if (rc != EOK) {367 usb_log_error("Could not bind DDF function `%s': %s.\n",368 fun->name, str_error(rc));369 FUN_UNBIND_DESTROY(mouse->mouse_fun);370 mouse->mouse_fun = NULL;371 372 fun->driver_data = NULL;373 ddf_fun_destroy(fun);374 return rc;375 }376 377 usb_log_debug("Adding DDF function to category %s...\n",378 HID_MOUSE_WHEEL_CATEGORY);379 rc = ddf_fun_add_to_category(fun, HID_MOUSE_WHEEL_CATEGORY);380 if (rc != EOK) {381 usb_log_error(382 "Could not add DDF function to category %s: %s.\n",383 HID_MOUSE_WHEEL_CATEGORY, str_error(rc));384 385 FUN_UNBIND_DESTROY(mouse->mouse_fun);386 mouse->mouse_fun = NULL;387 FUN_UNBIND_DESTROY(fun);388 return rc;389 }390 mouse->wheel_fun = fun;391 392 305 return EOK; 393 306 } 394 395 /*----------------------------------------------------------------------------*/ 396 307 /*----------------------------------------------------------------------------*/ 397 308 /** Get highest index of a button mentioned in given report. 398 309 * … … 516 427 } 517 428 518 if (mouse_dev->wheel_sess != NULL) {519 const int ret = async_hangup(mouse_dev->wheel_sess);520 if (ret != EOK)521 usb_log_warning("Failed to hang up wheel session: "522 "%p, %s.\n", mouse_dev->wheel_sess, str_error(ret));523 }524 525 429 FUN_UNBIND_DESTROY(mouse_dev->mouse_fun); 526 FUN_UNBIND_DESTROY(mouse_dev->wheel_fun);527 430 528 431 free(mouse_dev->buttons); -
uspace/drv/bus/usb/usbhid/mouse/mousedev.h
r0a549cc rf991b6b 48 48 /** IPC session to console (consumer). */ 49 49 async_sess_t *mouse_sess; 50 async_sess_t *wheel_sess;51 50 52 51 /* Mouse buttons statuses. */ … … 57 56 /* DDF mouse function */ 58 57 ddf_fun_t *mouse_fun; 59 /* DDF mouse function */60 ddf_fun_t *wheel_fun;61 58 } usb_mouse_t; 62 59 -
uspace/drv/char/i8042/Makefile
r0a549cc rf991b6b 28 28 # 29 29 30 USPACE_PREFIX = ../../../.. 30 USPACE_PREFIX = ../../.. 31 LIBS = $(LIBDRV_PREFIX)/libdrv.a 32 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include 31 33 BINARY = i8042 32 34 33 35 SOURCES = \ 34 i8042.c 36 i8042.c \ 37 main.c 35 38 36 39 include $(USPACE_PREFIX)/Makefile.common -
uspace/drv/char/ps2mouse/chardev.h
r0a549cc rf991b6b 1 1 /* 2 * Copyright (c) 20 06 Josef Cejka2 * Copyright (c) 2011 Jan Vesely 3 3 * All rights reserved. 4 4 * … … 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 29 /** @addtogroup kbd_port 30 * @ingroup kbd 28 /** @addtogroup drvmouse 31 29 * @{ 32 30 */ 33 34 31 /** @file 35 * @brief i8042 portdriver.32 * @brief ps/2 mouse driver. 36 33 */ 37 34 38 #ifndef i8042_H_39 #define i8042_H_35 #ifndef _CHARDEV_H_ 36 #define _CHARDEV_H_ 40 37 41 #include <sys/types.h> 42 #include <libarch/ddi.h> 38 #include <libarch/types.h> 43 39 #include <async.h> 44 40 45 /** i8042 HW I/O interface */ 46 struct i8042 { 47 ioport8_t data; 48 uint8_t pad[3]; 49 ioport8_t status; 50 } __attribute__ ((packed)); 51 typedef struct i8042 i8042_t; 52 53 /** Softstate structure, one for each serial port (primary and aux). */ 54 typedef struct { 55 service_id_t service_id; 56 async_sess_t *client_sess; 57 } i8042_port_t; 41 ssize_t chardev_read(async_exch_t *, void *, size_t); 42 ssize_t chardev_write(async_exch_t *, const void *, size_t); 58 43 59 44 #endif 60 61 45 /** 62 46 * @} -
uspace/srv/hid/input/Makefile
r0a549cc rf991b6b 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/generic/input.c
r0a549cc rf991b6b 172 172 173 173 /** Mouse pointer has moved. */ 174 void mouse_push_event_move(mouse_dev_t *mdev, int dx, int dy )174 void mouse_push_event_move(mouse_dev_t *mdev, int dx, int dy, int dz) 175 175 { 176 176 async_exch_t *exch = async_exchange_begin(client_sess); 177 async_msg_2(exch, INPUT_EVENT_MOVE, dx, dy); 177 if (dx || dy) 178 async_msg_2(exch, INPUT_EVENT_MOVE, dx, dy); 179 if (dz) { 180 // TODO: Implement proper wheel support 181 keycode_t code = dz > 0 ? KC_UP : KC_DOWN; 182 for (int i = 0; i < 3; ++i) { 183 async_msg_4(exch, INPUT_EVENT_KEY, KEY_PRESS, code, 0, 0); 184 } 185 async_msg_4(exch, INPUT_EVENT_KEY, KEY_RELEASE, code, 0, 0); 186 } 178 187 async_exchange_end(exch); 179 188 } … … 397 406 * them automatically. 398 407 */ 399 #if defined(UARCH_amd64)400 kbd_add_dev(&chardev_port, &pc_ctl);401 #endif402 408 #if defined(UARCH_arm32) && defined(MACHINE_gta02) 403 409 kbd_add_dev(&chardev_port, &stty_ctl); … … 411 417 #if defined(UARCH_arm32) && defined(MACHINE_integratorcp) 412 418 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 419 #endif 420 420 #if defined(MACHINE_ski) … … 450 450 * them automatically. 451 451 */ 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 452 #if defined(UARCH_ppc32) 462 453 mouse_add_dev(&adb_mouse_port, &adb_proto); -
uspace/srv/hid/input/include/mouse.h
r0a549cc rf991b6b 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
r0a549cc rf991b6b 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
r0a549cc rf991b6b 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/proto/adb.c
r0a549cc rf991b6b 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
r0a549cc rf991b6b 91 91 switch (IPC_GET_IMETHOD(call)) { 92 92 case MOUSEEV_MOVE_EVENT: 93 mouse_push_event_move(mousedev->mouse_dev, IPC_GET_ARG1(call), 94 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)); 95 96 retval = EOK; 96 97 break; 97 98 case MOUSEEV_BUTTON_EVENT: 98 mouse_push_event_button(mousedev->mouse_dev, IPC_GET_ARG1(call),99 IPC_GET_ARG 2(call));99 mouse_push_event_button(mousedev->mouse_dev, 100 IPC_GET_ARG1(call), IPC_GET_ARG2(call)); 100 101 retval = EOK; 101 102 break;
Note:
See TracChangeset
for help on using the changeset viewer.