Moved the USB_GetHIDReportItemInfo() calls into the main report item passing loop in the *HostWithParser demos - it is fast enough not to effect performance, and avoids duplicate code.
Make Webserver project report the LUFA version as part of the HTTP header.
{\r
HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber];\r
\r
{\r
HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber];\r
\r
+ /* Update the report item value if it is contained within the current report */\r
+ if (!(USB_GetHIDReportItemInfo(JoystickReport, ReportItem)))\r
+ continue;\r
+\r
+ /* Determine what report item is being tested, process updated value as needed */\r
if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) &&\r
(ReportItem->ItemType == REPORT_ITEM_TYPE_In))\r
{\r
if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) &&\r
(ReportItem->ItemType == REPORT_ITEM_TYPE_In))\r
{\r
- /* Get the joystick button value if it is contained within the current report, if not,\r
- * skip to the next item in the parser list\r
- */\r
- if (!(USB_GetHIDReportItemInfo(JoystickReport, ReportItem)))\r
- continue;\r
-\r
if (ReportItem->Value)\r
LEDMask = LEDS_ALL_LEDS;\r
}\r
if (ReportItem->Value)\r
LEDMask = LEDS_ALL_LEDS;\r
}\r
(ReportItem->Attributes.Usage.Usage == USAGE_Y)) &&\r
(ReportItem->ItemType == REPORT_ITEM_TYPE_In))\r
{\r
(ReportItem->Attributes.Usage.Usage == USAGE_Y)) &&\r
(ReportItem->ItemType == REPORT_ITEM_TYPE_In))\r
{\r
- /* Get the joystick relative position value if it is contained within the current \r
- * report, if not, skip to the next item in the parser list\r
- */\r
- if (!(USB_GetHIDReportItemInfo(JoystickReport, ReportItem)))\r
- continue; \r
-\r
int16_t DeltaMovement = (int16_t)(ReportItem->Value << (16 - ReportItem->Attributes.BitSize));\r
\r
if (ReportItem->Attributes.Usage.Usage == USAGE_X)\r
int16_t DeltaMovement = (int16_t)(ReportItem->Value << (16 - ReportItem->Attributes.BitSize));\r
\r
if (ReportItem->Attributes.Usage.Usage == USAGE_X)\r
{\r
HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber];\r
\r
{\r
HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber];\r
\r
- /* Check if the current report item is a keyboard scancode */\r
+ /* Update the report item value if it is contained within the current report */\r
+ if (!(USB_GetHIDReportItemInfo(KeyboardReport, ReportItem)))\r
+ continue;\r
+\r
+ /* Determine what report item is being tested, process updated value as needed */\r
if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_KEYBOARD) &&\r
(ReportItem->Attributes.BitSize == 8) &&\r
(ReportItem->Attributes.Logical.Maximum > 1) &&\r
(ReportItem->ItemType == REPORT_ITEM_TYPE_In))\r
{\r
if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_KEYBOARD) &&\r
(ReportItem->Attributes.BitSize == 8) &&\r
(ReportItem->Attributes.Logical.Maximum > 1) &&\r
(ReportItem->ItemType == REPORT_ITEM_TYPE_In))\r
{\r
- /* Retrieve the keyboard scancode from the report data retrieved from the device if it is\r
- * contained within the current report, if not, skip to the next item in the parser list\r
- */\r
- if (!(USB_GetHIDReportItemInfo(KeyboardReport, ReportItem)))\r
- continue;\r
-\r
/* Key code is an unsigned char in length, cast to the appropriate type */\r
uint8_t KeyCode = (uint8_t)ReportItem->Value;\r
\r
/* Key code is an unsigned char in length, cast to the appropriate type */\r
uint8_t KeyCode = (uint8_t)ReportItem->Value;\r
\r
{\r
HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber];\r
\r
{\r
HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber];\r
\r
+ /* Update the report item value if it is contained within the current report */\r
+ if (!(USB_GetHIDReportItemInfo(MouseReport, ReportItem)))\r
+ continue;\r
+ \r
+ /* Determine what report item is being tested, process updated value as needed */\r
if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) &&\r
(ReportItem->ItemType == REPORT_ITEM_TYPE_In))\r
{\r
if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) &&\r
(ReportItem->ItemType == REPORT_ITEM_TYPE_In))\r
{\r
- /* Get the mouse button value if it is contained within the current report, if not,\r
- * skip to the next item in the parser list\r
- */\r
- if (!(USB_GetHIDReportItemInfo(MouseReport, ReportItem)))\r
- continue;\r
-\r
if (ReportItem->Value)\r
LEDMask = LEDS_ALL_LEDS;\r
}\r
if (ReportItem->Value)\r
LEDMask = LEDS_ALL_LEDS;\r
}\r
(ReportItem->Attributes.Usage.Usage == USAGE_SCROLL_WHEEL) &&\r
(ReportItem->ItemType == REPORT_ITEM_TYPE_In))\r
{\r
(ReportItem->Attributes.Usage.Usage == USAGE_SCROLL_WHEEL) &&\r
(ReportItem->ItemType == REPORT_ITEM_TYPE_In))\r
{\r
- /* Get the mouse wheel value if it is contained within the current \r
- * report, if not, skip to the next item in the parser list\r
- */\r
- if (!(USB_GetHIDReportItemInfo(MouseReport, ReportItem)))\r
- continue; \r
-\r
int16_t WheelDelta = (int16_t)(ReportItem->Value << (16 - ReportItem->Attributes.BitSize));\r
\r
if (WheelDelta)\r
int16_t WheelDelta = (int16_t)(ReportItem->Value << (16 - ReportItem->Attributes.BitSize));\r
\r
if (WheelDelta)\r
(ReportItem->Attributes.Usage.Usage == USAGE_Y)) &&\r
(ReportItem->ItemType == REPORT_ITEM_TYPE_In))\r
{\r
(ReportItem->Attributes.Usage.Usage == USAGE_Y)) &&\r
(ReportItem->ItemType == REPORT_ITEM_TYPE_In))\r
{\r
- /* Get the mouse relative position value if it is contained within the current \r
- * report, if not, skip to the next item in the parser list\r
- */\r
- if (!(USB_GetHIDReportItemInfo(MouseReport, ReportItem)))\r
- continue; \r
-\r
int16_t DeltaMovement = (int16_t)(ReportItem->Value << (16 - ReportItem->Attributes.BitSize));\r
\r
if (ReportItem->Attributes.Usage.Usage == USAGE_X)\r
int16_t DeltaMovement = (int16_t)(ReportItem->Value << (16 - ReportItem->Attributes.BitSize));\r
\r
if (ReportItem->Attributes.Usage.Usage == USAGE_X)\r
{\r
for (uint8_t i = 0; i < HID_MAX_REPORT_IDS; i++)\r
{\r
{\r
for (uint8_t i = 0; i < HID_MAX_REPORT_IDS; i++)\r
{\r
+ uint16_t ReportSizeBits = ParserData->ReportIDSizes[i].ReportSizeBits[ReportType];\r
+ \r
if (ParserData->ReportIDSizes[i].ReportID == ReportID)\r
if (ParserData->ReportIDSizes[i].ReportID == ReportID)\r
- return ParserData->ReportIDSizes[i].ReportSizeBits[ReportType];\r
+ return ((ReportSizeBits >> 3) + ((ReportSizeBits & 0x07) ? 1 : 0));\r
typedef struct\r
{\r
uint8_t ReportID; /** Report ID of the report within the HID interface */\r
typedef struct\r
{\r
uint8_t ReportID; /** Report ID of the report within the HID interface */\r
- uint8_t ReportSizeBits[3]; /** Total number of bits in each report type for the given Report ID,\r
+ uint16_t ReportSizeBits[3]; /** Total number of bits in each report type for the given Report ID,\r
* indexed by the \ref HID_ReportItemTypes_t enum\r
*/\r
} HID_ReportSizeInfo_t;\r
* indexed by the \ref HID_ReportItemTypes_t enum\r
*/\r
} HID_ReportSizeInfo_t;\r
* - Fixed incorrect values of USB_CONFIG_ATTR_SELFPOWERED and USB_CONFIG_ATTR_REMOTEWAKEUP tokens (thanks to Claus Christensen)\r
* - Fixed SerialStream driver blocking while waiting for characters to be received instead of returning EOF\r
* - Fixed SerialStream driver not setting stdin to the created serial stream\r
* - Fixed incorrect values of USB_CONFIG_ATTR_SELFPOWERED and USB_CONFIG_ATTR_REMOTEWAKEUP tokens (thanks to Claus Christensen)\r
* - Fixed SerialStream driver blocking while waiting for characters to be received instead of returning EOF\r
* - Fixed SerialStream driver not setting stdin to the created serial stream\r
+ * - Fixed USB_GetHIDReportSize() returning the number of bits in the specified report instead of bytes\r
*\r
* \section Sec_ChangeLog091223 Version 091223\r
*\r
*\r
* \section Sec_ChangeLog091223 Version 091223\r
*\r
* - AVR USB Modem, a 3G Wireless Modem host: http://code.google.com/p/avrusbmodem/\r
* - Bicycle POV: http://www.code.google.com/p/bicycleledpov/\r
* - CAMTRIG, a remote Camera Trigger device: http://code.astraw.com/projects/motmot/camtrig\r
* - AVR USB Modem, a 3G Wireless Modem host: http://code.google.com/p/avrusbmodem/\r
* - Bicycle POV: http://www.code.google.com/p/bicycleledpov/\r
* - CAMTRIG, a remote Camera Trigger device: http://code.astraw.com/projects/motmot/camtrig\r
+ * - CD Driver Emulator Dongle for ISO Files: http://cdemu.blogspot.com/\r
* - ClockTamer, a configurable clock generator: http://code.google.com/p/clock-tamer/\r
* - "Fingerlicking Wingdinger" (WARNING: Bad Language if no Javascript), a MIDI controller: http://noisybox.net/electronics/wingdinger/\r
* - Garmin GPS USB to NMEA standard serial sentence translator: http://github.com/nall/garmin-transmogrifier/tree/master\r
* - ClockTamer, a configurable clock generator: http://code.google.com/p/clock-tamer/\r
* - "Fingerlicking Wingdinger" (WARNING: Bad Language if no Javascript), a MIDI controller: http://noisybox.net/electronics/wingdinger/\r
* - Garmin GPS USB to NMEA standard serial sentence translator: http://github.com/nall/garmin-transmogrifier/tree/master\r
\r
while (WriteLength)\r
{\r
\r
while (WriteLength)\r
{\r
- /* Wait until the NVM controller is no longer busy */\r
- if (!(TINYNVM_WaitWhileNVMControllerBusy()))\r
- return false;\r
-\r
/* Write the low byte of data to the target */\r
XPROGTarget_SendByte(TPI_CMD_SST | TPI_POINTER_INDIRECT_PI);\r
XPROGTarget_SendByte(*(WriteBuffer++));\r
/* Write the low byte of data to the target */\r
XPROGTarget_SendByte(TPI_CMD_SST | TPI_POINTER_INDIRECT_PI);\r
XPROGTarget_SendByte(*(WriteBuffer++));\r
XPROGTarget_SendByte(TPI_CMD_SST | TPI_POINTER_INDIRECT_PI);\r
XPROGTarget_SendByte(*(WriteBuffer++));\r
\r
XPROGTarget_SendByte(TPI_CMD_SST | TPI_POINTER_INDIRECT_PI);\r
XPROGTarget_SendByte(*(WriteBuffer++));\r
\r
+ /* Wait until the NVM controller is no longer busy */\r
+ if (!(TINYNVM_WaitWhileNVMControllerBusy()))\r
+ return false;\r
+\r
/* Need to decrement the write length twice, since we read out a whole word */\r
WriteLength -= 2;\r
}\r
/* Need to decrement the write length twice, since we read out a whole word */\r
WriteLength -= 2;\r
}\r
* given location, and gives extra connection information.\r
*/\r
char PROGMEM HTTP200Header[] = "HTTP/1.1 200 OK\r\n"\r
* given location, and gives extra connection information.\r
*/\r
char PROGMEM HTTP200Header[] = "HTTP/1.1 200 OK\r\n"\r
- "Server: LUFA RNDIS\r\n"\r
+ "Server: LUFA " LUFA_VERSION_STRING "\r\n"\r
"Connection: close\r\n"\r
"MIME-version: 1.0\r\n"\r
"Content-Type: ";\r
"Connection: close\r\n"\r
"MIME-version: 1.0\r\n"\r
"Content-Type: ";\r
* given URL is invalid, and gives extra error information.\r
*/\r
char PROGMEM HTTP404Header[] = "HTTP/1.1 404 Not Found\r\n"\r
* given URL is invalid, and gives extra error information.\r
*/\r
char PROGMEM HTTP404Header[] = "HTTP/1.1 404 Not Found\r\n"\r
- "Server: LUFA RNDIS\r\n"\r
+ "Server: LUFA " LUFA_VERSION_STRING "\r\n"\r
"Connection: close\r\n"\r
"MIME-version: 1.0\r\n"\r
"Content-Type: text/plain\r\n\r\n"\r
"Connection: close\r\n"\r
"MIME-version: 1.0\r\n"\r
"Content-Type: text/plain\r\n\r\n"\r
#include <avr/pgmspace.h>\r
#include <string.h>\r
\r
#include <avr/pgmspace.h>\r
#include <string.h>\r
\r
+ #include <LUFA/Version.h>\r
+\r
#include <uip.h>\r
#include <ff.h>\r
\r
#include <uip.h>\r
#include <ff.h>\r
\r