Changeset 8e9becf6 in mainline for uspace/drv/usbmouse/mouse.c
- Timestamp:
- 2011-03-08T20:00:47Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 021351c
- Parents:
- 0588062e (diff), d2fc1c2 (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. - File:
-
- 1 edited
-
uspace/drv/usbmouse/mouse.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbmouse/mouse.c
r0588062e r8e9becf6 37 37 #include <usb/debug.h> 38 38 #include <errno.h> 39 #include <str_error.h> 39 40 #include <ipc/mouse.h> 40 41 42 /** Fibril function for polling the mouse device. 43 * 44 * This function shall not terminate unless the device breaks and fails 45 * to send data (e.g. stalls on data request). 46 * 47 * @param arg ddf_dev_t type representing the mouse device. 48 * @return EOK Always. 49 */ 41 50 int usb_mouse_polling_fibril(void *arg) 42 51 { … … 64 73 65 74 size_t actual_size; 75 int rc; 66 76 67 /* FIXME: check for errors. */ 68 usb_endpoint_pipe_start_session(&mouse->poll_pipe); 77 /* 78 * Error checking note: 79 * - failure when starting a session is considered 80 * temporary (e.g. out of phones, next try might succeed) 81 * - failure of transfer considered fatal (probably the 82 * device was unplugged) 83 * - session closing not checked (shall not fail anyway) 84 */ 69 85 70 usb_endpoint_pipe_read(&mouse->poll_pipe, 86 rc = usb_endpoint_pipe_start_session(&mouse->poll_pipe); 87 if (rc != EOK) { 88 usb_log_warning("Failed to start session, will try again: %s.\n", 89 str_error(rc)); 90 continue; 91 } 92 93 rc = usb_endpoint_pipe_read(&mouse->poll_pipe, 71 94 buffer, buffer_size, &actual_size); 72 95 73 96 usb_endpoint_pipe_end_session(&mouse->poll_pipe); 97 98 if (rc != EOK) { 99 usb_log_error("Failed reading mouse input: %s.\n", 100 str_error(rc)); 101 break; 102 } 103 104 usb_log_debug2("got buffer: %s.\n", 105 usb_debug_str_buffer(buffer, buffer_size, 0)); 74 106 75 107 uint8_t butt = buffer[0]; … … 115 147 } 116 148 149 /* 150 * Device was probably unplugged. 151 * Hang-up the phone to the console. 152 * FIXME: release allocated memory. 153 */ 154 async_hangup(mouse->console_phone); 155 mouse->console_phone = -1; 156 157 usb_log_error("Mouse polling fibril terminated.\n"); 158 117 159 return EOK; 118 160 }
Note:
See TracChangeset
for help on using the changeset viewer.
