diff options
| author | tmk <nobody@nowhere> | 2012-06-28 16:51:56 +0900 |
|---|---|---|
| committer | tmk <nobody@nowhere> | 2012-06-28 16:51:56 +0900 |
| commit | a9a3610dd4a168e473d2d6a2eb3fbc37aabb46c9 (patch) | |
| tree | 89f274c6cf58a9b4fcd8d768dda78da10afac3b9 /protocol/vusb | |
| parent | effa5914bff71fa7ad6506271c9ba4baa32a1eca (diff) | |
| download | qmk_firmware-a9a3610dd4a168e473d2d6a2eb3fbc37aabb46c9.tar.gz qmk_firmware-a9a3610dd4a168e473d2d6a2eb3fbc37aabb46c9.zip | |
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 'protocol/vusb')
| -rw-r--r-- | protocol/vusb/main.c | 16 | ||||
| -rw-r--r-- | protocol/vusb/vusb.c | 31 |
2 files changed, 41 insertions, 6 deletions
diff --git a/protocol/vusb/main.c b/protocol/vusb/main.c index 1bf9035b3..1ba40a27a 100644 --- a/protocol/vusb/main.c +++ b/protocol/vusb/main.c | |||
| @@ -62,6 +62,11 @@ int main(void) | |||
| 62 | 62 | ||
| 63 | debug("initForUsbConnectivity()\n"); | 63 | debug("initForUsbConnectivity()\n"); |
| 64 | initForUsbConnectivity(); | 64 | initForUsbConnectivity(); |
| 65 | int i; | ||
| 66 | while(--i){ /* To configured */ | ||
| 67 | usbPoll(); | ||
| 68 | _delay_ms(1); | ||
| 69 | } | ||
| 65 | 70 | ||
| 66 | debug("main loop\n"); | 71 | debug("main loop\n"); |
| 67 | while (1) { | 72 | while (1) { |
| @@ -90,10 +95,15 @@ int main(void) | |||
| 90 | } | 95 | } |
| 91 | } | 96 | } |
| 92 | #endif | 97 | #endif |
| 93 | if (!suspended) | 98 | if (!suspended) { |
| 94 | usbPoll(); | 99 | usbPoll(); |
| 95 | keyboard_proc(); | 100 | |
| 96 | if (!suspended) | 101 | // TODO: configuration process is incosistent. it sometime fails. |
| 102 | // To prevent failing to configure NOT scan keyboard during configuration | ||
| 103 | if (usbConfiguration && usbInterruptIsReady()) { | ||
| 104 | keyboard_proc(); | ||
| 105 | } | ||
| 97 | vusb_transfer_keyboard(); | 106 | vusb_transfer_keyboard(); |
| 107 | } | ||
| 98 | } | 108 | } |
| 99 | } | 109 | } |
diff --git a/protocol/vusb/vusb.c b/protocol/vusb/vusb.c index 0bfe21e92..1dff5dea2 100644 --- a/protocol/vusb/vusb.c +++ b/protocol/vusb/vusb.c | |||
| @@ -91,23 +91,48 @@ static void send_keyboard(report_keyboard_t *report) | |||
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | 93 | ||
| 94 | typedef struct { | ||
| 95 | uint8_t report_id; | ||
| 96 | report_mouse_t report; | ||
| 97 | } __attribute__ ((packed)) vusb_mouse_report_t; | ||
| 98 | |||
| 94 | static void send_mouse(report_mouse_t *report) | 99 | static void send_mouse(report_mouse_t *report) |
| 95 | { | 100 | { |
| 96 | report->report_id = REPORT_ID_MOUSE; | 101 | vusb_mouse_report_t r = { |
| 102 | .report_id = REPORT_ID_MOUSE, | ||
| 103 | .report = *report | ||
| 104 | }; | ||
| 97 | if (usbInterruptIsReady3()) { | 105 | if (usbInterruptIsReady3()) { |
| 98 | usbSetInterrupt3((void *)report, sizeof(*report)); | 106 | usbSetInterrupt3((void *)&r, sizeof(vusb_mouse_report_t)); |
| 99 | } | 107 | } |
| 100 | } | 108 | } |
| 101 | 109 | ||
| 110 | /* | ||
| 111 | typedef struct { | ||
| 112 | uint8_t report_id; | ||
| 113 | uint8_t data0; | ||
| 114 | uint8_t data1; | ||
| 115 | } __attribute__ ((packed)) vusb_system_report_t; | ||
| 116 | */ | ||
| 117 | |||
| 102 | static void send_system(uint16_t data) | 118 | static void send_system(uint16_t data) |
| 103 | { | 119 | { |
| 120 | /* | ||
| 104 | // Not need static? | 121 | // Not need static? |
| 105 | static uint8_t report[] = { REPORT_ID_SYSTEM, 0, 0 }; | 122 | static uint8_t report[] = { REPORT_ID_SYSTEM, 0, 0 }; |
| 106 | report[1] = data&0xFF; | 123 | report[1] = data&0xFF; |
| 107 | report[2] = (data>>8)&0xFF; | 124 | report[2] = (data>>8)&0xFF; |
| 125 | */ | ||
| 126 | /* | ||
| 127 | vusb_system_report_t r = { | ||
| 128 | .report_id = REPORT_ID_SYSTEM, | ||
| 129 | .data0 = data&0xFF, | ||
| 130 | .data1 = (data>>8)&0xFF | ||
| 131 | }; | ||
| 108 | if (usbInterruptIsReady3()) { | 132 | if (usbInterruptIsReady3()) { |
| 109 | usbSetInterrupt3((void *)&report, sizeof(report)); | 133 | usbSetInterrupt3((void *)&r, sizeof(vusb_system_report_t)); |
| 110 | } | 134 | } |
| 135 | */ | ||
| 111 | } | 136 | } |
| 112 | 137 | ||
| 113 | static void send_consumer(uint16_t data) | 138 | static void send_consumer(uint16_t data) |
