Changeset af7b85b in mainline for uspace/drv/hid/ps2mouse/ps2mouse.c
- Timestamp:
- 2019-01-06T09:34:14Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 063a3647
- Parents:
- f2d88f3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/hid/ps2mouse/ps2mouse.c
rf2d88f3 raf7b85b 49 49 #define PS2_MOUSE_SET_SAMPLE_RATE 0xf3 50 50 #define PS2_MOUSE_ENABLE_DATA_REPORT 0xf4 51 #define PS2_MOUSE_DISABLE_DATA_REPORT 0xf5 51 52 #define PS2_MOUSE_ACK 0xfa 52 53 … … 165 166 } 166 167 168 /* Disable mouse data reporting. */ 169 uint8_t report = PS2_MOUSE_ENABLE_DATA_REPORT; 170 size_t nwr; 171 rc = chardev_write(mouse->chardev, &report, 1, &nwr); 172 if (rc != EOK) { 173 ddf_msg(LVL_ERROR, "Failed to enable data reporting."); 174 rc = EIO; 175 goto error; 176 } 177 178 /* Drain input buffer */ 179 size_t nread; 180 uint8_t b; 181 do { 182 rc = chardev_read(mouse->chardev, &b, 1, &nread, chardev_f_nonblock); 183 if (rc != EOK) { 184 ddf_msg(LVL_ERROR, "Failed to drain input buffer.\n"); 185 rc = EIO; 186 goto error; 187 } 188 } while (nread > 0); 189 167 190 /* Probe IntelliMouse extensions. */ 168 191 errno_t (*polling_f)(void *) = polling_ps2; … … 175 198 176 199 /* Enable mouse data reporting. */ 177 uint8_t report = PS2_MOUSE_ENABLE_DATA_REPORT; 178 size_t nwr; 200 report = PS2_MOUSE_ENABLE_DATA_REPORT; 179 201 rc = chardev_write(mouse->chardev, &report, 1, &nwr); 180 202 if (rc != EOK) { … … 184 206 } 185 207 186 size_t nread;187 208 rc = chardev_read(mouse->chardev, &report, 1, &nread, chardev_f_none); 188 209 if (rc != EOK || report != PS2_MOUSE_ACK) {
Note:
See TracChangeset
for help on using the changeset viewer.