aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--converter/adb_usb/keymap.c6
-rw-r--r--protocol/adb.c24
-rw-r--r--protocol/adb.h1
3 files changed, 23 insertions, 8 deletions
diff --git a/converter/adb_usb/keymap.c b/converter/adb_usb/keymap.c
index c622dc623..25f851859 100644
--- a/converter/adb_usb/keymap.c
+++ b/converter/adb_usb/keymap.c
@@ -40,7 +40,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
40 K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K75,K77,K79, K59,K5B,K5C,K4E, \ 40 K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K75,K77,K79, K59,K5B,K5C,K4E, \
41 K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K45, \ 41 K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K45, \
42 K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \ 42 K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \
43 K36,K3A,K37, K31, K3B,K3D,K3C, K52, K41,K4C \ 43 K36,K3A,K37, K31, K7C,K7D, K3B,K3D,K3C, K52, K41,K4C \
44) { \ 44) { \
45 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \ 45 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
46 { KC_##K08, KC_##K09, KC_NO, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \ 46 { KC_##K08, KC_##K09, KC_NO, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
@@ -57,7 +57,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
57 { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_NO, KC_##K67 }, \ 57 { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_NO, KC_##K67 }, \
58 { KC_NO, KC_##K69, KC_NO, KC_##K6B, KC_NO, KC_##K6D, KC_NO, KC_##K6F }, \ 58 { KC_NO, KC_##K69, KC_NO, KC_##K6B, KC_NO, KC_##K6D, KC_NO, KC_##K6F }, \
59 { KC_NO, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \ 59 { KC_NO, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
60 { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_NO, KC_NO, KC_NO, KC_##K7F } \ 60 { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_NO, KC_##K7F } \
61} 61}
62 62
63 63
@@ -109,7 +109,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
109 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PMNS, 109 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PMNS,
110 CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, 110 CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
111 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, 111 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
112 LCTL,LGUI,LALT, SPC, LEFT,DOWN,RGHT, P0, PDOT,PENT 112 LCTL,LGUI,LALT, SPC, RGUI,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
113 ), 113 ),
114}; 114};
115 115
diff --git a/protocol/adb.c b/protocol/adb.c
index d7105b3a9..9f52f6ce7 100644
--- a/protocol/adb.c
+++ b/protocol/adb.c
@@ -67,6 +67,12 @@ void adb_host_init(void)
67#ifdef ADB_PSW_BIT 67#ifdef ADB_PSW_BIT
68 psw_hi(); 68 psw_hi();
69#endif 69#endif
70
71 // Enable keyboard left/right modifier distinction
72 // Addr:Keyboard(0010), Cmd:Listen(10), Register3(11)
73 // upper byte: reserved bits 0000, device address 0010
74 // lower byte: device handler 00000011
75 adb_host_listen(0x2B,0x02,0x03);
70} 76}
71 77
72#ifdef ADB_PSW_BIT 78#ifdef ADB_PSW_BIT
@@ -98,19 +104,27 @@ uint16_t adb_host_kbd_recv(void)
98 return data; 104 return data;
99} 105}
100 106
101// send state of LEDs 107void adb_host_listen(uint8_t cmd, uint8_t data_h, uint8_t data_l)
102void adb_host_kbd_led(uint8_t led)
103{ 108{
104 attention(); 109 attention();
105 send_byte(0x2A); // Addr:Keyboard(0010), Cmd:Listen(10), Register2(10) 110 send_byte(cmd);
106 place_bit0(); // Stopbit(0) 111 place_bit0(); // Stopbit(0)
107 _delay_us(200); // Tlt/Stop to Start 112 _delay_us(200); // Tlt/Stop to Start
108 place_bit1(); // Startbit(1) 113 place_bit1(); // Startbit(1)
109 send_byte(0); // send upper byte (not used) 114 send_byte(data_h);
110 send_byte(led&0x07); // send lower byte (bit2: ScrollLock, bit1: CapsLock, bit0: NumLock) 115 send_byte(data_l);
111 place_bit0(); // Stopbit(0); 116 place_bit0(); // Stopbit(0);
112} 117}
113 118
119// send state of LEDs
120void adb_host_kbd_led(uint8_t led)
121{
122 // Addr:Keyboard(0010), Cmd:Listen(10), Register2(10)
123 // send upper byte (not used)
124 // send lower byte (bit2: ScrollLock, bit1: CapsLock, bit0:
125 adb_host_listen(0x2A,0,led&0x07);
126}
127
114 128
115static inline void data_lo() 129static inline void data_lo()
116{ 130{
diff --git a/protocol/adb.h b/protocol/adb.h
index 1e4ca4013..bfe598bbf 100644
--- a/protocol/adb.h
+++ b/protocol/adb.h
@@ -56,6 +56,7 @@ POSSIBILITY OF SUCH DAMAGE.
56void adb_host_init(void); 56void adb_host_init(void);
57bool adb_host_psw(void); 57bool adb_host_psw(void);
58uint16_t adb_host_kbd_recv(void); 58uint16_t adb_host_kbd_recv(void);
59void adb_host_listen(uint8_t cmd, uint8_t data_h, uint8_t data_l);
59void adb_host_kbd_led(uint8_t led); 60void adb_host_kbd_led(uint8_t led);
60 61
61#endif 62#endif