summaryrefslogtreecommitdiff
path: root/keyboard/lufa/lufa.c
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2012-06-28 16:51:56 +0900
committertmk <nobody@nowhere>2012-06-28 16:51:56 +0900
commita9a3610dd4a168e473d2d6a2eb3fbc37aabb46c9 (patch)
tree89f274c6cf58a9b4fcd8d768dda78da10afac3b9 /keyboard/lufa/lufa.c
parenteffa5914bff71fa7ad6506271c9ba4baa32a1eca (diff)
Add LUFA mouse feature and fix mouse report.
- add LUFA boot mouse feature - remove report_id from mouse report - fix LUFA descriptor
Diffstat (limited to 'keyboard/lufa/lufa.c')
-rw-r--r--keyboard/lufa/lufa.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/keyboard/lufa/lufa.c b/keyboard/lufa/lufa.c
index 569960e2a9..a87d8474a2 100644
--- a/keyboard/lufa/lufa.c
+++ b/keyboard/lufa/lufa.c
@@ -68,7 +68,7 @@ static host_driver_t lufa_driver = {
static void SetupHardware(void);
-static void Generic_HID_Task(void);
+static void Console_HID_Task(void);
int main(void)
{
@@ -93,7 +93,7 @@ int main(void)
while (1) {
keyboard_proc();
- Generic_HID_Task();
+ Console_HID_Task();
USB_USBTask();
}
}
@@ -110,7 +110,7 @@ void SetupHardware(void)
USB_Init();
}
-static void Generic_HID_Task(void)
+static void Console_HID_Task(void)
{
/* Device must be connected and configured for the task to run */
if (USB_DeviceState != DEVICE_STATE_Configured)
@@ -126,13 +126,13 @@ static void Generic_HID_Task(void)
if (Endpoint_IsReadWriteAllowed())
{
/* Create a temporary buffer to hold the read in report from the host */
- uint8_t GenericData[GENERIC_REPORT_SIZE];
+ uint8_t ConsoleData[GENERIC_REPORT_SIZE];
- /* Read Generic Report Data */
- Endpoint_Read_Stream_LE(&GenericData, sizeof(GenericData), NULL);
+ /* Read Console Report Data */
+ Endpoint_Read_Stream_LE(&ConsoleData, sizeof(ConsoleData), NULL);
- /* Process Generic Report Data */
- //ProcessGenericHIDReport(GenericData);
+ /* Process Console Report Data */
+ //ProcessConsoleHIDReport(ConsoleData);
}
/* Finalize the stream transfer to send the last packet */
@@ -175,13 +175,26 @@ void EVENT_USB_Device_ConfigurationChanged(void)
ConfigSuccess &= Endpoint_ConfigureEndpoint(MOUSE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
HID_EPSIZE, ENDPOINT_BANK_SINGLE);
- /* Setup Generic HID Report Endpoints */
+ /* Setup Console HID Report Endpoints */
ConfigSuccess &= Endpoint_ConfigureEndpoint(GENERIC_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
GENERIC_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(GENERIC_OUT_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT,
GENERIC_EPSIZE, ENDPOINT_BANK_SINGLE);
}
+/*
+Appendix G: HID Request Support Requirements
+
+The following table enumerates the requests that need to be supported by various types of HID class devices.
+
+Device type GetReport SetReport GetIdle SetIdle GetProtocol SetProtocol
+------------------------------------------------------------------------------------------
+Boot Mouse Required Optional Optional Optional Required Required
+Non-Boot Mouse Required Optional Optional Optional Optional Optional
+Boot Keyboard Required Optional Required Required Required Required
+Non-Boot Keybrd Required Optional Required Required Optional Optional
+Other Device Required Optional Optional Optional Optional Optional
+*/
/** Event handler for the USB_ControlRequest event.
* This is fired before passing along unhandled control requests to the library for processing internally.
*/
@@ -288,7 +301,12 @@ static void send_mouse(report_mouse_t *report)
if (Endpoint_IsReadWriteAllowed())
{
/* Write Mouse Report Data */
- Endpoint_Write_Stream_LE(report, sizeof(report_mouse_t), NULL);
+ /* Mouse report data structure
+ * LUFA: { buttons, x, y }
+ * tmk: { buttons, x, y, v, h }
+ */
+ //Endpoint_Write_Stream_LE((uint8_t *)report+1, 3, NULL);
+ Endpoint_Write_Stream_LE(report, 3, NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();