adb_usb: Scan unsupported devices with Reg0 by SRQ
This commit is contained in:
parent
083a008b66
commit
da230d3896
2 changed files with 37 additions and 0 deletions
|
|
@ -47,6 +47,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
// https://github.com/tmk/tmk_keyboard/issues/724
|
||||
#define ADB_MOUSE_2ND_BUTTON_QUIRK
|
||||
|
||||
// Scan unsupported devices with register0 when SRQ is asserted
|
||||
#define ADB_SRQ_SCAN_REG0
|
||||
|
||||
|
||||
/* ADB port setting */
|
||||
#define ADB_PORT PORTD
|
||||
|
|
|
|||
|
|
@ -762,3 +762,37 @@ void led_set(uint8_t usb_led)
|
|||
{
|
||||
adb_host_kbd_led(ADB_ADDR_KBD_POLL, ~usb_led);
|
||||
}
|
||||
|
||||
#ifdef ADB_SRQ_SCAN_REG0
|
||||
void hook_main_loop(void)
|
||||
{
|
||||
// Scan unsupported devices when Service Request(SRQ) is asserted
|
||||
uint8_t len;
|
||||
uint8_t buf[16];
|
||||
static uint8_t addr = 0;
|
||||
if (!adb_service_request()) return;
|
||||
for (addr = addr % 16; addr < 16; addr++) {
|
||||
if (addr == ADB_ADDR_KEYBOARD ||
|
||||
addr == ADB_ADDR_KBD_POLL ||
|
||||
addr == ADB_ADDR_KBD_TMP ||
|
||||
#ifdef ADB_MOUSE_ENABLE
|
||||
addr == ADB_ADDR_MOUSE ||
|
||||
addr == ADB_ADDR_MOUSE_POLL ||
|
||||
addr == ADB_ADDR_MOUSE_TMP ||
|
||||
#endif
|
||||
addr == ADB_ADDR_APPLIANCE) {
|
||||
continue;
|
||||
}
|
||||
len = adb_host_talk_buf(addr, ADB_REG_0, buf, sizeof(buf));
|
||||
if (len) {
|
||||
xprintf("addr%d reg0: [ ", addr);
|
||||
for (uint8_t i = 0; i < len; i++) {
|
||||
xprintf("%02X ", buf[i]);
|
||||
}
|
||||
xprintf("]\n");
|
||||
break;
|
||||
}
|
||||
if (!adb_service_request()) return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue