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