borb / amigahid-pico

Use USB input devices on Amiga computers, using the excellent Raspberry Pi Pico as a USB-to-bitbang adapter.
51 stars 4 forks source link

Lantronics Spider KVM weird mouse issue #31

Open reinauer opened 9 months ago

reinauer commented 9 months ago

Hi,

I started using the amigahid-pico with a Lantronics Spider KVM. The

keyboard works fine but the mouse does not:

Also, is CTRL-AMIGA-AMIGA mapped to anything?

borb commented 9 months ago

Hello,

Depending on which branch you're using, the mouse connection count is incorrect. I strongly suspect the main branch is a culprit at the moment - I have the same issue with the hid-pico in my A1200. Once I get a little free time I'll put the mouse motion counter update into the branch which contains full support for HID report mode mice and merge it, because that fixes it. I'll try to do it this week but family life means I'm not usually free until ~10pm most evenings.

I've seen the motion issue as and it's really weird. I've also seen the issue where holding the right mouse button down causes motion to smooth out. I'm going to need to rewrite the mouse motion output because it's junk and fairly stupid. I've hacked it a couple of times and it's just really ugly.

As for reset: ctrl-leftgui-rightgui or ctrl-leftgui-menu will trigger the reset line, regardless of which branch you're on. However, as Claude reported, I'm not asserting the minimum pulse length of 50ms so as a manual hack, hold the keys long enough to keep it held. If you're connecting to an A2000/A3000/A4000, reset is handled by asserting the clock line for a period of time and it's picked up by a small circuit and translated into a reset signal. That's a fairly simple change and also needs to be done.

reinauer commented 8 months ago

Ha, I am moving slow on this project as well. Thank you for your pointers. I switched to the development branch and the mouse started working a loooot better! Thank you for the suggestion.

As for asserting the clock line, is that something that could be done unconditionally? Or would this require adding a compile time option for A2000/3000/4000? Or even better, can the amigahid detect the Amiga somehow?

I'll play around with with this on my A3000.

reinauer commented 8 months ago

This is probably not the right way to fix the issue, but I can confirm that the following patch will make CTRL-LeftWin-RightWin reboot the A3000

index 4088427..637b7ee 100644
--- a/src/platform/amiga/keyboard_serial_io.c
+++ b/src/platform/amiga/keyboard_serial_io.c
@@ -201,6 +201,10 @@ void amiga_assert_reset()
 {
     // ahprintf("[akb] *** RESET BEING ASSERTED ***\n");
     _keyboard_gpio_set(KBD_AMIGA_RST, LOW);
+    // Hold clock lo for 500us
+    _keyboard_gpio_set(KBD_AMIGA_CLK, LOW);
+    sleep_us(500000);
+    _keyboard_gpio_set(KBD_AMIGA_CLK, HIGH);
 }

 void amiga_release_reset()
borb commented 8 months ago

That was the way I was intending to handle the reset line (I don't have a big-box Amiga to check with); I'll ask another user I know who uses this project to check it with their A2000.

I don't think there's really a point to making it configurable; at the very least, the 500ms wait will help, since at the very least on my A1200 I frequently find that holding reset for too short a time will fail to reset the Amiga. Long term, once I've got the display menu+settings storage aspects working, I can make it a runtime configurable but certainly I don't believe there will be any ill effects using it on wedge Amigas.

I'll patch in the reset code now; it'll go into the development branch.

Should probably keep this issue open until development is merged down to main.