From 6bf8000e6322da88f91f7eb53f510c2ba72743e5 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 27 Jul 2014 16:23:23 +0200 Subject: [PATCH 01/11] added serial mouse driver for Microsoft and Mousesystems mice * Both drivers use the interface defined in serial_mouse.h * They should work with any UART implementation (hardware/software UART) * The Microsoft driver is currently untested. The Mousesystems driver is confirmed to work. --- protocol/serial_mouse.h | 26 +++++ protocol/serial_mouse_microsoft.c | 125 ++++++++++++++++++++++++ protocol/serial_mouse_mousesystems.c | 140 +++++++++++++++++++++++++++ 3 files changed, 291 insertions(+) create mode 100644 protocol/serial_mouse.h create mode 100644 protocol/serial_mouse_microsoft.c create mode 100644 protocol/serial_mouse_mousesystems.c diff --git a/protocol/serial_mouse.h b/protocol/serial_mouse.h new file mode 100644 index 0000000..c3c19d7 --- /dev/null +++ b/protocol/serial_mouse.h @@ -0,0 +1,26 @@ +/* +Copyright 2011 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef SERIAL_MOUSE_H +#define SERIAL_MOUSE_H + +#include + +uint8_t serial_mouse_init(void); +void serial_mouse_task(void); + +#endif diff --git a/protocol/serial_mouse_microsoft.c b/protocol/serial_mouse_microsoft.c new file mode 100644 index 0000000..6b3f806 --- /dev/null +++ b/protocol/serial_mouse_microsoft.c @@ -0,0 +1,125 @@ +/* +Copyright 2011,2013 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#include +#include +#include + +#include "serial.h" +#include "serial_mouse.h" +#include "report.h" +#include "host.h" +#include "timer.h" +#include "print.h" +#include "debug.h" + +static void print_usb_data(const report_mouse_t *report); + +uint8_t serial_mouse_init(void) +{ + serial_init(); + return 0; +} + +void serial_mouse_task(void) +{ + /* 3 byte ring buffer */ + static uint8_t buffer[3]; + static int buffer_cur = 0; + + static report_mouse_t report = {}; + + int16_t rcv; + + rcv = serial_recv2(); + if (rcv < 0) + /* no new data */ + return; + + if (debug_mouse) + xprintf("serial_mouse: byte: %04X\n", rcv); + + /* + * If bit 6 is one, this signals the beginning + * of a 3 byte sequence/packet. + */ + if (rcv & (1 << 6)) + buffer_cur = 0; + + buffer[buffer_cur] = (uint8_t)rcv; + + if (buffer_cur == 0 && buffer[buffer_cur] == 0x20) { + /* + * Logitech extension: This must be a follow-up on + * the last 3-byte packet signaling a middle button click + */ + report.buttons |= MOUSE_BTN3; + report.x = report.y = 0; + + print_usb_data(&report); + host_mouse_send(&report); + return; + } + + buffer_cur++; + + if (buffer_cur < 3) + return; + buffer_cur = 0; + + /* + * parse 3 byte packet. + * NOTE: We only get a complete packet + * if the mouse moved or the button states + * change. + */ + report.buttons = 0; + if (buffer[0] & (1 << 5)) + report.buttons |= MOUSE_BTN1; + if (buffer[0] & (1 << 4)) + report.buttons |= MOUSE_BTN2; + + report.x = (buffer[0] << 6) | buffer[1]; + report.y = ((buffer[0] << 4) & 0xC0) | buffer[2]; + + /* USB HID uses values from -127 to 127 only */ + report.x = report.x < -127 ? -127 : report.x; + report.y = report.y < -127 ? -127 : report.y; + +#if 0 + if (!report.buttons && !report.x && !report.y) { + /* + * Microsoft extension: Middle mouse button pressed + * FIXME: I don't know how exactly this extension works. + */ + report.buttons |= MOUSE_BTN3; + } +#endif + + print_usb_data(&report); + host_mouse_send(&report); +} + +static void print_usb_data(const report_mouse_t *report) +{ + if (!debug_mouse) + return; + + xprintf("serial_mouse usb: [%02X|%d %d %d %d]\n", + report->buttons, report->x, report->y, + report->v, report->h); +} diff --git a/protocol/serial_mouse_mousesystems.c b/protocol/serial_mouse_mousesystems.c new file mode 100644 index 0000000..ec708c9 --- /dev/null +++ b/protocol/serial_mouse_mousesystems.c @@ -0,0 +1,140 @@ +/* +Copyright 2011,2013 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#include +#include +#include + +#include "serial.h" +#include "serial_mouse.h" +#include "report.h" +#include "host.h" +#include "timer.h" +#include "print.h" +#include "debug.h" + +#define SERIAL_MOUSE_CENTER_SCROLL + +static void print_usb_data(const report_mouse_t *report); + +uint8_t serial_mouse_init(void) +{ + serial_init(); + return 0; +} + +void serial_mouse_task(void) +{ + /* 5 byte ring buffer */ + static uint8_t buffer[5]; + static int buffer_cur = 0; + + int16_t rcv; + + report_mouse_t report = {0, 0, 0, 0, 0}; + + rcv = serial_recv2(); + if (rcv < 0) + /* no new data */ + return; + + if (debug_mouse) + xprintf("serial_mouse: byte: %04X\n", rcv); + + /* + * Synchronization: mouse(4) says that all + * bytes but the first one in the packet have + * bit 7 == 0, but this is untrue. + * Therefore we discard all bytes up to the + * first one with the characteristic bit pattern. + */ + if (buffer_cur == 0 && (rcv >> 3) != 0x10) + return; + + buffer[buffer_cur++] = (uint8_t)rcv; + + if (buffer_cur < 5) + return; + buffer_cur = 0; + +#ifdef SERIAL_MOUSE_CENTER_SCROLL + if ((buffer[0] & 0x7) == 0x5 && (buffer[1] || buffer[2])) { + report.h = (int8_t)buffer[1]; + /* USB HID uses only values from -127 to 127 */ + report.h = report.h < -127 ? -127 : report.h; + report.v = (int8_t)buffer[2]; + report.v = report.v < -127 ? -127 : report.v; + + print_usb_data(&report); + host_mouse_send(&report); + + if (buffer[3] || buffer[4]) { + report.h = (int8_t)buffer[3]; + report.h = report.h < -127 ? -127 : report.h; + report.v = (int8_t)buffer[4]; + report.v = report.v < -127 ? -127 : report.v; + + print_usb_data(&report); + host_mouse_send(&report); + } + + return; + } +#endif + + /* + * parse 5 byte packet. + * NOTE: We only get a complete packet + * if the mouse moved or the button states + * change. + */ + if (!(buffer[0] & (1 << 2))) + report.buttons |= MOUSE_BTN1; + if (!(buffer[0] & (1 << 1))) + report.buttons |= MOUSE_BTN3; + if (!(buffer[0] & (1 << 0))) + report.buttons |= MOUSE_BTN2; + + report.x = (int8_t)buffer[1]; + /* USB HID uses only values from -127 to 127 */ + report.x = report.x < -127 ? -127 : report.x; + report.y = -(int8_t)buffer[2]; + report.y = report.y < -127 ? -127 : report.y; + + print_usb_data(&report); + host_mouse_send(&report); + + if (buffer[3] || buffer[4]) { + report.x = (int8_t)buffer[3]; + report.x = report.x < -127 ? -127 : report.x; + report.y = -(int8_t)buffer[4]; + report.y = report.y < -127 ? -127 : report.y; + + print_usb_data(&report); + host_mouse_send(&report); + } +} + +static void print_usb_data(const report_mouse_t *report) +{ + if (!debug_mouse) + return; + + xprintf("serial_mouse usb: [%02X|%d %d %d %d]\n", + report->buttons, report->x, report->y, + report->v, report->h); +} From 388fe60c67dbc4232a979d3de3b3b161a67871e2 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 27 Jul 2014 16:26:38 +0200 Subject: [PATCH 02/11] fixed PS/2 keyboard converter config When using the PS/2 interrupt implementation, the DATA pin should be PD0 as the documentation (README.md) states. --- converter/ps2_usb/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/converter/ps2_usb/config.h b/converter/ps2_usb/config.h index c9bab1b..889f0c3 100644 --- a/converter/ps2_usb/config.h +++ b/converter/ps2_usb/config.h @@ -69,7 +69,7 @@ along with this program. If not, see . #define PS2_DATA_PORT PORTD #define PS2_DATA_PIN PIND #define PS2_DATA_DDR DDRD -#define PS2_DATA_BIT 2 +#define PS2_DATA_BIT 0 #define PS2_INT_INIT() do { \ EICRA |= ((1< Date: Sun, 27 Jul 2014 17:07:26 +0200 Subject: [PATCH 03/11] integrated serial mouse drivers as a feature into the firmware architecture * can be enabled by defining Makefile macro SERIAL_MOUSE_MICROSOFT_ENABLE or SERIAL_MOUSE_MOUSESYSTEMS_ENABLE. * Serial implementation can be chosen via SERIAL_MOUSE_USE_SOFT and SERIAL_MOUSE_USE_UART macros * UART configuration still has to be done in config.h: I added working clauses for both mouse protocols to ps2_usb's config.h --- converter/ps2_usb/Makefile | 13 ++++++++++ converter/ps2_usb/config.h | 38 ++++++++++++++++++++++++++++ protocol.mk | 20 +++++++++++++++ protocol/lufa/lufa.c | 12 +++++++++ protocol/serial_mouse_mousesystems.c | 2 +- 5 files changed, 84 insertions(+), 1 deletion(-) diff --git a/converter/ps2_usb/Makefile b/converter/ps2_usb/Makefile index 1dd23c1..f20039c 100644 --- a/converter/ps2_usb/Makefile +++ b/converter/ps2_usb/Makefile @@ -91,6 +91,19 @@ PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomen #PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin #PS2_USE_BUSYWAIT = yes # uses primitive reference code +# Serial Mouse Options +# You can choose a mouse protocol and the implementation of +# the underlying serial connection. +# +#SERIAL_MOUSE_MICROSOFT_ENABLE = yes # Enable support for Microsoft-compatible mice +#SERIAL_MOUSE_MOUSESYSTEMS_ENABLE = yes # Enable support for Mousesystems-compatible mice +#SERIAL_MOUSE_USE_UART = yes # use hardware UART for serial connection +#SERIAL_MOUSE_USE_SOFT = yes # use software serial implementation + +# Optional serial mouse driver features +# Support scrolling while holding the middle mouse button +# (currently only supported for Mousesystems mice): +#OPT_DEFS += -DSERIAL_MOUSE_CENTER_SCROLL # Optimize size but this may cause error "relocation truncated to fit" #EXTRALDFLAGS = -Wl,--relax diff --git a/converter/ps2_usb/config.h b/converter/ps2_usb/config.h index 889f0c3..5b64400 100644 --- a/converter/ps2_usb/config.h +++ b/converter/ps2_usb/config.h @@ -170,4 +170,42 @@ along with this program. If not, see . #endif #endif +#ifdef SERIAL_MOUSE_MICROSOFT + /* + * Serial(USART) configuration (for Microsoft serial mice) + * asynchronous, positive logic, 1200baud, bit order: LSB first + * 1-start bit, 7-data bit, no parity, 1-stop bit + */ + #define SERIAL_UART_BAUD 1200 + #define SERIAL_UART_DATA UDR1 + #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1) + #define SERIAL_UART_RXD_VECT USART1_RX_vect + #define SERIAL_UART_TXD_READY (UCSR1A&(1<>8); /* baud rate */ \ + UCSR1B |= (1<>8); /* baud rate */ \ + UCSR1B |= (1<. #include "print.h" #include "debug.h" -#define SERIAL_MOUSE_CENTER_SCROLL +//#define SERIAL_MOUSE_CENTER_SCROLL static void print_usb_data(const report_mouse_t *report); From 0bfba7acc4e05e66c8ab448286fc51bc94d03a57 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 27 Jul 2014 17:18:14 +0200 Subject: [PATCH 04/11] factored out serial_mouse_init() into serial_mouse.h --- protocol/serial_mouse.h | 9 ++++++++- protocol/serial_mouse_microsoft.c | 6 ------ protocol/serial_mouse_mousesystems.c | 6 ------ 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/protocol/serial_mouse.h b/protocol/serial_mouse.h index c3c19d7..2ccd3d9 100644 --- a/protocol/serial_mouse.h +++ b/protocol/serial_mouse.h @@ -20,7 +20,14 @@ along with this program. If not, see . #include -uint8_t serial_mouse_init(void); +#include "serial.h" + +static inline uint8_t serial_mouse_init(void) +{ + serial_init(); + return 0; +} + void serial_mouse_task(void); #endif diff --git a/protocol/serial_mouse_microsoft.c b/protocol/serial_mouse_microsoft.c index 6b3f806..f83036a 100644 --- a/protocol/serial_mouse_microsoft.c +++ b/protocol/serial_mouse_microsoft.c @@ -29,12 +29,6 @@ along with this program. If not, see . static void print_usb_data(const report_mouse_t *report); -uint8_t serial_mouse_init(void) -{ - serial_init(); - return 0; -} - void serial_mouse_task(void) { /* 3 byte ring buffer */ diff --git a/protocol/serial_mouse_mousesystems.c b/protocol/serial_mouse_mousesystems.c index 68b2b5b..36c6738 100644 --- a/protocol/serial_mouse_mousesystems.c +++ b/protocol/serial_mouse_mousesystems.c @@ -31,12 +31,6 @@ along with this program. If not, see . static void print_usb_data(const report_mouse_t *report); -uint8_t serial_mouse_init(void) -{ - serial_init(); - return 0; -} - void serial_mouse_task(void) { /* 5 byte ring buffer */ From eb902844946f0bda7da76cdb1e9aafae4881b63c Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 27 Jul 2014 17:26:44 +0200 Subject: [PATCH 05/11] serial_mouse: simplified clipping of X/Y/V/H changes below -127 using a MAX macro --- protocol/serial_mouse_microsoft.c | 9 +++++++-- protocol/serial_mouse_mousesystems.c | 29 +++++++++++++--------------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/protocol/serial_mouse_microsoft.c b/protocol/serial_mouse_microsoft.c index f83036a..54fedae 100644 --- a/protocol/serial_mouse_microsoft.c +++ b/protocol/serial_mouse_microsoft.c @@ -27,6 +27,11 @@ along with this program. If not, see . #include "print.h" #include "debug.h" +#ifdef MAX +#undef MAX +#endif +#define MAX(X, Y) ((X) > (Y) ? (X) : (Y)) + static void print_usb_data(const report_mouse_t *report); void serial_mouse_task(void) @@ -91,8 +96,8 @@ void serial_mouse_task(void) report.y = ((buffer[0] << 4) & 0xC0) | buffer[2]; /* USB HID uses values from -127 to 127 only */ - report.x = report.x < -127 ? -127 : report.x; - report.y = report.y < -127 ? -127 : report.y; + report.x = MAX(report.x, -127); + report.y = MAX(report.y, -127); #if 0 if (!report.buttons && !report.x && !report.y) { diff --git a/protocol/serial_mouse_mousesystems.c b/protocol/serial_mouse_mousesystems.c index 36c6738..c4ddbb8 100644 --- a/protocol/serial_mouse_mousesystems.c +++ b/protocol/serial_mouse_mousesystems.c @@ -27,6 +27,11 @@ along with this program. If not, see . #include "print.h" #include "debug.h" +#ifdef MAX +#undef MAX +#endif +#define MAX(X, Y) ((X) > (Y) ? (X) : (Y)) + //#define SERIAL_MOUSE_CENTER_SCROLL static void print_usb_data(const report_mouse_t *report); @@ -67,20 +72,16 @@ void serial_mouse_task(void) #ifdef SERIAL_MOUSE_CENTER_SCROLL if ((buffer[0] & 0x7) == 0x5 && (buffer[1] || buffer[2])) { - report.h = (int8_t)buffer[1]; /* USB HID uses only values from -127 to 127 */ - report.h = report.h < -127 ? -127 : report.h; - report.v = (int8_t)buffer[2]; - report.v = report.v < -127 ? -127 : report.v; + report.h = MAX((int8_t)buffer[1], -127); + report.v = MAX((int8_t)buffer[2], -127); print_usb_data(&report); host_mouse_send(&report); if (buffer[3] || buffer[4]) { - report.h = (int8_t)buffer[3]; - report.h = report.h < -127 ? -127 : report.h; - report.v = (int8_t)buffer[4]; - report.v = report.v < -127 ? -127 : report.v; + report.h = MAX((int8_t)buffer[3], -127); + report.v = MAX((int8_t)buffer[4], -127); print_usb_data(&report); host_mouse_send(&report); @@ -103,20 +104,16 @@ void serial_mouse_task(void) if (!(buffer[0] & (1 << 0))) report.buttons |= MOUSE_BTN2; - report.x = (int8_t)buffer[1]; /* USB HID uses only values from -127 to 127 */ - report.x = report.x < -127 ? -127 : report.x; - report.y = -(int8_t)buffer[2]; - report.y = report.y < -127 ? -127 : report.y; + report.x = MAX((int8_t)buffer[1], -127); + report.y = MAX(-(int8_t)buffer[2], -127); print_usb_data(&report); host_mouse_send(&report); if (buffer[3] || buffer[4]) { - report.x = (int8_t)buffer[3]; - report.x = report.x < -127 ? -127 : report.x; - report.y = -(int8_t)buffer[4]; - report.y = report.y < -127 ? -127 : report.y; + report.x = MAX((int8_t)buffer[3], -127); + report.y = MAX(-(int8_t)buffer[4], -127); print_usb_data(&report); host_mouse_send(&report); From 03fd4a6ff0fcccf8d7683b7fac3d9e6ae4fb635e Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 27 Jul 2014 17:58:41 +0200 Subject: [PATCH 06/11] updated copyrights: serial_mouse.h, serial_mouse_microsoft.c and serial_mouse_mousesystems.c are new --- protocol/serial_mouse.h | 2 +- protocol/serial_mouse_microsoft.c | 2 +- protocol/serial_mouse_mousesystems.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/protocol/serial_mouse.h b/protocol/serial_mouse.h index 2ccd3d9..226314f 100644 --- a/protocol/serial_mouse.h +++ b/protocol/serial_mouse.h @@ -1,5 +1,5 @@ /* -Copyright 2011 Jun Wako +Copyright 2014 Robin Haberkorn This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/protocol/serial_mouse_microsoft.c b/protocol/serial_mouse_microsoft.c index 54fedae..ab74b7c 100644 --- a/protocol/serial_mouse_microsoft.c +++ b/protocol/serial_mouse_microsoft.c @@ -1,5 +1,5 @@ /* -Copyright 2011,2013 Jun Wako +Copyright 2014 Robin Haberkorn This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/protocol/serial_mouse_mousesystems.c b/protocol/serial_mouse_mousesystems.c index c4ddbb8..cfe8996 100644 --- a/protocol/serial_mouse_mousesystems.c +++ b/protocol/serial_mouse_mousesystems.c @@ -1,5 +1,5 @@ /* -Copyright 2011,2013 Jun Wako +Copyright 2014 Robin Haberkorn This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by From 8b9c61ade54c3018970d94dfbc319a69f29ac6af Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 26 Aug 2014 17:34:10 +0900 Subject: [PATCH 07/11] Revert ps2_usb/Makefile and config.h --- converter/ps2_usb/Makefile | 13 ------------- converter/ps2_usb/config.h | 40 +------------------------------------- 2 files changed, 1 insertion(+), 52 deletions(-) diff --git a/converter/ps2_usb/Makefile b/converter/ps2_usb/Makefile index f20039c..1dd23c1 100644 --- a/converter/ps2_usb/Makefile +++ b/converter/ps2_usb/Makefile @@ -91,19 +91,6 @@ PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomen #PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin #PS2_USE_BUSYWAIT = yes # uses primitive reference code -# Serial Mouse Options -# You can choose a mouse protocol and the implementation of -# the underlying serial connection. -# -#SERIAL_MOUSE_MICROSOFT_ENABLE = yes # Enable support for Microsoft-compatible mice -#SERIAL_MOUSE_MOUSESYSTEMS_ENABLE = yes # Enable support for Mousesystems-compatible mice -#SERIAL_MOUSE_USE_UART = yes # use hardware UART for serial connection -#SERIAL_MOUSE_USE_SOFT = yes # use software serial implementation - -# Optional serial mouse driver features -# Support scrolling while holding the middle mouse button -# (currently only supported for Mousesystems mice): -#OPT_DEFS += -DSERIAL_MOUSE_CENTER_SCROLL # Optimize size but this may cause error "relocation truncated to fit" #EXTRALDFLAGS = -Wl,--relax diff --git a/converter/ps2_usb/config.h b/converter/ps2_usb/config.h index 5b64400..c9bab1b 100644 --- a/converter/ps2_usb/config.h +++ b/converter/ps2_usb/config.h @@ -69,7 +69,7 @@ along with this program. If not, see . #define PS2_DATA_PORT PORTD #define PS2_DATA_PIN PIND #define PS2_DATA_DDR DDRD -#define PS2_DATA_BIT 0 +#define PS2_DATA_BIT 2 #define PS2_INT_INIT() do { \ EICRA |= ((1<. #endif #endif -#ifdef SERIAL_MOUSE_MICROSOFT - /* - * Serial(USART) configuration (for Microsoft serial mice) - * asynchronous, positive logic, 1200baud, bit order: LSB first - * 1-start bit, 7-data bit, no parity, 1-stop bit - */ - #define SERIAL_UART_BAUD 1200 - #define SERIAL_UART_DATA UDR1 - #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1) - #define SERIAL_UART_RXD_VECT USART1_RX_vect - #define SERIAL_UART_TXD_READY (UCSR1A&(1<>8); /* baud rate */ \ - UCSR1B |= (1<>8); /* baud rate */ \ - UCSR1B |= (1< Date: Tue, 26 Aug 2014 17:35:16 +0900 Subject: [PATCH 08/11] Revert lufa/lufa.c --- protocol/lufa/lufa.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/protocol/lufa/lufa.c b/protocol/lufa/lufa.c index 58201e5..16a602d 100644 --- a/protocol/lufa/lufa.c +++ b/protocol/lufa/lufa.c @@ -49,10 +49,6 @@ #endif #include "suspend.h" -#ifdef SERIAL_MOUSE_ENABLE -#include "serial_mouse.h" -#endif - #include "descriptor.h" #include "lufa.h" @@ -575,10 +571,6 @@ int main(void) sleep_led_init(); #endif -#ifdef SERIAL_MOUSE_ENABLE - serial_mouse_init(); -#endif - print("Keyboard start.\n"); while (1) { while (USB_DeviceState == DEVICE_STATE_Suspended) { @@ -590,10 +582,6 @@ int main(void) keyboard_task(); -#ifdef SERIAL_MOUSE_ENABLE - serial_mouse_task(); -#endif - #if !defined(INTERRUPT_CONTROL_ENDPOINT) USB_USBTask(); #endif From c4530ab0a8d7cf09ec37b082695f8f17f02c2b00 Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 26 Aug 2014 17:36:44 +0900 Subject: [PATCH 09/11] Add serial_mouse_task in keyboard.c --- common/keyboard.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common/keyboard.c b/common/keyboard.c index 2b66f20..020be8e 100644 --- a/common/keyboard.c +++ b/common/keyboard.c @@ -37,6 +37,9 @@ along with this program. If not, see . #ifdef PS2_MOUSE_ENABLE # include "ps2_mouse.h" #endif +#ifdef SERIAL_MOUSE_ENABLE +#include "serial_mouse.h" +#endif #ifdef MATRIX_HAS_GHOST @@ -64,6 +67,10 @@ void keyboard_init(void) #ifdef PS2_MOUSE_ENABLE ps2_mouse_init(); #endif +#ifdef SERIAL_MOUSE_ENABLE + serial_mouse_init(); +#endif + #ifdef BOOTMAGIC_ENABLE bootmagic(); @@ -126,6 +133,10 @@ MATRIX_LOOP_END: ps2_mouse_task(); #endif +#ifdef SERIAL_MOUSE_ENABLE + serial_mouse_task(); +#endif + // update LED if (led_status != host_keyboard_leds()) { led_status = host_keyboard_leds(); From c672cbc31c67335050dc3ba9d54acb97e5d3da0c Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 26 Aug 2014 17:39:04 +0900 Subject: [PATCH 10/11] Add option 7bit data to serial_soft.c --- protocol/serial_soft.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/protocol/serial_soft.c b/protocol/serial_soft.c index e8870bc..44822b7 100644 --- a/protocol/serial_soft.c +++ b/protocol/serial_soft.c @@ -122,7 +122,11 @@ void serial_send(uint8_t data) /* signal state: IDLE: ON, START: OFF, STOP: ON, DATA0: OFF, DATA1: ON */ #ifdef SERIAL_SOFT_BIT_ORDER_MSB + #ifdef SERIAL_SOFT_DATA_7BIT + uint8_t mask = 0x40; + #else uint8_t mask = 0x80; + #endif #else uint8_t mask = 0x01; #endif @@ -133,7 +137,11 @@ void serial_send(uint8_t data) SERIAL_SOFT_TXD_OFF(); _delay_us(WAIT_US); - while (mask) { +#ifdef SERIAL_SOFT_DATA_7BIT + while (mask&0x7F) { +#else + while (mask&0xFF) { +#endif if (data&mask) { SERIAL_SOFT_TXD_ON(); parity ^= 1; @@ -173,7 +181,11 @@ ISR(SERIAL_SOFT_RXD_VECT) uint8_t data = 0; #ifdef SERIAL_SOFT_BIT_ORDER_MSB + #ifdef SERIAL_SOFT_DATA_7BIT + uint8_t mask = 0x40; + #else uint8_t mask = 0x80; + #endif #else uint8_t mask = 0x01; #endif @@ -197,7 +209,11 @@ ISR(SERIAL_SOFT_RXD_VECT) #else mask <<= 1; #endif - } while (mask); +#ifdef SERIAL_SOFT_DATA_7BIT + } while (mask&0x7F); +#else + } while (mask&0xFF); +#endif #if defined(SERIAL_SOFT_PARITY_EVEN) || defined(SERIAL_SOFT_PARITY_ODD) /* to center of parity bit */ From 4799c99b4d1f065d1c23f3f27df079072d0ce8e9 Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 26 Aug 2014 17:40:22 +0900 Subject: [PATCH 11/11] Add serialmouser_usb project --- converter/serialmouse_usb/Makefile | 106 +++++++++++++ converter/serialmouse_usb/README.md | 11 ++ converter/serialmouse_usb/config.h | 119 +++++++++++++++ converter/serialmouse_usb/keymap.c | 33 ++++ converter/serialmouse_usb/keymap_common.c | 30 ++++ converter/serialmouse_usb/keymap_common.h | 174 ++++++++++++++++++++++ converter/serialmouse_usb/led.c | 24 +++ converter/serialmouse_usb/matrix.c | 83 +++++++++++ 8 files changed, 580 insertions(+) create mode 100644 converter/serialmouse_usb/Makefile create mode 100644 converter/serialmouse_usb/README.md create mode 100644 converter/serialmouse_usb/config.h create mode 100644 converter/serialmouse_usb/keymap.c create mode 100644 converter/serialmouse_usb/keymap_common.c create mode 100644 converter/serialmouse_usb/keymap_common.h create mode 100644 converter/serialmouse_usb/led.c create mode 100644 converter/serialmouse_usb/matrix.c diff --git a/converter/serialmouse_usb/Makefile b/converter/serialmouse_usb/Makefile new file mode 100644 index 0000000..ea0e439 --- /dev/null +++ b/converter/serialmouse_usb/Makefile @@ -0,0 +1,106 @@ +# +# Makefile for Teensy +# +# Target file name (without extension). +TARGET = serialmouse_usb + +# Directory common source filess exist +TOP_DIR = ../.. + +# Directory keyboard dependent files exist +TARGET_DIR = . + +# project specific files +SRC = keymap.c \ + matrix.c \ + led.c + +CONFIG_H = config.h + + +# MCU name +#MCU = at90usb1287 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +#OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=512 + + +# Build Options +# comment out to disable the options. +# +#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +#MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +#EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +#COMMAND_ENABLE = yes # Commands for debug and configuration +#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA + + +# Serial Mouse Options +# You can choose a mouse protocol and the implementation of +# the underlying serial connection. +# +SERIAL_MOUSE_MICROSOFT_ENABLE = yes # Enable support for Microsoft-compatible mice +#SERIAL_MOUSE_MOUSESYSTEMS_ENABLE = yes # Enable support for Mousesystems-compatible mice +#SERIAL_MOUSE_USE_UART = yes # use hardware UART for serial connection +SERIAL_MOUSE_USE_SOFT = yes # use software serial implementation + +# Optional serial mouse driver features +# Support scrolling while holding the middle mouse button +# (currently only supported for Mousesystems mice): +#OPT_DEFS += -DSERIAL_MOUSE_CENTER_SCROLL + +# Optimize size but this may cause error "relocation truncated to fit" +#EXTRALDFLAGS = -Wl,--relax + +# Search Path +VPATH += $(TARGET_DIR) +VPATH += $(TOP_DIR) + +include $(TOP_DIR)/protocol.mk +include $(TOP_DIR)/protocol/lufa.mk +include $(TOP_DIR)/common.mk +include $(TOP_DIR)/rules.mk diff --git a/converter/serialmouse_usb/README.md b/converter/serialmouse_usb/README.md new file mode 100644 index 0000000..ef8a006 --- /dev/null +++ b/converter/serialmouse_usb/README.md @@ -0,0 +1,11 @@ +Serial mouse converter +====================== +See https://github.com/tmk/tmk_keyboard/pull/131 + + +Supported protocols +------------------- +### Microsoft +Not tested. + +### Mousesystems diff --git a/converter/serialmouse_usb/config.h b/converter/serialmouse_usb/config.h new file mode 100644 index 0000000..b257d99 --- /dev/null +++ b/converter/serialmouse_usb/config.h @@ -0,0 +1,119 @@ +/* +Copyright 2012 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include + +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x2222 +#define DEVICE_VER 0x0001 +#define MANUFACTURER t.m.k. +#define PRODUCT serial mouse converter +#define DESCRIPTION convert serial mouse into USB + + +/* matrix size */ +#define MATRIX_ROWS 0 +#define MATRIX_COLS 0 + + +/* key combination for command */ +#define IS_COMMAND() false + + + +#ifdef SERIAL_MOUSE_MICROSOFT + /* + * Serial(USART) configuration (for Microsoft serial mice) + * asynchronous, positive logic, 1200baud, bit order: LSB first + * 1-start bit, 7-data bit, no parity, 1-stop bit + */ + #define SERIAL_UART_BAUD 1200 + #define SERIAL_UART_DATA UDR1 + #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1) + #define SERIAL_UART_RXD_VECT USART1_RX_vect + #define SERIAL_UART_TXD_READY (UCSR1A&(1<>8); /* baud rate */ \ + UCSR1B |= (1<>8); /* baud rate */ \ + UCSR1B |= (1< + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#include +#include +#include "keymap.h" + + +/* translates key to keycode */ +uint8_t keymap_key_to_keycode(uint8_t layer, key_t key) +{ + return KC_NO; +} + +/* translates Fn keycode to action */ +action_t keymap_fn_to_action(uint8_t keycode) +{ + return (action_t){}; +} + diff --git a/converter/serialmouse_usb/keymap_common.c b/converter/serialmouse_usb/keymap_common.c new file mode 100644 index 0000000..241d2e3 --- /dev/null +++ b/converter/serialmouse_usb/keymap_common.c @@ -0,0 +1,30 @@ +/* +Copyright 2011,2012,2013 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#include "keymap_common.h" + + +/* translates key to keycode */ +uint8_t keymap_key_to_keycode(uint8_t layer, key_t key) +{ + return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]); +} + +/* translates Fn keycode to action */ +action_t keymap_fn_to_action(uint8_t keycode) +{ + return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) }; +} diff --git a/converter/serialmouse_usb/keymap_common.h b/converter/serialmouse_usb/keymap_common.h new file mode 100644 index 0000000..216a8dc --- /dev/null +++ b/converter/serialmouse_usb/keymap_common.h @@ -0,0 +1,174 @@ +/* +Copyright 2011,2012,2013 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#ifndef KEYMAP_COMMON_H +#define KEYMAP_COMMON_H + +#include +#include +#include +#include "keycode.h" +#include "action.h" +#include "action_macro.h" +#include "report.h" +#include "print.h" +#include "debug.h" +#include "keymap.h" + + +// 32*8(256) byte array which converts PS/2 code into USB code +extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; +extern const uint16_t fn_actions[]; + + +/* All keys */ +#define KEYMAP_ALL( \ + K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ + K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \ + K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \ + K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \ + K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \ + K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \ + \ + K61, /* for European ISO */ \ + K51, K13, K6A, K64, K67, /* for Japanese JIS */ \ + K08, K10, K18, K20, K28, K30, K38, K40, K48, K50, K57, K5F, /* F13-24 */ \ + KB7, KBF, KDE, /* System Power, Sleep, Wake */ \ + KA3, KB2, KA1, /* Mute, Volume Up, Volume Down */ \ + KCD, K95, KBB, KB4, KD0, /* Next, Previous, Stop, Pause, Media Select */ \ + KC8, KAB, KC0, /* Mail, Calculator, My Computer */ \ + K90, KBA, KB8, KB0, /* WWW Search, Home, Back, Forward */ \ + KA8, KA0, K98 /* WWW Stop, Refresh, Favorites */ \ +) { \ + { KC_NO, KC_##K01, KC_NO, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \ + { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_NO }, \ + { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_NO }, \ + { KC_##K18, KC_NO, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_NO }, \ + { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_NO }, \ + { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_NO }, \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_NO }, \ + { KC_##K38, KC_NO, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \ + { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_NO }, \ + { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_NO }, \ + { KC_##K50, KC_##K51, KC_##K52, KC_NO, KC_##K54, KC_##K55, KC_NO, KC_##K57 }, \ + { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_NO, KC_##K5D, KC_NO, KC_##K5F }, \ + { KC_NO, KC_##K61, KC_NO, KC_NO, KC_##K64, KC_NO, KC_##K66, KC_##K67 }, \ + { KC_NO, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_NO, KC_NO, KC_NO }, \ + { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \ + { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_##K7E, KC_NO }, \ + { KC_NO, KC_NO, KC_NO, KC_##K83, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { KC_##K90, KC_##K91, KC_NO, KC_NO, KC_##K94, KC_##K95, KC_NO, KC_NO }, \ + { KC_##K98, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K9F }, \ + { KC_##KA0, KC_##KA1, KC_NO, KC_##KA3, KC_NO, KC_NO, KC_NO, KC_##KA7 }, \ + { KC_##KA8, KC_NO, KC_NO, KC_##KAB, KC_NO, KC_NO, KC_NO, KC_##KAF }, \ + { KC_##KB0, KC_NO, KC_##KB2, KC_NO, KC_##KB4, KC_NO, KC_NO, KC_##KB7 }, \ + { KC_##KB8, KC_NO, KC_##KBA, KC_##KBB, KC_NO, KC_NO, KC_NO, KC_##KBF }, \ + { KC_##KC0, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { KC_##KC8, KC_NO, KC_##KCA, KC_NO, KC_NO, KC_##KCD, KC_NO, KC_NO }, \ + { KC_##KD0, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { KC_NO, KC_NO, KC_##KDA, KC_NO, KC_NO, KC_NO, KC_##KDE, KC_NO }, \ + { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { KC_NO, KC_##KE9, KC_NO, KC_##KEB, KC_##KEC, KC_NO, KC_NO, KC_NO }, \ + { KC_##KF0, KC_##KF1, KC_##KF2, KC_NO, KC_##KF4, KC_##KF5, KC_NO, KC_NO }, \ + { KC_NO, KC_NO, KC_##KFA, KC_NO, KC_##KFC, KC_##KFD, KC_##KFE, KC_NO }, \ +} + +/* US layout */ +#define KEYMAP( \ + K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ + K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \ + K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \ + K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \ + K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \ + K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \ +) \ +KEYMAP_ALL( \ + K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ + K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \ + K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \ + K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \ + K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \ + K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \ + \ + NUBS, \ + RO, KANA, JYEN, HENK, MHEN, \ + F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \ + SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \ + AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \ + MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \ + MAIL, CALCULATOR, MY_COMPUTER, \ + WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \ + WWW_STOP, WWW_REFRESH, WWW_FAVORITES \ +) + +/* ISO layout */ +#define KEYMAP_ISO( \ + K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ + K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \ + K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, KF1,KE9,KFA, K6C,K75,K7D, \ + K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52,K5D,K5A, K6B,K73,K74,K79, \ + K12,K61,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \ + K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \ +) \ +KEYMAP_ALL( \ + K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ + K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \ + K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \ + K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \ + K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \ + K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \ + \ + K61, \ + RO, KANA, JYEN, HENK, MHEN, \ + F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \ + SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \ + AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \ + MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \ + MAIL, CALCULATOR, MY_COMPUTER, \ + WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \ + WWW_STOP, WWW_REFRESH, WWW_FAVORITES \ +) + +/* JIS layout */ +#define KEYMAP_JIS( \ + K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ + K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K6A,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \ + K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, KF1,KE9,KFA, K6C,K75,K7D, \ + K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52,K5D, K5A, K6B,K73,K74,K79, \ + K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A,K51, K59, KF5, K69,K72,K7A, \ + K14,K9F,K11, K67,K29,K64,K13, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \ +) \ +KEYMAP_ALL( \ + K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ + K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \ + K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \ + K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \ + K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \ + K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \ + \ + NUBS, \ + K51, K13, K6A, K64, K67, \ + F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \ + SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \ + AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \ + MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \ + MAIL, CALCULATOR, MY_COMPUTER, \ + WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \ + WWW_STOP, WWW_REFRESH, WWW_FAVORITES \ +) + +#endif diff --git a/converter/serialmouse_usb/led.c b/converter/serialmouse_usb/led.c new file mode 100644 index 0000000..f76545f --- /dev/null +++ b/converter/serialmouse_usb/led.c @@ -0,0 +1,24 @@ +/* +Copyright 2011 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#include "stdint.h" +#include "led.h" + + +void led_set(uint8_t usb_led) +{ +} diff --git a/converter/serialmouse_usb/matrix.c b/converter/serialmouse_usb/matrix.c new file mode 100644 index 0000000..0e0d87f --- /dev/null +++ b/converter/serialmouse_usb/matrix.c @@ -0,0 +1,83 @@ +/* +Copyright 2011 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#include +#include +#include +#include +#include "action.h" +#include "print.h" +#include "util.h" +#include "debug.h" +#include "matrix.h" + + +inline +uint8_t matrix_rows(void) +{ + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) +{ + return MATRIX_COLS; +} + +void matrix_init(void) +{ + debug_enable = true; + debug_mouse=true; + return; +} + +uint8_t matrix_scan(void) +{ + return 0; +} + +bool matrix_is_modified(void) +{ + return false; +} + +inline +bool matrix_has_ghost(void) +{ + return false; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return false; +} + +inline +uint8_t matrix_get_row(uint8_t row) +{ + return 0; +} + +void matrix_print(void) +{ +} + +uint8_t matrix_key_count(void) +{ + return 0; +}