1111#include "util/types.h"
1212
1313/* Device descriptor */
14- const u8 PROGMEM desc_device [] = {
14+ const u8 __attribute__(( __progmem__ )) desc_device [] = {
1515 /* clang-format off */
1616 0x12 , /* LENGTH (18) */
1717 0x01 , /* DESCRIPTOR TYPE (Device) */
@@ -30,7 +30,7 @@ const u8 PROGMEM desc_device[] = {
3030 /* clang-format on */
3131};
3232
33- const u8 PROGMEM oi_rdesc [] = {
33+ const u8 __attribute__(( __progmem__ )) oi_rdesc [] = {
3434 /* clang-format off */
3535 /* short report */
3636 0x06 , 0x00 , 0xff , /* USAGE_PAGE (Vendor Page) */
@@ -64,7 +64,7 @@ const u8 PROGMEM oi_rdesc[] = {
6464};
6565
6666/* HID Mouse report descriptor */
67- const u8 PROGMEM desc_hid_mouse_report [] = {
67+ const u8 __attribute__(( __progmem__ )) desc_hid_mouse_report [] = {
6868 /* clang-format off */
6969 0x05 , 0x01 , /* USAGE_PAGE (Generic Desktop) */
7070 0x09 , 0x02 , /* USAGE (Mouse) */
@@ -98,7 +98,7 @@ const u8 PROGMEM desc_hid_mouse_report[] = {
9898};
9999
100100/* HID keyboard report descriptor */
101- const u8 PROGMEM desc_hid_keyboard_report [] = {
101+ const u8 __attribute__(( __progmem__ )) desc_hid_keyboard_report [] = {
102102 /* clang-format off */
103103 0x05 , 0x01 , /* USAGE_PAGE (Generic Desktop) */
104104 0x09 , 0x06 , /* USAGE (keyboard) */
@@ -142,7 +142,7 @@ const u8 PROGMEM desc_hid_keyboard_report[] = {
142142 /* clang-format on */
143143};
144144
145- const u8 PROGMEM oi_hid_desc [] = {
145+ const u8 __attribute__(( __progmem__ )) oi_hid_desc [] = {
146146 /* HID */
147147 0x09 , /* LENGTH */
148148 0x21 , /* DESCRIPTOR TYPE (hid) */
@@ -155,7 +155,7 @@ const u8 PROGMEM oi_hid_desc[] = {
155155 0x00 , /* DESCRIPTOR LENGTH () */
156156};
157157
158- const u8 PROGMEM mouse_hid_desc [] = {
158+ const u8 __attribute__(( __progmem__ )) mouse_hid_desc [] = {
159159 /* HID */
160160 0x09 , /* LENGTH */
161161 0x21 , /* DESCRIPTOR TYPE (hid) */
@@ -168,7 +168,7 @@ const u8 PROGMEM mouse_hid_desc[] = {
168168 0x00 , /* DESCRIPTOR LENGTH () */
169169};
170170
171- const u8 PROGMEM keyboard_hid_desc [] = {
171+ const u8 __attribute__(( __progmem__ )) keyboard_hid_desc [] = {
172172 /* HID */
173173 0x09 , /* LENGTH */
174174 0x21 , /* DESCRIPTOR TYPE (hid) */
@@ -182,7 +182,7 @@ const u8 PROGMEM keyboard_hid_desc[] = {
182182};
183183
184184/* Configuration Descriptor */
185- const u8 PROGMEM desc_configuration [] = {
185+ const u8 __attribute__(( __progmem__ )) desc_configuration [] = {
186186 /* clang-format off */
187187 /* configuration */
188188 0x09 , /* LENGTH */
@@ -223,12 +223,11 @@ const u8 PROGMEM desc_configuration[] = {
223223 /* Endpoint out */
224224 0x07 , /* LENGTH */
225225 0x05 , /* DESCRIPTOR TYPE (Endpoint) */
226- 0x01 , /* ENDPOINT ADDRESS (Endpoint 1 , OUT) */
226+ 0x02 , /* ENDPOINT ADDRESS (Endpoint 2 , OUT) */
227227 0x03 , /* ATTRIBUTES (Interrupt) */
228228 0x40 , 0x00 , /* MAX PACKET SIZE (64) */
229229 0x0A , /* POLLING INTERVAL (100Hz) */
230230
231-
232231 /* Interface 1 - HID Mouse */
233232 0x09 , /* LENGTH */
234233 0x04 , /* DESCRIPTOR TYPE (Interface) */
@@ -251,7 +250,7 @@ const u8 PROGMEM desc_configuration[] = {
251250 /* Endpoint in */
252251 0x07 , /* LENGTH */
253252 0x05 , /* DESCRIPTOR TYPE (Endpoint) */
254- 0x82 , /* ENDPOINT ADDRESS (Endpoint 2 , IN) */
253+ 0x83 , /* ENDPOINT ADDRESS (Endpoint 3 , IN) */
255254 0x03 , /* ATTRIBUTES (Interrupt) */
256255 0x40 , 0x00 , /* MAX PACKET SIZE (64) */
257256 0x01 , /* POLLING INTERVAL (1000Hz) */
@@ -279,24 +278,24 @@ const u8 PROGMEM desc_configuration[] = {
279278 /* Endpoint in */
280279 0x07 , /* LENGTH */
281280 0x05 , /* DESCRIPTOR TYPE (Endpoint) */
282- 0x83 , /* ENDPOINT ADDRESS (Endpoint 3 , IN) */
281+ 0x84 , /* ENDPOINT ADDRESS (Endpoint 4 , IN) */
283282 0x03 , /* ATTRIBUTES (Interrupt) */
284283 0x40 , 0x00 , /* MAX PACKET SIZE (64) */
285284 0x0A , /* POLLING INTERVAL (100Hz) */
286285 /* Endpoint out */
287286 0x07 , /* LENGTH */
288287 0x05 , /* DESCRIPTOR TYPE (Endpoint) */
289- 0x03 , /* ENDPOINT ADDRESS (Endpoint 3 , OUT) */
288+ 0x05 , /* ENDPOINT ADDRESS (Endpoint 5 , OUT) */
290289 0x03 , /* ATTRIBUTES (Interrupt) */
291290 0x40 , 0x00 , /* MAX PACKET SIZE (64) */
292291 0x0A , /* POLLING INTERVAL (100Hz) */
293292 /* clang-format on */
294293};
295294
296295/* String Descriptors */
297- const USB_Descriptor_String_t PROGMEM lang_str = USB_STRING_DESCRIPTOR_ARRAY (LANGUAGE_ID_ENG );
298- const USB_Descriptor_String_t PROGMEM manu_str = USB_STRING_DESCRIPTOR (L"Openinput" );
299- const USB_Descriptor_String_t PROGMEM prod_str = USB_STRING_DESCRIPTOR (L"Openinput Device" );
296+ const USB_Descriptor_String_t __attribute__(( __progmem__ )) PROGMEM lang_str = USB_STRING_DESCRIPTOR_ARRAY (LANGUAGE_ID_ENG );
297+ const USB_Descriptor_String_t __attribute__(( __progmem__ )) PROGMEM manu_str = USB_STRING_DESCRIPTOR (L"Openinput" );
298+ const USB_Descriptor_String_t __attribute__(( __progmem__ )) PROGMEM prod_str = USB_STRING_DESCRIPTOR (L"Openinput Device" );
300299
301300/**
302301 * This function is called by the library when in device mode, and must be overridden (see LUFA library "USB Descriptors"
@@ -380,20 +379,3 @@ u16 CALLBACK_USB_GetDescriptor(const u16 w_value, const u16 w_index, const void
380379 * descriptor_address = addr ;
381380 return size ;
382381}
383-
384- /** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration
385- * of the USB device after enumeration, and configures the keyboard and mouse device endpoints.
386- */
387- void EVENT_USB_Device_ConfigurationChanged (void )
388- {
389- /* Setup Openinput Report Endpoints */
390- Endpoint_ConfigureEndpoint (0x81 , EP_TYPE_INTERRUPT , 0x40 , 1 ); // IN
391- Endpoint_ConfigureEndpoint (0x01 , EP_TYPE_INTERRUPT , 0x40 , 1 ); // OUT
392-
393- /* Setup Mouse HID Report Endpoint */
394- Endpoint_ConfigureEndpoint (0x82 , EP_TYPE_INTERRUPT , 0x40 , 1 ); // IN
395-
396- /* Setup Keyboard HID Report Endpoints */
397- Endpoint_ConfigureEndpoint (0x83 , EP_TYPE_INTERRUPT , 0x40 , 1 ); // IN
398- Endpoint_ConfigureEndpoint (0x03 , EP_TYPE_INTERRUPT , 0x40 , 1 ); // OUT
399- }
0 commit comments