Absolute mouse coordinates

https://github.com/MiSTer-devel/Main_MiSTer/wiki

Moderators: Mug UK, Zorro 2, Greenious, spiny, Sorgelig, Moderator Team

warham
Atari maniac
Atari maniac
Posts: 90
Joined: Fri Oct 12, 2018 7:17 am

Re: Absolute mouse coordinates

Postby warham » Fri Apr 26, 2019 9:28 am

i have a pair of aimtracks and a dolphinbar if you need help testing

User avatar
kitrinx
Captain Atari
Captain Atari
Posts: 170
Joined: Wed Sep 26, 2018 6:03 am

Re: Absolute mouse coordinates

Postby kitrinx » Fri Apr 26, 2019 7:44 pm

@Sorg
The new lightgun mode for DS4 works well, very cool. Is it possible to only consider mouse button down when clicked? In the latest PR I made it so clicks would be acknowledged in both modes so that certain modes of Dolphinbar and Aimtrak could work, and I think the DS4 pad considers the mouse button down if you are just touching it.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5107
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Absolute mouse coordinates

Postby Sorgelig » Fri Apr 26, 2019 8:09 pm

DS4 touchpad works at the same time as a mouse through /dev/mice device. I cannot stop it providing the click events through /dev/mice as it's common device for all connected devices acting as mice.
Also, there is no way currently to distinguish the simple touch from clicking - both actions generate mouse click from /dev/mice. It's handled somewhere in the device driver layer. I didn't check if it possible to patch or supply driver parameter yet.
From practice I think the clicking the touchpad and moving the pointer at the same time is not convenient. I'm using the RT/LT for shooting. I think the core option to disable mouse click as shoot would be sufficient for DS4.

User avatar
kitrinx
Captain Atari
Captain Atari
Posts: 170
Joined: Wed Sep 26, 2018 6:03 am

Re: Absolute mouse coordinates

Postby kitrinx » Fri Apr 26, 2019 8:32 pm

Sorgelig wrote:DS4 touchpad works at the same time as a mouse through /dev/mice device. I cannot stop it providing the click events through /dev/mice as it's common device for all connected devices acting as mice.
Also, there is no way currently to distinguish the simple touch from clicking - both actions generate mouse click from /dev/mice. It's handled somewhere in the device driver layer. I didn't check if it possible to patch or supply driver parameter yet.
From practice I think the clicking the touchpad and moving the pointer at the same time is not convenient. I'm using the RT/LT for shooting. I think the core option to disable mouse click as shoot would be sufficient for DS4.


I'll see if I can split the options differently. That core's menu is starting to get big.

Locutus73
Captain Atari
Captain Atari
Posts: 489
Joined: Wed Feb 07, 2018 6:13 pm

Re: Absolute mouse coordinates

Postby Locutus73 » Sat Apr 27, 2019 8:29 am

Just managed to use a Wiimote with a standard BT dongle (no Dolphinbar) with cwiid and a custom Kernel (maybe I'll manage to make it work just with a Kernel module in the meantime Sorg updates Linux (if he wants to))... script is coming...

The menuconfig kernel option is
Device Drivers ---> Input device support --->[*] Miscellaneous devices ---> <*> User level driver support

Regards.

Locutus73

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5107
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Absolute mouse coordinates

Postby Sorgelig » Sat Apr 27, 2019 1:27 pm

Locutus73 wrote:Device Drivers ---> Input device support --->[*] Miscellaneous devices ---> <*> User level driver support

ok, i will add it.
May be you can explain more about cwiid - so may be i will make it as standard part of linux.

Locutus73
Captain Atari
Captain Atari
Posts: 489
Joined: Wed Feb 07, 2018 6:13 pm

Re: Absolute mouse coordinates

Postby Locutus73 » Sat Apr 27, 2019 8:33 pm

Sorgelig wrote:
Locutus73 wrote:Device Drivers ---> Input device support --->[*] Miscellaneous devices ---> <*> User level driver support

ok, i will add it.
May be you can explain more about cwiid - so may be i will make it as standard part of linux.

So… first of all I managed to compile uinput.ko as a separate kernel module and I uploaded all the resulting work in https://github.com/MiSTer-devel/Scripts_MiSTer.
wiimote_on.sh will download all necessary files and start the service, you only need to press 1+2 on a wiimote and you’re set: all main menu and NES maps are already there.
wiimote_off.sh… well, self explanatory.



Regarding cwiid: the main GitHub repo is https://github.com/abstrakraft/cwiid
I tried to crosscomplile the project as I usually do with no success, I always get an AMD64 ELF binary. So I had two options: prepare a native ARM build environment or find precompiled packages. Since I’m the laziness world champion, I opted for the second option. So I downloaded wminput_0.6.00+svn201-4_armhf.deb and python-cwiid_0.6.00+svn201-4_armhf.deb from http://http.us.debian.org/debian/pool/main/c/cwiid/ and extracted only the necessary files into /media/fat/linux/cwiid. I patched the main wminput executable for searching its plugins in /media/fat/linux/cwiid instead of /usr/lib/cwiid/plugins (same path length, nice uh?) and convinced it to search for shared libraries and python modules in the same path with
export LD_LIBRARY_PATH="/media/fat/linux/cwiid"
export PYTHONPATH="/media/fat/linux/cwiid"
Finally after compiling and loading uinput.ko, I was able to use wminput, but I needed a config. So I prepared MiSTer.config and I was able to wrap it all up. I configured the new virtual joypad both in main MiSTer (this is the difficult part, since you need steady hands and coordination to convince the wizard the IR pointing is an analog stick) and in NES core and that’s all.
All the required files, including the maps are downloaded by the script.

Regards.

Locutus73

Last edited by Locutus73 on Sat Apr 27, 2019 11:13 pm, edited 1 time in total.

zomgugoff
Atari freak
Atari freak
Posts: 53
Joined: Tue Jan 29, 2019 10:12 am

Re: Absolute mouse coordinates

Postby zomgugoff » Sat Apr 27, 2019 10:53 pm

I think I'm seeing a scaling issue with the NES zapper input and the Dolphinbar. The area I can move the pointer is restricted to a small rectangle. It doesn't happen with a mouse. I tried Dolphinbar as a mouse with Minimig, MacPlus, and FXCast. It worked perfectly in Minimig and MacPlus, but I had a similar issue with FXCast. The behavior doesn't change using mode 1 or 2 on the Dolphinbar.

EDIT:
The instructions for using the previous mappings were a bit vague and it wasn't obvious that a nunchuk was required for these to work. Also, the zapper setting I was using was the 'mouse' mode, and not 'joy1' mode, which fixes the movement area I was describing. So, here's a more concise list of requirements and settings for Dolphinbar:

-Config files added to /mnt/fat/configs
-Dolphinbar set to mode 3
-NES Peripheral set to Zapper(Joy1)
-Nunchuk connected (or the pointer will not move in mode 3)


I would really, really like to do this without the nunchuk attached. There has got to be a better way of doing this.

Locutus73
Captain Atari
Captain Atari
Posts: 489
Joined: Wed Feb 07, 2018 6:13 pm

Re: Absolute mouse coordinates

Postby Locutus73 » Sun Apr 28, 2019 8:34 am

zomgugoff wrote:I would really, really like to do this without the nunchuk attached. There has got to be a better way of doing this.

With latest Rysha/Kitrinx additions to NES core (I think they are still not released) you can fire with mouseclick while using a Joystick for Zapper... this means you can use Mode 2 with the other map file and no nunchuck. Btw, the wiimote_on.sh script downloads the maps for the Dolphinbar too.

Regards.

Locutus73

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5107
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Absolute mouse coordinates

Postby Sorgelig » Sun Apr 28, 2019 11:05 am

Locutus73 wrote:So… first of all I managed to compile uinput.ko as a separate kernel module and I uploaded all the resulting work in https://github.com/MiSTer-devel/Scripts_MiSTer.
wiimote_on.sh will download all necessary files and start the service, you only need to press 1+2 on a wiimote and you’re set: all main menu and NES maps are already there.
wiimote_off.sh… well, self explanatory.

Just converted my sensor bar to USB powered (had to short one LED on each side to make it 5V compatible) and used your script - and it works now!
Duck Hunt with Wiimote is pure cheat :)

amadama
Atariator
Atariator
Posts: 29
Joined: Fri Jun 27, 2014 12:00 am
Location: USA

Re: Absolute mouse coordinates

Postby amadama » Sun Apr 28, 2019 12:36 pm

Wow, this is very cool. Can't wait to try. You think it will work with the battery powered wii-bar?

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5107
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Absolute mouse coordinates

Postby Sorgelig » Sun Apr 28, 2019 2:21 pm

amadama wrote:Wow, this is very cool. Can't wait to try. You think it will work with the battery powered wii-bar?

Wii bar is just LEDs. It doesn't matter how it's powered.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5107
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Absolute mouse coordinates

Postby Sorgelig » Sun Apr 28, 2019 2:24 pm

I'm in process of integrating cwiid into linux.
It seems wminput being started without MAC switch BT into pairing mode till any wiimote connected. And it prevents other BT drvices to be connected.
So, it seems i have to introduce special action to start wminput. Probably something like F10 while in OSD menu.

Locutus73
Captain Atari
Captain Atari
Posts: 489
Joined: Wed Feb 07, 2018 6:13 pm

Re: Absolute mouse coordinates

Postby Locutus73 » Sun Apr 28, 2019 2:25 pm

amadama wrote:Wow, this is very cool. Can't wait to try. You think it will work with the battery powered wii-bar?

I’ma actually using a battery powered sensor-bar with Eneloop NI-MH, but it drains batteries quickly and when you’re low on voltage the aiming cursor get jittery.
In the meanwhile I bought this
https://www.ebay.com/itm/352453701724
and this
https://www.ebay.com/itm/153118796464
and I hope to sort out a non destructive USB 7.5V adapter for the original sensor-bar.

Regards.

Locutus73

Locutus73
Captain Atari
Captain Atari
Posts: 489
Joined: Wed Feb 07, 2018 6:13 pm

Re: Absolute mouse coordinates

Postby Locutus73 » Sun Apr 28, 2019 2:42 pm

Sorgelig wrote:I'm in process of integrating cwiid into linux.
It seems wminput being started without MAC switch BT into pairing mode till any wiimote connected. And it prevents other BT drvices to be connected.
So, it seems i have to introduce special action to start wminput. Probably something like F10 while in OSD menu.

I just tested it using the START_AT_BOOT option (in my script) and I experienced something slightly different: my 8bitdo Joypads successfully pair to MiSTer with no wiimote connected, but they’re jittery with sluggish response, until I pair a wiimote. So it seems that wminput scanning for wiimotes interferes with the normal operations. I agree F10 will work, just like F11 for joypad pairing.

Btw, today I helped a guy on Discord with the same problem as mine of MiSTer finding many BT devices and not pairing; I think that some filtering for joypads/keyboard/mice would be helpful, I’ll see if I can sort out something.

Last but not least, do you think you can include this BT firmware https://github.com/winterheart/broadcom ... 5-17cb.hcd in /lib/firmware/brcm (if it’s legal)?

Thank you in advance.
Best regards.

Locutus73

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5107
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Absolute mouse coordinates

Postby Sorgelig » Sun Apr 28, 2019 3:48 pm

Broadcomm dongles don't need firmware. I have 4 BCM dongles from different manufacturers.
The problem with BCM is in other aspect: BCM doesn't like sudden reset HW. After reset it goes into BT non-responsive mode. From driver point of view it looks like working, but BT devices cannot connect. You have to re-plug the dongle or turn the power off from hub.
So, while playing with BCM dongles you easily meet this problem and then you start to do many other things like putting firmware and then at some time you re-plug the dongle which makes it work again, and you say "A, ha! it needs firmware!" But no, it's not because firmware. This bug not always happens. But it happens for me in around 50% cases.
FW actually needed for BCM to enable some audio specific features. So it's not related to work with MiSTer.

So, i already started to tell that BCM dongles are not recommended. At least til some viable solution will be found. Btw, if you login to linux and issue reboot command there, then bug won't happen. So, probably driver doesn't fully initialize the RF part (if it's not HW bug).

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5107
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Absolute mouse coordinates

Postby Sorgelig » Sun Apr 28, 2019 3:57 pm

Actually WiiMote should be able to pair normally as many other BT devices, but it seems there is some quirk required to pair it. Then may be we won't need cwiid at all?

Locutus73
Captain Atari
Captain Atari
Posts: 489
Joined: Wed Feb 07, 2018 6:13 pm

Re: Absolute mouse coordinates

Postby Locutus73 » Sun Apr 28, 2019 6:58 pm

Sorgelig wrote:So, i already started to tell that BCM dongles are not recommended. At least til some viable solution will be found. Btw, if you login to linux and issue reboot command there, then bug won't happen. So, probably driver doesn't fully initialize the RF part (if it's not HW bug).

I'm confident what you're saying applies to other BCM dongles, but I assure you this specific model needs a firmware: there's no reboot command that can solve it, I tried everything. When you boot (hot, cold, whatever) you get this in the kernel ring buffer through dmesg:

Code: Select all

[    9.170801] Bluetooth: hci0: BCM: chip id 63
[    9.172044] Bluetooth: hci0: BCM: features 0x07
[    9.187813] Bluetooth: hci0: BCM20702A
[    9.188930] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
[    9.191867] bluetooth hci0: Direct firmware load for brcm/BCM20702A1-0b05-17cb.hcd failed with error -2
[    9.191889] Bluetooth: hci0: BCM: Patch brcm/BCM20702A1-0b05-17cb.hcd not found

after you put https://github.com/winterheart/broadcom ... 5-17cb.hcd in /lib/firmware/brcm everything works flawlessly everytime.

Sorgelig wrote:Actually WiiMote should be able to pair normally as many other BT devices, but it seems there is some quirk required to pair it. Then may be we won't need cwiid at all?

The problem with Wiimotes is not pairing per se, but mapping all its messages (i.e. the IR sensor image, the accelerometers data, etc.) to something which mimics standard joypad/mouse/keyboard events So I think we need cwiid and uinput (or some alternative) even after a successful pairing. Cwiid is used in many scenarios, i.e. in RetroPie https://github.com/RetroPie/RetroPie-Se ... Controller. Btw its wii accessories specific connection strategy seems to work very well and I think it will match perfectly the F10 button use case.

Regards.

Locutus73

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5107
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Absolute mouse coordinates

Postby Sorgelig » Sun Apr 28, 2019 11:51 pm

Locutus73 wrote:When you boot (hot, cold, whatever) you get this in the kernel ring buffer through dmesg:

Code: Select all

Code: Select all

[    9.170801] Bluetooth: hci0: BCM: chip id 63
[    9.172044] Bluetooth: hci0: BCM: features 0x07
[    9.187813] Bluetooth: hci0: BCM20702A
[    9.188930] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
[    9.191867] bluetooth hci0: Direct firmware load for brcm/BCM20702A1-0b05-17cb.hcd failed with error -2
[    9.191889] Bluetooth: hci0: BCM: Patch brcm/BCM20702A1-0b05-17cb.hcd not found


this message present for all my BCM dongles. They still work fine without FW:

Code: Select all

[   21.949022] usb 1-1.5: new full-speed USB device number 6 using dwc2
[   22.046242] usb 1-1.5: New USB device found, idVendor=0a5c, idProduct=21e8, bcdDevice= 1.12
[   22.054664] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   22.062056] usb 1-1.5: Product: BCM20702A0
[   22.066208] usb 1-1.5: Manufacturer: Broadcom Corp
[   22.201561] Bluetooth: hci0: BCM: chip id 63
[   22.207565] Bluetooth: hci0: BCM: features 0x07
[   22.228554] Bluetooth: hci0: BCM20702A
[   22.233575] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
[   22.239981] bluetooth hci0: Direct firmware load for brcm/BCM20702A1-0a5c-21e8.hcd failed with error -2
[   22.249531] Bluetooth: hci0: BCM: Patch brcm/BCM20702A1-0a5c-21e8.hcd not found

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5107
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Absolute mouse coordinates

Postby Sorgelig » Sun Apr 28, 2019 11:54 pm

i even found the exact device as your among mines: BCM20702A1-0b05-17cb.hcd
It's ASUS BT dongle.
And it works well without firmware patch.

Locutus73
Captain Atari
Captain Atari
Posts: 489
Joined: Wed Feb 07, 2018 6:13 pm

Re: Absolute mouse coordinates

Postby Locutus73 » Mon Apr 29, 2019 6:36 am

Sorgelig wrote:i even found the exact device as your among mines: BCM20702A1-0b05-17cb.hcd
It's ASUS BT dongle.
And it works well without firmware patch.

Indeed it's an ASUS BT dongle https://www.amazon.it/dp/B00CM83SC0, and I tried it now without firmware and it worked.
But the first time I tried it (at the beginning of April, see viewtopic.php?f=117&t=36544&p=371941#p371941) it didn't work at all until I put the firmware in /lib/firmware/brcm. When I performed the test back then, MiSTer was the first device where the dongle was inserted after unboxing it, I don't remember if I got or not any hci device at all, but I couldn't find any BT device through hcitool scan (and soft reboot didn't solve anything back then). I put the firmware and boom, hcitool scan found many devices (my joypads, TV sets, etc.).
These are the kernel logs with the firmware in place

Code: Select all

[    0.251192] Bluetooth: RFCOMM TTY layer initialized
[    0.251212] Bluetooth: RFCOMM socket layer initialized
[    0.251240] Bluetooth: RFCOMM ver 1.11
[    0.251251] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    0.251255] Bluetooth: BNEP filters: protocol multicast
[    0.251264] Bluetooth: BNEP socket layer initialized
[    0.251268] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[    0.251275] Bluetooth: HIDP socket layer initialized
[    9.186431] Bluetooth: hci0: BCM: chip id 63
[    9.187441] Bluetooth: hci0: BCM: features 0x07
[    9.203435] Bluetooth: hci0: BCM20702A
[    9.204434] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
[   10.538438] Bluetooth: hci0: BCM20702A1 (001.002.014) build 1467
[   10.554444] Bluetooth: hci0: Broadcom Bluetooth Device

Now after removing BCM20702A1-0b05-17cb.hcd the dongle continues to work.
:roll:
Is it possible that the kernel line

Code: Select all

Bluetooth: hci0: BCM: Patch brcm/BCM20702A1-0b05-17cb.hcd not found
means that some patch is permanentely applied to the internal firmware the first time the file is loaded (both with Windows or Linux)? So after you succesfully load the Windows driver or the Linux driver (with the firmware) once, then it works without the firmware file?

Regards.

Locutus73

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5107
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Absolute mouse coordinates

Postby Sorgelig » Mon Apr 29, 2019 7:47 am

This part is hard to tell. It's possible by some coincidence this dongle didn't work.
I highly doubt the patch is permanent as it may damage the original firmware if something happened or bad patch applied. I don't think Kernel guys would do such hidden unattended way permanently flash the firmware.

I've played with these patches before, but i'm sure i've deleted all of them before i've got my ASUS BT400 dongle. So, no patch has been applied to my dongle.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5107
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Absolute mouse coordinates

Postby Sorgelig » Mon Apr 29, 2019 7:53 am

there is some info about patches:
https://wiki.lm-technologies.com/firmwa ... ide-lm506/
They write it may improve RF part work. So, may be these patches are good at the end.

Locutus73
Captain Atari
Captain Atari
Posts: 489
Joined: Wed Feb 07, 2018 6:13 pm

Re: Absolute mouse coordinates

Postby Locutus73 » Mon Apr 29, 2019 8:42 am

Sorgelig wrote:there is some info about patches:
https://wiki.lm-technologies.com/firmwa ... ide-lm506/
They write it may improve RF part work. So, may be these patches are good at the end.

Yup, but we should consider if it’s legit to include these files. In the end I could improve the updater with the ability to download additional repositories even in the root filesystem (remounting it RW when necessary, i.e. when launched from the GUI and then re-remounting it RO at the end). But I wouldn’t add that repository (not knowing if it’s legit) by default, so it would be an user customization through an update.ini.

Regards.

Locutus73

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5107
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Absolute mouse coordinates

Postby Sorgelig » Wed May 01, 2019 3:15 pm

Now Wiimote support is integrated into Linux.
You don't need to assign IR axes, so you don't need predefined map files anymore. Just setup the wiimote as normal gamepad.
Nunchuck and Classic controller sticks are also supported.

F10 in OSD is to enable/disable the Wiimote.


Return to “MiSTer”

Who is online

Users browsing this forum: xythen and 3 guests