cassblog.blogg.se

H usb optical mouse driver
H usb optical mouse driver








h usb optical mouse driver

(reportItem->agePage=USAGE_PAGE_BUTTONS)) * Now make sure usage Min & Max are as per application */Īppl_XY_Axis_Details.reportLength = (pitemListPtrs->reportList.inputBits + 7)/8 Īppl_XY_Axis_Details.reportID = (BYTE)reportItem->globals.reportID Īppl_XY_Axis_Details.bitOffset = (BYTE)reportItem->startBit Īppl_XY_Axis_Details.bitLength = (BYTE)reportItem->globals.reportsize Īppl_XY_Axis_unt=(BYTE)reportItem->globals.reportCount Īppl_XY_Axis_Details.interfaceNum= USBHostHID_ApiGetCurrentInterfaceNum() Įlse if((reportItem->reportType=hidReportInput) & (reportItem->dataModes = HIDData_Variable)& * We now know report item points to XY axes */ (hidUsageItem->usagePage=USAGE_PAGE_GEN_DESKTOP)&(hidUsageItem->usage=USAGE_X)) If((reportItem->reportType=hidReportInput) & HidUsageItem = &pitemListPtrs->usageItemList ReportIndex = reportItem->globals.reportIndex NumOfReportItem = pDeviceRptinfo->reportItems * Once report Item is located, extract information from data structures provided by the parser */ * Find Report Item Index for each field */ If ( lusageItem->usage != USAGE_MOUSE ) return FALSE If ( lusageItem->usagePage != USAGE_PAGE_GENERIC_DESKTOP ) return FALSE

h usb optical mouse driver

HID_USAGEITEM * lusageItem = &pitemListPtrs->usageItemList HID_COLLECTION * lcollection = &pitemListPtrs->collectionList // Top-Level Collection

h usb optical mouse driver

PitemListPtrs = USBHostHID_GetItemListPointers() // Get pointer to list of item pointers PDeviceRptinfo = USBHostHID_GetCurrentReportInfo() // Get current Report Info pointer #define USAGE_PAGE_GENERIC_DESKTOP (0x01) As code tag block can't hold large code lines, this function is split into a couple of code blocks on this post. And then, the field structures, Appl_XY_Axis_Details, etc, are filled. In this routine, mouse TLC (Top-Level Collection) is chosen. When the host stack reads out report descriptor, USB_HID_DataCollectionHandler() callback is called by the stack for each HID interface. HID_USER_DATA_SIZE Appl_Pan_report_buffer // Pan HID_USER_DATA_SIZE Appl_Wheel_report_buffer // Wheel HID_USER_DATA_SIZE Appl_XY_report_buffer // XY axes HID_USER_DATA_SIZE Appl_Button_report_buffer // <- 5 // five button HID_DATA_DETAILS Appl_Wheel_Details // <- add these lines Increase the buffer size to fit them to your mouse.īYTE ReportData // <- 7 // 7 bytes input report #define HID_MAX_DATA_FIELD_SIZE 8 // <- 12 On the input report, XY axes are returned in 12 bits

h usb optical mouse driver

To cope with HID + HID composite device, USB_MAX_HID_DEVICES is set to 2, for each HID interface. We have once discussed on a host for a HID keyboard + mouse composite device in this topic.










H usb optical mouse driver