Skip to content
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

udev fix dolphinbar and safeguard against not adding devices with no mouse or touch buttons detected #13143

Merged
merged 6 commits into from Nov 5, 2021

Conversation

ghost
Copy link

@ghost ghost commented Oct 22, 2021

@twinaphex I bought a dolphin bar to see what was going on we werent detecting it because it was a abs device with no touch pointer it use a mouse button instead and we where only looking for the touch button on abs detection. I have updated the code to accept devices that dont have a touch buttons or mouse buttons to log that information and add the device anyway so the pointer works and someone can look into the issue without having to buy the hardware by simple asking the user to do some things from the terminal.

There is an issue separate from this one I dont know retroarch codebase well enough to dig into it more at the moment. When we hot plug the device order changes.

I dont know if we can somehow save the device index as well as the name and add the mouse and device name compare instead if found instead of just the index when we set it in the ui. This is more a user friendly thing rather than a requirement.

the function needing updated is here.

static udev_input_mouse_t *udev_get_mouse(
struct udev_input *udev, unsigned port)
{
unsigned i;
unsigned mouse_index = 0;
settings_t *settings = config_get_ptr();
udev_input_mouse_t *mouse = NULL;
if (port >= MAX_USERS || !video_driver_has_focus())
return NULL;
for (i = 0; i < udev->num_devices; ++i)
{
if (udev->devices[i]->type == UDEV_INPUT_KEYBOARD)
continue;
if (mouse_index == settings->uints.input_mouse_index[port])
{
mouse = &udev->devices[i]->mouse;
break;
}
++mouse_index;
}
return mouse;
}

@inactive123
Copy link
Contributor

Do other pointer devices still work after these changes as expected?

@ghost
Copy link
Author

ghost commented Oct 22, 2021

yes tested with two touch pads and dolphin bar as well a a few relative mice. The bug was only in the abs detection we checked it against a touch button only i assumed a all pointer devices would have a touch button but the dolphin bar has a mouse button. Both rel and abs have now been set to enable the device and print a warning if a mouse or touch button isint detected so the pointer will still work and libinput record can tell us if we are missing check that needs added we didnt account for. I couldn't really get any feedback from anyone with the device.

I posted the relevant info here to fix in a patch
#12974 (comment)

@ghost
Copy link
Author

ghost commented Oct 22, 2021

also forgot to mention RA logs the device type as well now.

[INFO] [udev]: Mouse #0: "  Mini Keyboard Mouse" (REL) /dev/input/event19
[INFO] [udev]: Mouse #1: "HJZ Mayflash Wiimote PC Adapter Mouse" (ABS) /dev/input/event23
[INFO] [udev]: Mouse #2: "Telink Wireless Receiver Mouse" (REL) /dev/input/event14
[INFO] [udev]: Mouse #3: "ELAN050A:00 04F3:3158 Mouse" (REL) /dev/input/event7
[INFO] [udev]: Mouse #4: "ELAN050A:00 04F3:3158 Touchpad" (ABS) /dev/input/event8

@inactive123
Copy link
Contributor

OK. There will be a release this weekend, so this PR will have to remain in waiting until next week. Next week I will whip out a Wii Remote bar and see if I can test this myself as well.

@ghost
Copy link
Author

ghost commented Oct 22, 2021

no problems at all you will need a dolphnbar or a bluetooth setup that works with the ir as a mouse device both should have no issues. Some setups require you to have nunchuck plugged in when using the bluetooth method for the ir to work if your not using the dolphinbar.

@ghost ghost changed the title udev fix dolphinbar and safeguard againstr not adding devices with no buttons detected udev fix dolphinbar and safeguard against not adding devices with no mouse or touch buttons detected Oct 23, 2021
@ofry
Copy link

ofry commented Oct 28, 2021

@twinaphex Could you test this PR?

@inactive123 inactive123 merged commit 1ae36ee into libretro:master Nov 5, 2021
@ghost ghost deleted the udev branch November 6, 2021 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants