Changeset 00aece0 in mainline for uspace/app/vuhid/life.c
- Timestamp:
- 2012-02-18T16:47:38Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/fix-logger-deadlock, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4449c6c
- Parents:
- bd5f3b7 (diff), f943dd3 (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 moved
-
uspace/app/vuhid/life.c (moved) (moved from uspace/drv/bus/usb/usbmouse/mouse.h ) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/vuhid/life.c
rbd5f3b7 r00aece0 27 27 */ 28 28 29 /** @addtogroup drvusbmouse29 /** @addtogroup usbvirthid 30 30 * @{ 31 31 */ 32 32 /** 33 33 * @file 34 * Common definitions for USB mouse driver.34 * 35 35 */ 36 #include <errno.h> 37 #include <usb/debug.h> 38 #include "virthid.h" 36 39 37 #ifndef USBMOUSE_MOUSE_H_38 #define USBMOUSE_MOUSE_H_39 40 40 #include <usb/dev/driver.h> 41 #include <usb/dev/pipes.h> 42 #include <time.h> 43 #include <async.h> 41 void interface_life_live(vuhid_interface_t *iface) 42 { 43 vuhid_interface_life_t *data = iface->interface_data; 44 data->data_in_pos = 0; 45 data->data_in_last_pos = (size_t) -1; 46 async_usleep(1000 * 1000 * 5); 47 usb_log_debug("%s\n", data->msg_born); 48 while (data->data_in_pos < data->data_in_count) { 49 async_usleep(1000 * data->data_in_pos_change_delay); 50 // FIXME: proper locking 51 data->data_in_pos++; 52 } 53 usb_log_debug("%s\n", data->msg_die); 54 } 44 55 45 #define POLL_PIPE(dev) \46 ((dev)->pipes[0].pipe)47 56 48 /** Container for USB mouse device. */49 typedef struct {50 /** Generic device container. */51 usb_device_t *dev;52 53 /** Function representing the device. */54 ddf_fun_t *mouse_fun;55 56 /** Polling interval in microseconds. */57 suseconds_t poll_interval_us;58 59 /** Callback session to console (consumer). */60 async_sess_t *console_sess;61 } usb_mouse_t;62 57 63 extern usb_endpoint_description_t poll_endpoint_description; 58 int interface_live_on_data_in(vuhid_interface_t *iface, 59 void *buffer, size_t buffer_size, size_t *act_buffer_size) 60 { 61 vuhid_interface_life_t *life = iface->interface_data; 62 size_t pos = life->data_in_pos; 63 if (pos >= life->data_in_count) { 64 return EBADCHECKSUM; 65 } 64 66 65 extern int usb_mouse_create(usb_device_t *); 66 extern bool usb_mouse_polling_callback(usb_device_t *, uint8_t *, size_t, 67 void *); 68 extern void usb_mouse_polling_ended_callback(usb_device_t *, bool, void *); 67 if (pos == life->data_in_last_pos) { 68 return ENAK; 69 } 69 70 70 #endif 71 if (buffer_size > iface->in_data_size) { 72 buffer_size = iface->in_data_size; 73 } 71 74 72 /** 73 * @} 75 if (act_buffer_size != NULL) { 76 *act_buffer_size = buffer_size; 77 } 78 79 memcpy(buffer, life->data_in + pos * iface->in_data_size, buffer_size); 80 life->data_in_last_pos = pos; 81 82 return EOK; 83 } 84 85 /** @} 74 86 */
Note:
See TracChangeset
for help on using the changeset viewer.
