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

Mouse showing up twice in xinput #27

Open
c4tz opened this issue Apr 12, 2016 · 10 comments
Open

Mouse showing up twice in xinput #27

c4tz opened this issue Apr 12, 2016 · 10 comments

Comments

@c4tz
Copy link

c4tz commented Apr 12, 2016

Hey there,

thank you for coding such a handy piece of software! :)

I just have one problem: My mouse (Naga Chroma) is showing up twice in xinput under Xubuntu 15.10:

⎡ Virtual core pointer                id=2    [master pointer  (3)]
⎜   ↳ Razer Razer Naga Chroma       id=9    [slave  pointer  (2)]
⎜   ↳ Razer Razer Naga Chroma       id=10   [slave  pointer  (2)]
⎣ Virtual core keyboard               id=3    [master keyboard (2)]
    ↳ Razer Razer Naga Chroma     id=11   [slave  keyboard (3)]

It also appears twice in dev/input/by-id/:

lrwxrwxrwx 1 root root  9 Apr 11 21:30 usb-Razer_Razer_Naga_Chroma-event-mouse -> ../event5
lrwxrwxrwx 1 root root  9 Apr 11 21:30 usb-Razer_Razer_Naga_Chroma-if01-event-kbd -> ../event6
lrwxrwxrwx 1 root root  9 Apr 11 21:30 usb-Razer_Razer_Naga_Chroma-if02-event-kbd -> ../event7
lrwxrwxrwx 1 root root  9 Apr 11 21:30 usb-Razer_Razer_Naga_Chroma-mouse -> ../mouse0

Because of this, nagastart.sh wont work properly. This wouldn't be much of a problem, but I can't even get it to work when manually setting the xinput-button-map for both devices.

Can you tell me what I'm doing wrong?

Oh, and here are the button mappings of the two devices (they don't seem to change):

xinput get-button-map $(echo 9 | awk '{print $1}')

1 2 3 4 5 6 7 11 10 8 9 13 14 

xinput get-button-map $(echo 10 | awk '{print $1}')

1 2 3 4 5 6 7 
@apocatarsis
Copy link
Collaborator

Thank YOU for using it!

I do not think you are doing something wrong. Maybe your device is different from the one we used!. You could try to run the naga executable alone and see if it works, without using nagastart. You will have to deal with the default mapping but its just one magic line (see Usage in the front page).

The chroma we use to add support showed up like this, as seen in naga.cpp
"/dev/input/by-id/usb-Razer_Razer_Naga_Chroma-if02-event-kbd"
"/dev/input/by-id/usb-Razer_Razer_Naga_Chroma-event-mouse" // NAGA CHROMA

Which you have in your /dev/input
And the rest of the /dev/input entries seems ok to me. So at least the executable should work as expected. If it does not manage to get control of the device it will give you an error message, if it works it wil tell you "reading from...".

Let us know if you manage to fix it!

@c4tz
Copy link
Author

c4tz commented Apr 12, 2016

Okay, it seems to work if I just sudo naga.. The button mapping is working, too. :)

So it seems like nagastart.sh just crashes because of the two IDs and can not start the daemon because of this. A workaround for me would be to just put the right ID in it, should be 9 in this case, shouldn't it?

Also, another quick question as we're already at it: where are buttons 13 + 14?

@apocatarsis
Copy link
Collaborator

Glad to hear it!
Yeah, as every model appears different in xinput nagastart has to be a little hacky. You can replace nagastart with the lines in Usage with the correct id, find out wich one it is by trial and error I would say.

You can then put that lines in a script and create your own nagastart.sh, something like this:
xinput set-int-prop [id] "Device Enabled" 8 0
xinput set-button-map 2 1 2 3 4 5 6 7 11 10 8 9 13 14 15
naga

[id] would be 9 or 10 for you.
Keep in mind that the second line might not even be necessary, try without it first!.

If you manage to get it working please give us the lines so we can add it to the script!

As for the buttons, no idea, is a mess of buttons in my head. Could be the "lean left/right" thingy buttons in the scroll, or the forward/backward, or maybe just nothing.

Thanks for your feedback!

@c4tz
Copy link
Author

c4tz commented Apr 12, 2016

You meant:

xinput set-int-prop 11 "Device Enabled" 8 0
xinput set-button-map [id] 1 2 3 4 5 6 7 11 10 8 9 13 14 15
naga

right?

Yeah, the buttons just seem to be non-existant for me, or at least I cannot ctrl+z with any of mine ;)

@apocatarsis
Copy link
Collaborator

Yes yes you are right, sorry

Use xinput get-button-map [id2] to get info about the available buttons

@c4tz
Copy link
Author

c4tz commented Apr 12, 2016

Okay well it only works if I do sudo naga, it won't work without root access.

If I try do it without (what would happen at every boot), it tells me:

No naga devices found or you don't have permission to access them.

@Destroyer
Copy link
Collaborator

This should get around it(it's in install script) - maybe u need to reload udev rules or reboot.
echo 'KERNEL=="event[0-9]*",SUBSYSTEM=="input",GROUP="razer",MODE="640"' > /etc/udev/rules.d/80-naga.rules

If that still doesn't work you can just use sudo chmod 644 /dev/input/event{ID1,ID2} (where ID1 and ID2 are the devices you wanna listen to. Then you should be able to use naga without sudo.

(I'll reply in more detail when I'll be home)

@c4tz
Copy link
Author

c4tz commented Apr 12, 2016

It works almost, after a reboot.

But I think there still is a permission issue. When I try to start Firefox with (button 9), it tells me the dbus-service is not running. When I start it manually, everything is fine.

@Destroyer
Copy link
Collaborator

Interesting, that has never happened to me. The only thing the executable does after catching a key is this:
test.c

#include <stdio.h>
int main (void)
{
system("setsid firefox &");
return 0;
}

if you run gcc test.c -o test and then run ./test does it work?

@c4tz
Copy link
Author

c4tz commented Apr 12, 2016

test.c works without a flaw..

Maybe its because of the razer group?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants