tmk / tmk_keyboard

Keyboard firmwares for Atmel AVR and Cortex-M
4k stars 1.71k forks source link

usb_usb: 2.4G Dongle Chilkey ND75 #778

Closed tmk closed 1 month ago

tmk commented 1 month ago

The keyboard dongle doesn't work with the converter. It does not identify itself as a boot keyboard and not even a keyboard in its USB descriptor.

It seems interface 0/1 is boot keyboard/mouse compatible but it does not assert 'Boot Interface' in bInterfaceSubClass, nor keyboard/mouse in bInterfaceProtocol.

https://geekhack.org/index.php?topic=69169.msg3194615#msg3194615

https://gist.github.com/tmk/c3bfa6df5c19de2e01447489e80a600d

tmk commented 1 month ago

Fixed at: https://github.com/tmk/USB_Host_Shield_2.0/commit/17c02ca081fcf6b5d5eafdd78ac0c83334eb83fa

https://geekhack.org/index.php?topic=69169.msg3194799#msg3194799

timdodge commented 1 month ago

Hi Hasu, thanks again for looking into this issue.

I've compiled a hex from scratch but was having some issues with it, so did some digging and I think that the vendor and product IDs in hidboot.h are slightly wrong.

I've changed it like so, and it's now working for me:

diff --git a/hidboot.h b/hidboot.h
index 8e6310e..1df9682 100644
--- a/hidboot.h
+++ b/hidboot.h
@@ -452,7 +452,7 @@ uint8_t HIDBoot<BOOT_PROTOCOL>::Init(uint8_t parent, uint8_t port, bool lowspeed
                                 }

                                 // https://github.com/tmk/tmk_keyboard/issues/778
-                                if (device->idVendor == 0xfefe && device->idProduct == 0x0123) {
+                                if (device->idVendor == 0xc45 && device->idProduct == 0xfefe) {
                                     // HID / not boot / not keyboard
                                     ConfigDescParser<
                                             USB_CLASS_HID,

Regards, Tim

timdodge commented 1 month ago

I've been using the 2.4G dongle & usb-usb converter most of the day today... When it recognised, it works just as well as the usb cable connection; all my layers etc work fine.

However:

I think the issue with key presses sometimes working and sometimes not is the reason I didn't think your first changes worked initially, in the forum thread.

Anyway, thank you again for your software and time!

tmk commented 1 month ago

Thanks for the patch. The code was updated in repo. I used wrong vid/pid for no reason...

Those issues don't happen when connecting it as usb wired keyboard with the converter, right?

With debug firmware you can see useful info in debug log, perhaps. It is very difficult to debug issues on sleep/wake because logging doesn't work firmly during wakeup.

You can build debug firmware with make -f Makefile.debug or just download it here. https://github.com/tmk/tmk_keyboard/blob/master/converter/usb_usb/binary/usb_usb_debug.hex

timdodge commented 1 month ago

Thanks - yes you are correct, there are no issues at all using the usb converter and wired connection to the ND75.

I'll try to capture some info on the sleep/wake wireless issue and post it here.

timdodge commented 4 weeks ago

Unfortunately there's no output at all when the keyboard falls asleep or wakes.

Initial connection:

Waiting for new device:......
Listening:

TMK:0d2e24/LUFA:d6a7df/UHS2:a1ee5c
u:[S]12
u:20
u:40
u:50
u:51
[W][W][W]BM Init
Addr:01
NC:01
vid:0C45
pid:FEFE
HID_PROTOCOL_KEYBOARD
bNumEP:02
Cnf:01
bIfaceNum:01
bNumIface:00

Interface:00
SET_PROTOCOL: 00
SET_IDLE: 00
RPIPE: 00
RWU: 00
BM configured
u:90
s:f

USB configured.
[i]
Loop start.
usb_state: 90
speed: full
input 1: 00 00 0D 00 00 00 00 00
00 00 0D 00 00 00 00 00 
input 1: 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00

And then no output at all on fall asleep or wake.

tmk commented 3 weeks ago

Sorry for late reply.

Which OS are you using?

I guess that power saving code causes the problem. Can you try attached hex file if you have time?

nopowerdown.zip

timdodge commented 3 weeks ago

No worries at all - I'm using the usb-usb converter wired with no issues at all.

I'm running on Linux: kernel 6.6.52-gentoo. I'll reboot into Win11 later to see how it works there.

I tried the nopowerdown firmware, but it also output nothing when the keyboard fell asleep or woke up:

usb_state: 20
usb_state: 40
usb_state: 50
usb_state: 51
BM Init
Addr:01
NC:01
vid:0C45
pid:FEFE
HID_PROTOCOL_KEYBOARD
bNumEP:02
Cnf:01
bIfaceNum:01
bNumIface:00

Interface:00
SET_PROTOCOL: 00
SET_IDLE: 00
RPIPE: 00
RWU: 00
BM configured
host.Task: 2327
usb_state: 90
speed: full
input 1: 00 00 0A 00 00 00 00 00
00 00 0A 00 00 00 00 00 
ginput 1: 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 
input 1: 00 00 0A 00 00 00 00 00
00 00 0A 00 00 00 00 00 
ginput 1: 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 
input 1: 00 00 04 00 00 00 00 00
00 00 04 00 00 00 00 00 
ainput 1: 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00

then no output from the time the keyboard falls asleep
tmk commented 2 weeks ago

Thanks for testing. No clue on the debug log. I have no idea on debugging further now.