diff options
| author | tmk <tmk@users.noreply.github.com> | 2014-11-14 04:56:00 +0900 |
|---|---|---|
| committer | tmk <tmk@users.noreply.github.com> | 2014-11-14 04:56:00 +0900 |
| commit | c49cb010024883d3f51aade31c59810f19b11706 (patch) | |
| tree | 1132be4f086227c68e3f14bed4c27652411262f8 /protocol/vusb/vusb.c | |
| parent | 8cec0bc9d66cb7da4770e6502e97a426908eb532 (diff) | |
| parent | 93915040e7413b164952bcffb2fce4c65ba20147 (diff) | |
| download | qmk_firmware-c49cb010024883d3f51aade31c59810f19b11706.tar.gz qmk_firmware-c49cb010024883d3f51aade31c59810f19b11706.zip | |
Merge pull request #142 from 0mark/master
fixed vusb variant of converter ps2usb
Diffstat (limited to 'protocol/vusb/vusb.c')
| -rw-r--r-- | protocol/vusb/vusb.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/protocol/vusb/vusb.c b/protocol/vusb/vusb.c index 328885a9b..7d0292ed1 100644 --- a/protocol/vusb/vusb.c +++ b/protocol/vusb/vusb.c | |||
| @@ -35,6 +35,13 @@ static report_keyboard_t kbuf[KBUF_SIZE]; | |||
| 35 | static uint8_t kbuf_head = 0; | 35 | static uint8_t kbuf_head = 0; |
| 36 | static uint8_t kbuf_tail = 0; | 36 | static uint8_t kbuf_tail = 0; |
| 37 | 37 | ||
| 38 | typedef struct { | ||
| 39 | uint8_t modifier; | ||
| 40 | uint8_t reserved; | ||
| 41 | uint8_t keycode[6]; | ||
| 42 | } keyboard_report_t; | ||
| 43 | |||
| 44 | static keyboard_report_t keyboard_report; // sent to PC | ||
| 38 | 45 | ||
| 39 | /* transfer keyboard report from buffer */ | 46 | /* transfer keyboard report from buffer */ |
| 40 | void vusb_transfer_keyboard(void) | 47 | void vusb_transfer_keyboard(void) |
| @@ -168,8 +175,8 @@ usbRequest_t *rq = (void *)data; | |||
| 168 | if(rq->bRequest == USBRQ_HID_GET_REPORT){ | 175 | if(rq->bRequest == USBRQ_HID_GET_REPORT){ |
| 169 | debug("GET_REPORT:"); | 176 | debug("GET_REPORT:"); |
| 170 | /* we only have one report type, so don't look at wValue */ | 177 | /* we only have one report type, so don't look at wValue */ |
| 171 | usbMsgPtr = (void *)keyboard_report; | 178 | usbMsgPtr = (void *)&keyboard_report; |
| 172 | return sizeof(*keyboard_report); | 179 | return sizeof(keyboard_report); |
| 173 | }else if(rq->bRequest == USBRQ_HID_GET_IDLE){ | 180 | }else if(rq->bRequest == USBRQ_HID_GET_IDLE){ |
| 174 | debug("GET_IDLE: "); | 181 | debug("GET_IDLE: "); |
| 175 | //debug_hex(vusb_idle_rate); | 182 | //debug_hex(vusb_idle_rate); |
| @@ -232,7 +239,7 @@ uchar usbFunctionWrite(uchar *data, uchar len) | |||
| 232 | * | 239 | * |
| 233 | * from an example in HID spec appendix | 240 | * from an example in HID spec appendix |
| 234 | */ | 241 | */ |
| 235 | PROGMEM uchar keyboard_hid_report[] = { | 242 | const PROGMEM uchar keyboard_hid_report[] = { |
| 236 | 0x05, 0x01, // Usage Page (Generic Desktop), | 243 | 0x05, 0x01, // Usage Page (Generic Desktop), |
| 237 | 0x09, 0x06, // Usage (Keyboard), | 244 | 0x09, 0x06, // Usage (Keyboard), |
| 238 | 0xA1, 0x01, // Collection (Application), | 245 | 0xA1, 0x01, // Collection (Application), |
| @@ -275,7 +282,7 @@ PROGMEM uchar keyboard_hid_report[] = { | |||
| 275 | * http://www.keil.com/forum/15671/ | 282 | * http://www.keil.com/forum/15671/ |
| 276 | * http://www.microsoft.com/whdc/device/input/wheel.mspx | 283 | * http://www.microsoft.com/whdc/device/input/wheel.mspx |
| 277 | */ | 284 | */ |
| 278 | PROGMEM uchar mouse_hid_report[] = { | 285 | const PROGMEM uchar mouse_hid_report[] = { |
| 279 | /* mouse */ | 286 | /* mouse */ |
| 280 | 0x05, 0x01, // USAGE_PAGE (Generic Desktop) | 287 | 0x05, 0x01, // USAGE_PAGE (Generic Desktop) |
| 281 | 0x09, 0x02, // USAGE (Mouse) | 288 | 0x09, 0x02, // USAGE (Mouse) |
| @@ -358,7 +365,7 @@ PROGMEM uchar mouse_hid_report[] = { | |||
| 358 | * contains: device, interface, HID and endpoint descriptors | 365 | * contains: device, interface, HID and endpoint descriptors |
| 359 | */ | 366 | */ |
| 360 | #if USB_CFG_DESCR_PROPS_CONFIGURATION | 367 | #if USB_CFG_DESCR_PROPS_CONFIGURATION |
| 361 | PROGMEM char usbDescriptorConfiguration[] = { /* USB configuration descriptor */ | 368 | const PROGMEM char usbDescriptorConfiguration[] = { /* USB configuration descriptor */ |
| 362 | 9, /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */ | 369 | 9, /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */ |
| 363 | USBDESCR_CONFIG, /* descriptor type */ | 370 | USBDESCR_CONFIG, /* descriptor type */ |
| 364 | 9 + (9 + 9 + 7) + (9 + 9 + 7), 0, | 371 | 9 + (9 + 9 + 7) + (9 + 9 + 7), 0, |
