-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specific Version of The64Maxi Keyboard doesn't work in Circle 48 #531
Comments
I guess the keyboard is connected via the internal USB hub of the The64Maxi device to the Raspberry Pi 2? Unfortunately the Circle USB hub driver has probably a problem with this hub. Is it possible to bypass it? |
Can you please add the option "usbpowerdelay=1500" to the file cmdline.txt on
the SD card and try again with the Circle 48 test. If possible, do not connect
the external hub device, so that we can be sure, only the keyboard is
involved.
|
Oops, I forgot to mention, that the |
:) no problem, it is easy repeatable. Now the first line looks like this, but unfortunately the screen is the same as uploaded before, there is no difference in the final result except the time between "Using device..." and "Device xxxx found" has been increased to 1,5 seconds.
|
Thanks for testing! Attached there is another test kernel image. Can you please test this in the same configuration and take a photo of the last log lines, displayed before the system hangs. You only need to replace the file kernel7.img with the file extracted from the .zip file. |
Yes, that's the output, I expected. Thanks for testing! It hangs in |
Thanks again, Here is the output from this Kernel. The output is different than before, so I cross my fingers, that it can help you in this matter. Btw. would it be helpful for you because of the situation that you don't have the hardware, that I try to install a software like FreeUSBAnalyzer on my computer and try to gather some information about the Maxi Keyboard device directly? I found this software for USB debugging and I was considdering, if this can be helpful? |
Thanks for testing! The system hangs, when it tries to fetch the configuration descriptor from the device. I will provide another lower layer dump test kernel soon. I don't think that this tool would help that much, because you cannot check the communication between the RPi and the keyboard with it. This would require a hardware sniffer. |
Alright, thanks for your explanation. I got the point, that the expected layer, where the problem happens can not be logged by such software tool, but you know much more than me about this, so I am in good mood, that you are able to fix it, because I would be lost :-) |
I don't know, if we can fix this, but I try. ;) Here is another test kernel image appended. It now logs the status of the USB transactions, and when it hangs for 500ms it stops and displays the status of the last 20 transactions. I hope I can found something in this. |
Thanks for testing and the info from the Free USB Analyzer! How it seems, I was wrong with my assumption, that it hangs, when trying to fetch the configuration descriptor. Instead the |
The configuration descriptor is definitely not according to the USB spec. There is a descriptor with zero length in it, so the parser never came to an end. Now I use this as a stop condition. Another kernel image attached, hopefully the last one. |
OK, now that the device is detected, the question is, if the key reports are in the right format and how is the mapping from physical key codes to logical characters. Please run the attached kernel test image and press some keys. The program displays the physical key codes. Normally the |
Thanks Rene, you are great! I can make today a brief check only, but it looks very good A=0x04 B=0x05 Y=0x1C Z=0x1D 1=0x1E 9=0x26 as you assume. I know from BMC64, that I have to load a special Keyboard config file for getting the TheC64 Maxi keyboard fully to work in BMC64 which is included there, I know for example the Shift and Commodore keys needs a special configuration in BMC64 or the F1/F3/F5/F7 of the C64 Keyboard which gives back 0x3A/0x3C/0x3E/0x40 are fine, but I cannot get F2/F4/F6/F8 to work yet, which are Shift+F-Keys which probably will result in 0x3B/0x3D/0x3F/0x41. |
The HideLink THEC64 USB keyboard provides a configuration descriptor, which contains a descriptor with length 0. This caused the configuration descriptor parser to hang. Now a length of 0 is used as stop condition. Issue #531
Thanks! This looks good. Now the question is, how can this be included into BMC64, which uses an other release of Circle (Step40?). You have to apply the patch from commit 1bb0882, listed above, in any case, so that the USB configuration parser works. Furthermore the keyboard mapping should be adapted, as you already noted. |
Hello Rene, Thanks and best regards |
Hello Rene, When I do the same with the Maxi keyboard for A I get alwyas modifier 1 and for A the keycode 0x04, if I press and hold shift, a new line appear with modifier 1 only and addionally to Shift pressing A results to a new line again, but modifier remains 1 again with keycode 0x04. So there happens something in the kernel when I press "Shift" or "Commodore" key behaves the same I mean I see a new line with modifier 1 without keycode, , but I havn't seen anything else except modifier 1 and the keycode is similar to what a normal keyboard will output but some keys opens a new line with modifier 1 only without outputting any keycode. Is this behaviour something which has to be adressed in the Circle library or is the different feedback from the Maxi keyboard something which can be handled with keyboard mappings in BMC64? I tested all buttons, but modifier remains always 1, pressing certain keys like right shift or left shift or commodore makes a new line with modifier 1 only, without any keycode visible or if another button will be pressed, I get modifer 1 and a keycode Thanks and best regards
|
The Circle USB keyboard driver expects the keyboard to behave like it is specified in the USB Device Class Definition for Human Interface Devices. According to this (section 8.3 on pg. 56) the modifiers byte is a bitmap, where each bit belongs to one of the modifier keys (Ctrl, Shift, Alt). Please also see pg. 60 in this document, where each byte of the 8 bytes report, sent by the keyboard, is described. The Circle driver implements the boot protocol for USB keyboards with the USB interface 3-1-1. If the modifier byte is always 0x01, that would mean, the left Ctrl key is always pressed. This is a wrong behavior according to this spec. I don't know, how BMC64 handles the keyboard. Perhaps it could filter this out. But the question remains, how the Maxi keyboard reports the modifier keys, if this byte is always 0x01? |
Hello Rene, PC keyboard provides always 8 byte in a package, when I press a button here for example SHIFT-Key, a key, shift+a keys
If I use the Maxi keyboard, I will receive always 9 byte per package, same example SHIFT-Key, a key, shift+a keys. they are basically identical but there is always a leading 0x01 at the beginning for every button on the Maxi keyboard. I checked really every button and every one has this additional 0x01 at the beginning.
is it necassary to change the code that the leading 0x01 will be cut, if a 9 byte message from the keyboard will be received? Thanks for your time and best regards |
Hello Rene, From my former post, I guess the manufacturer added the 9th byte at the beginning to obfurscate the protocol or they wasn't able to make it right, I don't know. :-) Easy enough for the manufacturer to revert it in their software but worse enough, that the hardware doesn't work in other situations like BMC64. very bad bevahiour from the manufacturer, if I am right, but I have no other explanation why a manufacturer of the keyboard should do such thing. My humblest idea was if a HID device like the Maxi sends 9 byte per package instead the 8 by definition, filter the leading 01 and process the remaining 8 bytes as usual because they seems to be accordingly to the USB specifications. If this is feasible, in your interest or intended by you, I cannot judge because I miss the needed skills for that and I don't know, Thanks again and best regards
|
If it's just a matter of filtering out the unwanted leading byte, I can make a change to my patched circle library. I might need some help with the location in the codebase to do that though. However, i"m wondering how the keyboard works on your PC? Or does it also exhibit the same incorrect behavior? |
No problem, this makes sense. The 0x01 is the Report ID, which is normally left out in the boot protocol. I will provide a modified USB keyboard driver soon, because it's not possible to handle this in BMC64 without driver support. |
Hello Rene, Best regards |
You are welcome. Here comes a first version of the patch for the USB keyboard driver, which should work with the THEC64 keyboard and a test kernel image below. Please let me know, if it works.
|
Hello Rene, Best regards |
OK, great, Christian! Thanks for testing. @randyrossi Please let me know, if you need additional changes to include this patch into Step40. |
I patched the change in and you can try a new C64 kernel here: |
Hello Rene, Thanks again. https://github.com/randyrossi/bmc64/issues/288#issuecomment-2596823169 |
The HideLink THEC64 keyboard sends an additional leading report ID, which has to be ignored. Issue #531
Hi Christian, you are welcome and thanks for all that testing. I'm glad, that we were able to solve this. Thanks also to Randy for quickly including this into BMC64. Rene |
Hello Rene,
I would like report one issue with the Circle library in combination with Randy Rossi BMC64 project.
https://github.com/randyrossi/
To be honest, Randy suggested to me, to open an issue, because I was already in contact and our findings seems to be an incompatible USB device in combination with the circle library. Additionally there are already users, which are using his BMC64 on Raspberry Pi 2/3 together with a modified TheC64 Maxi hardware.
https://retrogames.biz/products/thec64/
From the TheC64 Maxi only the USB keyboard will be used to the Pi and the internal USB hub of the Maxi, so all together becomes a perfect replica of an C64. So did I with an RPI2 B version. Sorry if I bother you wiith such details in case you know this already.
When I stick "TheC64" Keyboard to the Raspberry Pi and start his BMC64 which comes Originally with circle 40 the Pi will stuck as visible in this screen.
If I connect no keyboard at all to the Raspberry Pi, than BMC with Circle boots normally but without Keyboard input.
The 3rd option was to connect any noname Wireless Keyboard dongle to the Raspberry which looks like this and typing is possible.
Randy created for me a test enviroment with Circle library 48 but even here the boot process stuck when detecting the TheC64 keyboard.
As I mentioned in the beginning there are already users, which are using the BMC64 with Circle library together with TheC64 Keyboard without issues, so maybe there is a new revision? Additionally I can connect my BMC64 keyboard to a PC running LMDE6 or I can use a Raspian based distribution on the Rpi2 and both detects the keyboard fine and let me use the TheC64 Keyboard, so there seems to be no hardware issue but an incomatibility within the Circle library and I would be really happy if you can look into it, because as I said, BMC64 with an Raspberry Pi and the C64 replica is the perfect combintion for Retro Gamer like me.
Of course let me know, if I can assist you by your investigation. I am happy to do some testing if needed.
Thanks a lot for your time and your project which make this possible at all.
Best regards
Christian
The text was updated successfully, but these errors were encountered: