Changes in / [04c1524:22ded10] in mainline
- Location:
- uspace/drv/usbhid
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhid/generic/hiddev.c
r04c1524 r22ded10 39 39 #include <errno.h> 40 40 #include <str_error.h> 41 #include <bool.h>42 41 43 42 #include <usbhid_iface.h> … … 65 64 size_t size, size_t *act_size, unsigned int flags); 66 65 67 static int usb_generic_hid_client_connected(ddf_fun_t *fun);68 69 66 /*----------------------------------------------------------------------------*/ 70 67 … … 75 72 76 73 static ddf_dev_ops_t usb_generic_hid_ops = { 77 .interfaces[USBHID_DEV_IFACE] = &usb_generic_iface, 78 .open = usb_generic_hid_client_connected 74 .interfaces[USBHID_DEV_IFACE] = &usb_generic_iface 79 75 }; 80 76 … … 108 104 109 105 /*! @todo This should probably be atomic. */ 110 if (usb_hid_report_ready()) { 111 memcpy(buffer, hid_dev->input_report, 112 hid_dev->input_report_size); 113 *act_size = hid_dev->input_report_size; 114 usb_hid_report_received(); 115 } 106 memcpy(buffer, hid_dev->input_report, hid_dev->input_report_size); 107 *act_size = hid_dev->input_report_size; 116 108 117 109 // clear the buffer so that it will not be received twice 118 //memset(hid_dev->input_report, 0, hid_dev->input_report_size);110 memset(hid_dev->input_report, 0, hid_dev->input_report_size); 119 111 120 // note that we already received this report121 // report_received = true;122 123 return EOK;124 }125 126 /*----------------------------------------------------------------------------*/127 128 static int usb_generic_hid_client_connected(ddf_fun_t *fun)129 {130 usb_hid_report_received();131 112 return EOK; 132 113 } -
uspace/drv/usbhid/usbhid.c
r04c1524 r22ded10 63 63 static const int USB_HID_MAX_SUBDRIVERS = 10; 64 64 65 static fibril_local bool report_received;66 67 65 /*----------------------------------------------------------------------------*/ 68 66 … … 511 509 free(input_old); 512 510 } 513 usb_hid_new_report();514 511 } 515 512 } … … 592 589 /*----------------------------------------------------------------------------*/ 593 590 594 void usb_hid_new_report(void)595 {596 report_received = false;597 }598 599 /*----------------------------------------------------------------------------*/600 601 void usb_hid_report_received(void)602 {603 report_received = true;604 }605 606 /*----------------------------------------------------------------------------*/607 608 bool usb_hid_report_ready(void)609 {610 return !report_received;611 }612 613 /*----------------------------------------------------------------------------*/614 615 591 void usb_hid_free(usb_hid_dev_t **hid_dev) 616 592 { -
uspace/drv/usbhid/usbhid.h
r04c1524 r22ded10 44 44 #include <usb/devdrv.h> 45 45 #include <usb/classes/hid.h> 46 #include <bool.h>47 46 48 47 struct usb_hid_dev; … … 129 128 //const char *usb_hid_get_class_name(const usb_hid_dev_t *hid_dev); 130 129 131 void usb_hid_new_report(void);132 133 void usb_hid_report_received(void);134 135 bool usb_hid_report_ready(void);136 137 130 void usb_hid_free(usb_hid_dev_t **hid_dev); 138 131
Note:
See TracChangeset
for help on using the changeset viewer.