aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Mark <mark@unserver.de>2014-11-13 12:07:56 +0100
committerStefan Mark <mark@unserver.de>2014-11-13 12:07:56 +0100
commit93915040e7413b164952bcffb2fce4c65ba20147 (patch)
tree1132be4f086227c68e3f14bed4c27652411262f8
parent8cec0bc9d66cb7da4770e6502e97a426908eb532 (diff)
downloadqmk_firmware-93915040e7413b164952bcffb2fce4c65ba20147.tar.gz
qmk_firmware-93915040e7413b164952bcffb2fce4c65ba20147.zip
fixed vusb variant of converter ps2usb
-rw-r--r--converter/ps2_usb/Makefile.vusb10
-rw-r--r--protocol/vusb/usbdrv/usbdrv.c8
-rw-r--r--protocol/vusb/usbdrv/usbdrv.h14
-rw-r--r--protocol/vusb/vusb.c17
4 files changed, 31 insertions, 18 deletions
diff --git a/converter/ps2_usb/Makefile.vusb b/converter/ps2_usb/Makefile.vusb
index 1bb44f887..ddf186845 100644
--- a/converter/ps2_usb/Makefile.vusb
+++ b/converter/ps2_usb/Makefile.vusb
@@ -8,10 +8,16 @@ TOP_DIR = ../..
8TARGET_DIR = . 8TARGET_DIR = .
9 9
10# keyboard dependent files 10# keyboard dependent files
11SRC = keymap.c \ 11SRC = keymap_common.c \
12 matrix.c \ 12 matrix.c \
13 led.c 13 led.c
14 14
15ifdef KEYMAP
16 SRC := keymap_$(KEYMAP).c $(SRC)
17else
18 SRC := keymap_plain.c $(SRC)
19endif
20
15# Use USART for PS/2. With V-USB INT and BUSYWAIT code is not useful. 21# Use USART for PS/2. With V-USB INT and BUSYWAIT code is not useful.
16SRC += protocol/ps2_usart.c 22SRC += protocol/ps2_usart.c
17OPT_DEFS += -DPS2_USE_USART 23OPT_DEFS += -DPS2_USE_USART
@@ -95,7 +101,7 @@ VPATH += $(TARGET_DIR)
95VPATH += $(TOP_DIR) 101VPATH += $(TOP_DIR)
96 102
97 103
98include $(TOP_DIR)/protocol/vusb.mk
99include $(TOP_DIR)/protocol.mk 104include $(TOP_DIR)/protocol.mk
100include $(TOP_DIR)/common.mk 105include $(TOP_DIR)/common.mk
106include $(TOP_DIR)/protocol/vusb.mk
101include $(TOP_DIR)/rules.mk 107include $(TOP_DIR)/rules.mk
diff --git a/protocol/vusb/usbdrv/usbdrv.c b/protocol/vusb/usbdrv/usbdrv.c
index 21ed554f8..2e8dd8756 100644
--- a/protocol/vusb/usbdrv/usbdrv.c
+++ b/protocol/vusb/usbdrv/usbdrv.c
@@ -67,7 +67,7 @@ optimizing hints:
67#if USB_CFG_DESCR_PROPS_STRING_0 == 0 67#if USB_CFG_DESCR_PROPS_STRING_0 == 0
68#undef USB_CFG_DESCR_PROPS_STRING_0 68#undef USB_CFG_DESCR_PROPS_STRING_0
69#define USB_CFG_DESCR_PROPS_STRING_0 sizeof(usbDescriptorString0) 69#define USB_CFG_DESCR_PROPS_STRING_0 sizeof(usbDescriptorString0)
70PROGMEM char usbDescriptorString0[] = { /* language descriptor */ 70const PROGMEM char usbDescriptorString0[] = { /* language descriptor */
71 4, /* sizeof(usbDescriptorString0): length of descriptor in bytes */ 71 4, /* sizeof(usbDescriptorString0): length of descriptor in bytes */
72 3, /* descriptor type */ 72 3, /* descriptor type */
73 0x09, 0x04, /* language index (0x0409 = US-English) */ 73 0x09, 0x04, /* language index (0x0409 = US-English) */
@@ -77,7 +77,7 @@ PROGMEM char usbDescriptorString0[] = { /* language descriptor */
77#if USB_CFG_DESCR_PROPS_STRING_VENDOR == 0 && USB_CFG_VENDOR_NAME_LEN 77#if USB_CFG_DESCR_PROPS_STRING_VENDOR == 0 && USB_CFG_VENDOR_NAME_LEN
78#undef USB_CFG_DESCR_PROPS_STRING_VENDOR 78#undef USB_CFG_DESCR_PROPS_STRING_VENDOR
79#define USB_CFG_DESCR_PROPS_STRING_VENDOR sizeof(usbDescriptorStringVendor) 79#define USB_CFG_DESCR_PROPS_STRING_VENDOR sizeof(usbDescriptorStringVendor)
80PROGMEM int usbDescriptorStringVendor[] = { 80const PROGMEM int usbDescriptorStringVendor[] = {
81 USB_STRING_DESCRIPTOR_HEADER(USB_CFG_VENDOR_NAME_LEN), 81 USB_STRING_DESCRIPTOR_HEADER(USB_CFG_VENDOR_NAME_LEN),
82 USB_CFG_VENDOR_NAME 82 USB_CFG_VENDOR_NAME
83}; 83};
@@ -86,7 +86,7 @@ PROGMEM int usbDescriptorStringVendor[] = {
86#if USB_CFG_DESCR_PROPS_STRING_PRODUCT == 0 && USB_CFG_DEVICE_NAME_LEN 86#if USB_CFG_DESCR_PROPS_STRING_PRODUCT == 0 && USB_CFG_DEVICE_NAME_LEN
87#undef USB_CFG_DESCR_PROPS_STRING_PRODUCT 87#undef USB_CFG_DESCR_PROPS_STRING_PRODUCT
88#define USB_CFG_DESCR_PROPS_STRING_PRODUCT sizeof(usbDescriptorStringDevice) 88#define USB_CFG_DESCR_PROPS_STRING_PRODUCT sizeof(usbDescriptorStringDevice)
89PROGMEM int usbDescriptorStringDevice[] = { 89const PROGMEM int usbDescriptorStringDevice[] = {
90 USB_STRING_DESCRIPTOR_HEADER(USB_CFG_DEVICE_NAME_LEN), 90 USB_STRING_DESCRIPTOR_HEADER(USB_CFG_DEVICE_NAME_LEN),
91 USB_CFG_DEVICE_NAME 91 USB_CFG_DEVICE_NAME
92}; 92};
@@ -108,7 +108,7 @@ PROGMEM int usbDescriptorStringSerialNumber[] = {
108#if USB_CFG_DESCR_PROPS_DEVICE == 0 108#if USB_CFG_DESCR_PROPS_DEVICE == 0
109#undef USB_CFG_DESCR_PROPS_DEVICE 109#undef USB_CFG_DESCR_PROPS_DEVICE
110#define USB_CFG_DESCR_PROPS_DEVICE sizeof(usbDescriptorDevice) 110#define USB_CFG_DESCR_PROPS_DEVICE sizeof(usbDescriptorDevice)
111PROGMEM char usbDescriptorDevice[] = { /* USB device descriptor */ 111const PROGMEM char usbDescriptorDevice[] = { /* USB device descriptor */
112 18, /* sizeof(usbDescriptorDevice): length of descriptor in bytes */ 112 18, /* sizeof(usbDescriptorDevice): length of descriptor in bytes */
113 USBDESCR_DEVICE, /* descriptor type */ 113 USBDESCR_DEVICE, /* descriptor type */
114 0x10, 0x01, /* USB version supported */ 114 0x10, 0x01, /* USB version supported */
diff --git a/protocol/vusb/usbdrv/usbdrv.h b/protocol/vusb/usbdrv/usbdrv.h
index 3a78f307b..42fe16372 100644
--- a/protocol/vusb/usbdrv/usbdrv.h
+++ b/protocol/vusb/usbdrv/usbdrv.h
@@ -452,43 +452,43 @@ extern
452#if !(USB_CFG_DESCR_PROPS_DEVICE & USB_PROP_IS_RAM) 452#if !(USB_CFG_DESCR_PROPS_DEVICE & USB_PROP_IS_RAM)
453PROGMEM 453PROGMEM
454#endif 454#endif
455char usbDescriptorDevice[]; 455const char usbDescriptorDevice[];
456 456
457extern 457extern
458#if !(USB_CFG_DESCR_PROPS_CONFIGURATION & USB_PROP_IS_RAM) 458#if !(USB_CFG_DESCR_PROPS_CONFIGURATION & USB_PROP_IS_RAM)
459PROGMEM 459PROGMEM
460#endif 460#endif
461char usbDescriptorConfiguration[]; 461const char usbDescriptorConfiguration[];
462 462
463extern 463extern
464#if !(USB_CFG_DESCR_PROPS_HID_REPORT & USB_PROP_IS_RAM) 464#if !(USB_CFG_DESCR_PROPS_HID_REPORT & USB_PROP_IS_RAM)
465PROGMEM 465PROGMEM
466#endif 466#endif
467char usbDescriptorHidReport[]; 467const char usbDescriptorHidReport[];
468 468
469extern 469extern
470#if !(USB_CFG_DESCR_PROPS_STRING_0 & USB_PROP_IS_RAM) 470#if !(USB_CFG_DESCR_PROPS_STRING_0 & USB_PROP_IS_RAM)
471PROGMEM 471PROGMEM
472#endif 472#endif
473char usbDescriptorString0[]; 473const char usbDescriptorString0[];
474 474
475extern 475extern
476#if !(USB_CFG_DESCR_PROPS_STRING_VENDOR & USB_PROP_IS_RAM) 476#if !(USB_CFG_DESCR_PROPS_STRING_VENDOR & USB_PROP_IS_RAM)
477PROGMEM 477PROGMEM
478#endif 478#endif
479int usbDescriptorStringVendor[]; 479const int usbDescriptorStringVendor[];
480 480
481extern 481extern
482#if !(USB_CFG_DESCR_PROPS_STRING_PRODUCT & USB_PROP_IS_RAM) 482#if !(USB_CFG_DESCR_PROPS_STRING_PRODUCT & USB_PROP_IS_RAM)
483PROGMEM 483PROGMEM
484#endif 484#endif
485int usbDescriptorStringDevice[]; 485const int usbDescriptorStringDevice[];
486 486
487extern 487extern
488#if !(USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER & USB_PROP_IS_RAM) 488#if !(USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER & USB_PROP_IS_RAM)
489PROGMEM 489PROGMEM
490#endif 490#endif
491int usbDescriptorStringSerialNumber[]; 491const int usbDescriptorStringSerialNumber[];
492 492
493#endif /* __ASSEMBLER__ */ 493#endif /* __ASSEMBLER__ */
494 494
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];
35static uint8_t kbuf_head = 0; 35static uint8_t kbuf_head = 0;
36static uint8_t kbuf_tail = 0; 36static uint8_t kbuf_tail = 0;
37 37
38typedef struct {
39 uint8_t modifier;
40 uint8_t reserved;
41 uint8_t keycode[6];
42} keyboard_report_t;
43
44static keyboard_report_t keyboard_report; // sent to PC
38 45
39/* transfer keyboard report from buffer */ 46/* transfer keyboard report from buffer */
40void vusb_transfer_keyboard(void) 47void 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 */
235PROGMEM uchar keyboard_hid_report[] = { 242const 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 */
278PROGMEM uchar mouse_hid_report[] = { 285const 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
361PROGMEM char usbDescriptorConfiguration[] = { /* USB configuration descriptor */ 368const 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,