-
Notifications
You must be signed in to change notification settings - Fork 60
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
Kempston Mouse #145
Comments
I think it should be possible, but I've not tried using mice with TinyUSB. Will have a look when I get time. |
|
I think that you should not have any problems adding a USB HID mouse to the
Menu System, since there are many examples using the TinyUSB library on
GitHub. But I can help with adding Kempston Mouse ports to the emulator
and testing. I hope you have time for our hobby!) Best regards.
…On Wed, Jun 26, 2024, 23:50 fruit-bat ***@***.***> wrote:
I think it should be possible, but I've not tried using mice with TinyUSB.
Will have a look when I get time.
—
Reply to this email directly, view it on GitHub
<#145 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQJPRDE5QOMUN5DSJCLR76DZJMSQ3AVCNFSM6AAAAABJ2R2FTKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJSGYYDKMJYGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Just a start... Draft pull requests here so you can see what is going on... #146 @javavi thanks for the offer help. The test program is really handy. I have just routed the mouse events into emulator. I think I need to have a read about how mouse messages are delivered to the Spectrum. Please remind me which firmware you use and I can post test build here for you to play about with. |
The code on those branches works now. It's only compiling for the HDMI targets at the moment. I will sort the others shortly. |
Please remind me which firmware you use and I can post test build here for you to play about with. I can use MURMULATOR with USB Hub for testing and also attract help from the community for these purposes. |
This any good to you? |
Here are the rest of them.... let me know how you get on with them. There is an indicator on the menu which should say 'mice: 1' when a mouse is connected. |
For now I've checked it on the firmware I compiled myself from the mouse branch. |
Thanks for the info above. I'm struggling with getting the mouse wheel to work. My mouse is reporting 'boot mode' and I'm not sure how to persuade TinyUSB to do otherwise. I've been messing about in hid_app.c but nothing I have tried gets the mouse to reply according to the HID report which it delivers. Help gratefully received! |
Just so I remember, this is the HID report delivered from my mouse....
|
I know for example that PS/2 mice require a special initialization sequence from the host to make the scroll wheel work. |
Thanks @javavi ... I've made a little progress. The following change in TinyUSB seems to make the mouse operate according to the report it delivered (along with some changes to hid_app.c in the spectrum emulator). Not sure what other problems the change to TinyUSB might cause + I need to make it configurable.
|
I've pushed some changes to:
If you want to try them out, you will need to make the above change to TinyUSB. It needs lots of tidying up... but I think everything still works. |
I've pushed some changes to:
|
Either I assembled it crookedly, or it broke!? |
Can you get me the HID report descriptor of your mouse? |
|
💡Idea! |
On your Pi 4, plug in the mouse and then open a terminal. Type:
and then post the response. P.S. the quality of my English is pretty varied :-) |
This is a dump of the HID descriptor for a Logitech keyboard and mouse connected via a single Logitech Unifying dongle. 001:007:001:DESCRIPTOR 1719736417.691989 001:007:000:DESCRIPTOR 1719736417.695240
|
So I think this is your mouse...
Which is quite different to my M100. I think it needs a handler for the hid descriptor similar to the one I wrote for joysticks... I'll have a go but it is a little involved so might take a while. To give you an idea, these are the ones I wrote for a simple joystick: https://github.com/fruit-bat/pico-emu-utils/blob/feature/mouse/src/hid_host_joy.c I pull requested this stuff back to TinyUSB ages ago, but it never got merged :-( |
I have added a 'report' based handler for a mouse, ready for you to try :-) See: I would not place any bets on it working at all... but let me know if it does anything interesting. |
Yes, on 3 simple wired mice it works correctly, including the scroll wheel! |
I 'found/borrowed' a Logitech M325, which I am now testing with and it works very nicely. Make sure you have 'pulled':
I will check to see if I have done something stupid in the code... but not spotted anything yet. |
I can also confirm a working Logitech M330 |
Yes, I messed something up, now I reassembled it and everything worked as it should! |
💡How do you like this idea! |
I think it is possible but probably quite a trick to make it work nicely. e.g. swapping from left -> right, you would want to do it quickly but also would need a big movement to 'show' you aren't trying to centre. I'll have a think. |
Some tidy-ups pushed to:
|
Kempston Mouse works great, Thank you very much! |
yup, will have a go |
See new branch feature/mousejoy The 'magic' happens in here: Feel free to make it better! |
|
Give this a go. I'm not sure it is usable but maybe have a play and see what you think. It is really tricky to not make it really annoying to use. Maybe have a play with the code and see if you can make it better. |
PS. Probably need to get rid of the divides and only use shifts (depending on what the compiler is doing with them). |
Hello! |
I've added your changes to the mousehoy branch :-). I will have a think about adding a menu option. |
I've added them menu option... but it doesn't all fit together yet. I might need to merge the mouse and mouse-joystick into one class. |
Menu options now working :-) I'm probably going to remove ZxSpectrumHidMouseJoystick.cpp & ZxSpectrumHidMouseJoystick.h Let me know if it still works. |
Yes. Everything works fine and the menu is also fine. |
Many thanks; I've added it to branch. |
It is also necessary to make sure that when the machine is reset or when selecting options, the input devices are initialized to their initial state (the mouse-as-joystick algorithm). Some games, when they start up and see a non-zero state on the Kempston joystick port, then do not work with it. For example: ALIENS NEOPLASMA |
Wired up the 'reset' :-) |
Yes, now OK! the joystick states are reset when resetting, loading game images and changing mouse menu settings |
Excellent, you happy for me to merge this back to main? |
Since there is already support for USB HID devices, is it possible to ask to add support for Kempston Mouse to the emulator?
https://sinclair.wiki.zxnet.co.uk/wiki/Kempston_Mouse
https://velesoft.speccy.cz/kmturbo2008-cz.htm
https://velesoft.speccy.cz/kmsoft.htm
https://zxart.ee/eng/software/game/hw:kempstonmouse/statuses:allowed,forbidden,insales,recovered,unknown,unreleased/sorting:votes,desc
https://www.youtube.com/playlist?list=PLxOanVBhqd3tM1Ov2sGHI177WdlY0wali
The text was updated successfully, but these errors were encountered: