projects
/
pub
/
USBasp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
576f40f
)
Add new error condition to the HID Report Parser for when a report is parsed but...
author
Dean Camera
<dean@fourwalledcubicle.com>
Tue, 22 Sep 2009 08:07:48 +0000
(08:07 +0000)
committer
Dean Camera
<dean@fourwalledcubicle.com>
Tue, 22 Sep 2009 08:07:48 +0000
(08:07 +0000)
Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.h
patch
|
blob
|
blame
|
history
Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.h
patch
|
blob
|
blame
|
history
Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c
patch
|
blob
|
blame
|
history
Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c
patch
|
blob
|
blame
|
history
Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c
patch
|
blob
|
blame
|
history
Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
patch
|
blob
|
blame
|
history
LUFA/Drivers/USB/Class/Host/HIDParser.c
patch
|
blob
|
blame
|
history
LUFA/Drivers/USB/Class/Host/HIDParser.h
patch
|
blob
|
blame
|
history
diff --git
a/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.h
b/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.h
index
89e21bb
..
3f477ed
100644
(file)
--- a/
Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.h
+++ b/
Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.h
@@
-56,11
+56,13
@@
#define VIRTUAL_MEMORY_BYTES ((uint32_t)DATAFLASH_PAGES * DATAFLASH_PAGE_SIZE * DATAFLASH_TOTALCHIPS)
\r
\r
/** Block size of the device. This is kept at 512 to remain compatible with the OS despite the underlying
\r
#define VIRTUAL_MEMORY_BYTES ((uint32_t)DATAFLASH_PAGES * DATAFLASH_PAGE_SIZE * DATAFLASH_TOTALCHIPS)
\r
\r
/** Block size of the device. This is kept at 512 to remain compatible with the OS despite the underlying
\r
- * storage media (Dataflash) using a different native block size.
\r
+ * storage media (Dataflash) using a different native block size.
Do not change this value.
\r
*/
\r
#define VIRTUAL_MEMORY_BLOCK_SIZE 512
\r
\r
*/
\r
#define VIRTUAL_MEMORY_BLOCK_SIZE 512
\r
\r
- /** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. */
\r
+ /** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. Do not
\r
+ * change this value; change VIRTUAL_MEMORY_BYTES instead to alter the media size.
\r
+ */
\r
#define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)
\r
\r
/* Function Prototypes: */
\r
#define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)
\r
\r
/* Function Prototypes: */
\r
diff --git
a/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.h
b/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.h
index
b7b5a1e
..
cfba56d
100644
(file)
--- a/
Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.h
+++ b/
Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.h
@@
-56,11
+56,13
@@
#define VIRTUAL_MEMORY_BYTES ((uint32_t)DATAFLASH_PAGES * DATAFLASH_PAGE_SIZE * DATAFLASH_TOTALCHIPS)
\r
\r
/** Block size of the device. This is kept at 512 to remain compatible with the OS despite the underlying
\r
#define VIRTUAL_MEMORY_BYTES ((uint32_t)DATAFLASH_PAGES * DATAFLASH_PAGE_SIZE * DATAFLASH_TOTALCHIPS)
\r
\r
/** Block size of the device. This is kept at 512 to remain compatible with the OS despite the underlying
\r
- * storage media (Dataflash) using a different native block size.
\r
+ * storage media (Dataflash) using a different native block size.
Do not change this value.
\r
*/
\r
#define VIRTUAL_MEMORY_BLOCK_SIZE 512
\r
\r
*/
\r
#define VIRTUAL_MEMORY_BLOCK_SIZE 512
\r
\r
- /** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. */
\r
+ /** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. Do not
\r
+ * change this value; change VIRTUAL_MEMORY_BYTES instead to alter the media size.
\r
+ */
\r
#define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)
\r
\r
/* Function Prototypes: */
\r
#define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)
\r
\r
/* Function Prototypes: */
\r
diff --git
a/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c
b/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c
index
d898074
..
e9af0c0
100644
(file)
--- a/
Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c
+++ b/
Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c
@@
-106,7
+106,7
@@
int main(void)
\r
if (USB_HID_Host_SetReportProtocol(&Keyboard_HID_Interface) != 0)
\r
{
\r
\r
if (USB_HID_Host_SetReportProtocol(&Keyboard_HID_Interface) != 0)
\r
{
\r
- printf("
Could not Set Report Protocol Mode
.\r\n");
\r
+ printf("
Error Setting Report Protocol Mode or Not a Valid Keyboard
.\r\n");
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
\r
break;
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
\r
break;
\r
@@
-114,7
+114,7
@@
int main(void)
\r
LEDs_SetAllLEDs(LEDS_NO_LEDS);
\r
\r
\r
LEDs_SetAllLEDs(LEDS_NO_LEDS);
\r
\r
- printf("
HID Device
Enumerated.\r\n");
\r
+ printf("
Keyboard
Enumerated.\r\n");
\r
USB_HostState = HOST_STATE_Configured;
\r
break;
\r
case HOST_STATE_Configured:
\r
USB_HostState = HOST_STATE_Configured;
\r
break;
\r
case HOST_STATE_Configured:
\r
diff --git
a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c
b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c
index
c33b2eb
..
f222eee
100644
(file)
--- a/
Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c
+++ b/
Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c
@@
-106,7
+106,7
@@
int main(void)
\r
if (USB_HID_Host_SetReportProtocol(&Mouse_HID_Interface) != 0)
\r
{
\r
\r
if (USB_HID_Host_SetReportProtocol(&Mouse_HID_Interface) != 0)
\r
{
\r
- printf("
Could not Set Report Protocol Mod
e.\r\n");
\r
+ printf("
Error Setting Report Protocol Mode or Not a Valid Mous
e.\r\n");
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
\r
break;
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
\r
break;
\r
@@
-114,7
+114,7
@@
int main(void)
\r
LEDs_SetAllLEDs(LEDS_NO_LEDS);
\r
\r
\r
LEDs_SetAllLEDs(LEDS_NO_LEDS);
\r
\r
- printf("
HID Devic
e Enumerated.\r\n");
\r
+ printf("
Mous
e Enumerated.\r\n");
\r
USB_HostState = HOST_STATE_Configured;
\r
break;
\r
case HOST_STATE_Configured:
\r
USB_HostState = HOST_STATE_Configured;
\r
break;
\r
case HOST_STATE_Configured:
\r
diff --git
a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c
b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c
index
3b97ad7
..
0cba5fc
100644
(file)
--- a/
Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c
+++ b/
Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c
@@
-172,7
+172,11
@@
void Keyboard_HID_Task(void)
if ((ErrorCode = GetHIDReportData()) != ParseSuccessful)
\r
{
\r
puts_P(PSTR(ESC_FG_RED "Report Parse Error.\r\n"));
\r
if ((ErrorCode = GetHIDReportData()) != ParseSuccessful)
\r
{
\r
puts_P(PSTR(ESC_FG_RED "Report Parse Error.\r\n"));
\r
- printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
\r
+
\r
+ if (!(HIDReportInfo->TotalReportItems))
\r
+ puts_P(PSTR("Not a valid Keyboard." ESC_FG_WHITE));
\r
+ else
\r
+ printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
\r
\r
/* Indicate error via status LEDs */
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
\r
/* Indicate error via status LEDs */
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
@@
-200,7
+204,7
@@
void Keyboard_HID_Task(void)
((ReportSizeFeatureBits >> 3) + ((ReportSizeFeatureBits & 0x07) != 0)));
\r
}
\r
\r
((ReportSizeFeatureBits >> 3) + ((ReportSizeFeatureBits & 0x07) != 0)));
\r
}
\r
\r
- puts_P(PSTR("
HID Device
Enumerated.\r\n"));
\r
+ puts_P(PSTR("
Keyboard
Enumerated.\r\n"));
\r
\r
USB_HostState = HOST_STATE_Configured;
\r
break;
\r
\r
USB_HostState = HOST_STATE_Configured;
\r
break;
\r
diff --git
a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
index
4d50ff6
..
b47858e
100644
(file)
--- a/
Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
+++ b/
Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
@@
-171,8
+171,12
@@
void Mouse_HID_Task(void)
/* Get and process the device's first HID report descriptor */
\r
if ((ErrorCode = GetHIDReportData()) != ParseSuccessful)
\r
{
\r
/* Get and process the device's first HID report descriptor */
\r
if ((ErrorCode = GetHIDReportData()) != ParseSuccessful)
\r
{
\r
- printf_P(PSTR(ESC_FG_RED "Report Parse Error.\r\n"
\r
- " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
\r
+ puts_P(PSTR(ESC_FG_RED "Report Parse Error.\r\n"));
\r
+
\r
+ if (!(HIDReportInfo->TotalReportItems))
\r
+ puts_P(PSTR("Not a valid Mouse." ESC_FG_WHITE));
\r
+ else
\r
+ printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
\r
\r
/* Indicate error via status LEDs */
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
\r
/* Indicate error via status LEDs */
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
@@
-200,7
+204,7
@@
void Mouse_HID_Task(void)
((ReportSizeFeatureBits >> 3) + ((ReportSizeFeatureBits & 0x07) != 0)));
\r
}
\r
\r
((ReportSizeFeatureBits >> 3) + ((ReportSizeFeatureBits & 0x07) != 0)));
\r
}
\r
\r
- puts_P(PSTR("
HID Devic
e Enumerated.\r\n"));
\r
+ puts_P(PSTR("
Mous
e Enumerated.\r\n"));
\r
\r
USB_HostState = HOST_STATE_Configured;
\r
break;
\r
\r
USB_HostState = HOST_STATE_Configured;
\r
break;
\r
diff --git
a/LUFA/Drivers/USB/Class/Host/HIDParser.c
b/LUFA/Drivers/USB/Class/Host/HIDParser.c
index
450f6af
..
4d433e5
100644
(file)
--- a/
LUFA/Drivers/USB/Class/Host/HIDParser.c
+++ b/
LUFA/Drivers/USB/Class/Host/HIDParser.c
@@
-296,6
+296,9
@@
uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, uint16_t ReportSize, HID
}
\r
}
\r
\r
}
\r
}
\r
\r
+ if (!(ParserData->TotalReportItems))
\r
+ return HID_PARSE_NoUnfilteredReportItems;
\r
+
\r
return HID_PARSE_Successful;
\r
}
\r
\r
return HID_PARSE_Successful;
\r
}
\r
\r
diff --git
a/LUFA/Drivers/USB/Class/Host/HIDParser.h
b/LUFA/Drivers/USB/Class/Host/HIDParser.h
index
2ee3f70
..
4322c51
100644
(file)
--- a/
LUFA/Drivers/USB/Class/Host/HIDParser.h
+++ b/
LUFA/Drivers/USB/Class/Host/HIDParser.h
@@
-144,6
+144,7
@@
HID_PARSE_InsufficientCollectionPaths = 5, /**< More than \ref HID_MAX_COLLECTIONS collections in the report. */
\r
HID_PARSE_UsageStackOverflow = 6, /**< More than \ref HID_USAGE_STACK_DEPTH usages listed in a row. */
\r
HID_PARSE_InsufficientReportIDItems = 7, /**< More than \ref HID_MAX_REPORT_IDS report IDs in the device. */
\r
HID_PARSE_InsufficientCollectionPaths = 5, /**< More than \ref HID_MAX_COLLECTIONS collections in the report. */
\r
HID_PARSE_UsageStackOverflow = 6, /**< More than \ref HID_USAGE_STACK_DEPTH usages listed in a row. */
\r
HID_PARSE_InsufficientReportIDItems = 7, /**< More than \ref HID_MAX_REPORT_IDS report IDs in the device. */
\r
+ HID_PARSE_NoUnfilteredReportItems = 8, /**< All report items from the device were filtered by the filtering callback routine. */
\r
};
\r
\r
/* Type Defines: */
\r
};
\r
\r
/* Type Defines: */
\r