adb_usb: Update Kensington Turbo Mouse configuration
This commit is contained in:
parent
d301870717
commit
fbfb6748ff
1 changed files with 43 additions and 8 deletions
|
|
@ -230,16 +230,51 @@ detect_again:
|
|||
if (mouse_handler == ADB_HANDLER_TURBO_MOUSE) {
|
||||
xprintf("TM5: ext\n");
|
||||
|
||||
// Kensington Turbo Mouse 5 command sequence to enable four buttons
|
||||
// https://elixir.bootlin.com/linux/v4.4/source/drivers/macintosh/adbhid.c#L1176
|
||||
// https://github.com/NetBSD/src/blob/64b8a48e1288eb3902ed73113d157af50b2ec596/sys/arch/macppc/dev/ams.c#L261
|
||||
static uint8_t cmd1[] = { 0xE7, 0x8C, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x94 };
|
||||
static uint8_t cmd2[] = { 0xA5, 0x14, 0x00, 0x00, 0x69, 0xFF, 0xFF, 0x27 };
|
||||
/* byte0: speed
|
||||
* 0xa0, 0xa5, 0xb0 and 0xb5 seem to work
|
||||
* uppper nibble:
|
||||
* 0x00-70, 0xc0-f0 no movement and button event
|
||||
* 0x80 enables mouse output speed slow
|
||||
* 0x90 enables mouse output
|
||||
* 0xa0 enables mouse output
|
||||
* 0xb0 enables mouse output speed fast -126 to 126
|
||||
* lower nibble:
|
||||
* 0x08 makes cursor not smooth, bit4 should be 0
|
||||
* 0x02 disables button4, bit1 should be 0
|
||||
* how other bits work is not clear.
|
||||
* byte1: button mapping - upper nibble for button1 and lower for button2
|
||||
* 0x14 button1 and button2 mapped as themselves
|
||||
* 0x0 disabled
|
||||
* 0x1 button1
|
||||
* 0x2 button1 toggle
|
||||
* 0x3 no effect key event FFFF
|
||||
* 0x4 button2
|
||||
* 0x5 button2 toggle
|
||||
* 0x6 button3
|
||||
* 0x7 button3 toggle
|
||||
* 0x8 ?toggle weirdly?
|
||||
* 0x9 button4
|
||||
* 0xa button4 toggle
|
||||
* 0xb ?disabled?
|
||||
* 0xc Left
|
||||
* 0xd Right
|
||||
* 0xe Alt+Left
|
||||
* 0xf Alt+Right
|
||||
* byte2: 0x00 - 0x40 on powerup, seems to do nothing
|
||||
* byte3: 0x00 - 0x01 on powerup, seems to do nothing
|
||||
* byte4: button mapping - upper nibble for button3 and lower for button4
|
||||
* 0x69 button3 and button4 mapped as themselves(see byte1)
|
||||
* byte5: 0xff unknown
|
||||
* byte6: 0xff unknown
|
||||
* byte7: 0xff checksum - must be 0xff before calculating
|
||||
* https://github.com/NetBSD/src/blob/8966d5b1cf335756dd9bba3331e84c659bf917e1/sys/dev/adb/adb_ktm.c#L181
|
||||
*/
|
||||
//static uint8_t cmd[] = { 0xA5, 0x14, 0x00, 0x00, 0x69, 0xFF, 0xFF, 0xFF };
|
||||
static uint8_t cmd[] = { 0xB5, 0x14, 0x00, 0x00, 0x69, 0xFF, 0xFF, 0xFF };
|
||||
cmd[7] = cmd[0] ^ cmd[1] ^ cmd[2] ^ cmd[3] ^ cmd[4] ^ cmd[5] ^ cmd[6] ^ cmd[7];
|
||||
|
||||
adb_host_flush(addr);
|
||||
adb_host_listen_buf(addr, ADB_REG_2, cmd1, sizeof(cmd1));
|
||||
adb_host_flush(addr);
|
||||
adb_host_listen_buf(addr, ADB_REG_2, cmd2, sizeof(cmd2));
|
||||
adb_host_listen_buf(addr, ADB_REG_2, cmd, sizeof(cmd));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue