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

Linux/Input: fix evdev device list #4121

Merged
merged 2 commits into from Oct 20, 2018

Conversation

Projects
None yet
5 participants
@Megamouse
Copy link
Contributor

Megamouse commented Jan 27, 2018

todo: fix order of events -> names

for #4116 and #5226

std::string name;
const auto uniqe = libevdev_get_uniq(dev);

if (uniqe != NULL)

This comment has been minimized.

Copy link
@TGEnigma

TGEnigma Jan 27, 2018

Contributor

use nullptr

std::string evdev_joystick_handler::get_device_name(const libevdev* dev)
{
std::string name;
const auto uniqe = libevdev_get_uniq(dev);

This comment has been minimized.

Copy link
@danilaml

danilaml Jan 28, 2018

Contributor

unique

@Megamouse Megamouse force-pushed the Megamouse:evdev branch from fc056ba to 25eca23 Jan 29, 2018


std::string name = get_device_name(dev);

if (unique_names.find(name) == unique_names.end())

This comment has been minimized.

Copy link
@randomstuff

randomstuff Feb 7, 2018

The name format is not the same for the first instance and the other ones AFAIU.

For consistency, I'd just use the same name format all the time:

std::string name = get_device_name(dev);
name = fmt::format("%d. %s", ++unique_names[name], name);

This comment has been minimized.

Copy link
@Megamouse

Megamouse Feb 7, 2018

Author Contributor

That's possible. But what do others say.

This comment has been minimized.

Copy link
@Megamouse

Megamouse Feb 7, 2018

Author Contributor

actually I think using numbers for all names is going to create inconsistencies. For example when you add different controllers on the next boot. You'd have to make sure the correct controllers always end up at the same numbers. This is not possible with evdev (I think). We get different events each Linux reboot.

This comment has been minimized.

Copy link
@randomstuff

randomstuff Feb 7, 2018

Well that's the whole thing: with std::unordered_map<std::string, u32> unique_names; the number are per device name. If you have two different devices they will be called "1. Ultimate Gamepad" and "1. Killer Gamepad" but if you have two same gamepads they will be called "1. Ultimate Gamepad" and "2. Ultimate Gamepad". Now the two game pads "Ultimate Gamepads" could be swapped between reboot but if they are really identical that's not a problem but it's actually a feature.

This comment has been minimized.

Copy link
@Megamouse

Megamouse Feb 7, 2018

Author Contributor

you know... it's exactly what i do right now.
only i don't use 1.
did you even try?

This comment has been minimized.

Copy link
@randomstuff

randomstuff Feb 7, 2018

OK, I failed to parse you comment because I assumed you was not the author of the PR :)

@Megamouse

This comment has been minimized.

Copy link
Contributor Author

Megamouse commented Mar 11, 2018

closed because of upcoming fixes. I think it makes no sense to merge this before.

@Megamouse Megamouse closed this Mar 11, 2018

@Megamouse Megamouse reopened this Sep 23, 2018

@Megamouse Megamouse force-pushed the Megamouse:evdev branch from 146f523 to 293e8e5 Oct 20, 2018

@Megamouse Megamouse changed the title [WIP] Linux/Input: fix evdev device list Linux/Input: fix evdev device list Oct 20, 2018

@Megamouse Megamouse merged commit eba2216 into RPCS3:master Oct 20, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@Megamouse Megamouse deleted the Megamouse:evdev branch Oct 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.