pez2001 / razer_chroma_drivers

A collection of Linux drivers for Razer Chroma devices, it supports all lighting modes and includes a daemon for advanced effects + gui configuration app
GNU General Public License v2.0
231 stars 30 forks source link

Added stealth and mamba to daemon #108

Closed terricain closed 8 years ago

terricain commented 8 years ago

@storborg @laxdragon And anyone else with a mamba or razer stealth

Can you test these changes

Then using the Python library or a GUI to interface with DBus to check the devices

import razer.daemon_dbus
import razer.keyboard
daemon = razer.daemon_dbus.DaemonInterface()
daemon.enumerate_devices()

Should output all razer devices the daemon knows about - and should now list the mamba or stealth

smevawala commented 8 years ago

Ill check this in a few hours for the stealth

terricain commented 8 years ago

Thanks ;). Haven't fixed the boot scripts but I don't want to touch them until I get back to my setup where I can actually test things. cba doing it over ssh.

I would suggest making sure the devices are binded to the driver (though udev should do this properly) and then run the daemon manually (as root). I wouldn't suggest installing it properly yet.

storborg commented 8 years ago

I got this:

Python 2.7.11+ (default, Mar 30 2016, 21:00:42) 
[GCC 5.3.1 20160330] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import razer
>>> import razer.daemon_dbus
razer/keyboard.py:5: PyGIWarning: Gdk was imported without specifying a version first. Use gi.require_version('Gdk', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import Gdk
>>> import razer.keyboard
>>> daemon = razer.daemon_dbus.DaemonInterface()
Successfully connected to dbus service.
>>> daemon.enumerate_devices()
Device ID 0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "razer/daemon_dbus.py", line 69, in enumerate_devices
    device_serial = self.dbus_daemon_controls.serial()
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__
    **keywords)
  File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying

The only razer_bcd messages in syslog are:

Apr  4 10:44:49 hedy razer_bcd[22426]:  * Starting Razer Keyboard daemon razer_bcd
Apr  4 10:44:49 hedy razer_bcd[22426]: Starting razer blackwidow chroma daemon as a daemon
Apr  4 10:44:49 hedy razer_bcd[22426]:    ...done.
terricain commented 8 years ago

Firstly use Python3, and did the getting of the serial work on the driver for getting the serial of the stealth?

terricain commented 8 years ago

Changed it so that looks for the name first if the getting of the serial doesnt work. Also using ps ensure the daemon is still alive? (I'd kill it before each test though)

GovanifY commented 8 years ago

govanify@sentora:~/Documents/PROJECTS/PROGRAMMING/SOFTWARES/razer_drivers$ sudo python3 test_mamba.py Failed to connect to the dbus service. Is the razer_bcd service running?

Scripts running directly with driver works. Daemon does not for some weird reasons

storborg commented 8 years ago

Getting the serial number via get_serial doesn't work (unless my serial number is actually all FFs). If there is a way to get the serial number in Synapse I can try and capture that. Couldn't it just use the vid/pid to identify device types anyways?

Daemon works fine for getting the device type:

>>> daemon.enumerate_devices()
Device ID 0
Device Type "Razer Blade Stealth"
Device Serial "
"
[{'type': dbus.String('Razer Blade Stealth'), 'index': 0, 'serial': dbus.String('\n')}]
storborg commented 8 years ago

Or is the serial number just used so that you can persistently target specific devices in higher level code?

terricain commented 8 years ago

@storborg Yes that's what I want to see. And the idea was that even though its unlikely there could be multiple keyboards plugged in and you would have no idea of identifying them.

And yes to what you said. Be careful with this daemon as it has absolutely no clue what device is attached to it and will attempt to perform functions on devices that don't exist if told to do so (this is why I want to make a python daemon that does multidevice well).

One annoyance was that I found it extremely difficult to find the serial in synapse (though it appeared when it asks you to register warranty) but I knew it was in there and it took me ages to get the USB capture of it.

Does the daemon do the lighting effect on your keyboard?

@GovanifY have you manually ran the driver using the code from this pull request? and as sudo? I can test the mamba after me holidays as thats a device I do have.

GovanifY commented 8 years ago

Ok nevermind the daemon is just misinstalled on my comp'. Made a fresh re-install and all was working fine

Successfully connected to dbus service. Device ID 0 Device Type "Razer Mamba", Device Serial "PM1548136706792"

terricain commented 8 years ago

:) nice nice, will merge this then.

All bear in mind the GUI doesn't know how to handle multiple devices and I think will assume everything is a BlackWidow Chroma

laxdragon commented 8 years ago

I noticed that the Mamba TE has a device id of 0046 not 45. I changed that in the patch you provided, but didn't seem to change much. Now restarting razer_bcd briefly sets all the devices to a static color, but then they revert to a non animated spectrum several seconds later.

terricain commented 8 years ago

@laxdragon Not sure what would cause that, do they all go green?

laxdragon commented 8 years ago

Yep, all green. log:

Apr 4 13:26:02 jnewman systemd_helpers.sh[3062]: Unbinding device (0003:1532:0203.0003) from hid-generic Apr 4 13:26:02 jnewman systemd_helpers.sh[3062]: Binding device (0003:1532:0203.0003) to razerkbd Apr 4 13:26:02 jnewman systemd_helpers.sh[3062]: Bind Successful Apr 4 13:26:02 jnewman kernel: [ 851.336745] input: Razer Razer BlackWidow Chroma as /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3:1.2/0003:1532:0203.0003/input/input47 Apr 4 13:26:02 jnewman kernel: [ 851.336850] razerkbd 0003:1532:0203.0003: input,hidraw2: USB HID v1.11 Mouse [Razer Razer BlackWidow Chroma] on usb-0000:00:14.0-3/input2 Apr 4 13:26:02 jnewman systemd_helpers.sh[3062]: Unbinding device (0003:1532:0C00.000C) from hid-generic Apr 4 13:26:02 jnewman systemd_helpers.sh[3062]: Binding device (0003:1532:0C00.000C) to razerfirefly Apr 4 13:26:02 jnewman kernel: [ 851.365689] input: Razer Razer Firefly as /devices/pci0000:00/0000:00:1c.3/0000:04:00.0/usb5/5-2/5-2.4/5-2.4:1.0/0003:1532:0C00.000C/input/input48 Apr 4 13:26:02 jnewman kernel: [ 851.365921] razerfirefly 0003:1532:0C00.000C: input,hidraw11: USB HID v1.11 Mouse [Razer Razer Firefly] on usb-0000:04:00.0-2.4/input0 Apr 4 13:26:02 jnewman systemd_helpers.sh[3062]: Bind Successful Apr 4 13:26:02 jnewman razer_bcd[3129]: Starting razer blackwidow chroma daemon as a daemon

Looks like razermouse module is loaded, but /proc shows the following:

`jnewman@jnewman:~/Working/GIT/razer_chroma_drivers$ ls -l /sys/bus/hid/drivers/razer* /sys/bus/hid/drivers/razerfirefly: total 0 lrwxrwxrwx 1 root root 0 Apr 4 13:27 0003:1532:0C00.000C -> ../../../../devices/pci0000:00/0000:00:1c.3/0000:04:00.0/usb5/5-2/5-2.4/5-2.4:1.0/0003:1532:0C00.000C --w------- 1 root root 4096 Apr 4 13:26 bind lrwxrwxrwx 1 root root 0 Apr 4 13:14 module -> ../../../../module/razerfirefly --w------- 1 root root 4096 Apr 4 13:14 new_id --w------- 1 root root 4096 Apr 4 13:14 uevent --w------- 1 root root 4096 Apr 4 13:25 unbind

/sys/bus/hid/drivers/razerkbd: total 0 lrwxrwxrwx 1 root root 0 Apr 4 13:27 0003:1532:0203.0003 -> ../../../../devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3:1.2/0003:1532:0203.0003 --w------- 1 root root 4096 Apr 4 13:26 bind lrwxrwxrwx 1 root root 0 Apr 4 13:14 module -> ../../../../module/razerkbd --w------- 1 root root 4096 Apr 4 13:14 new_id --w------- 1 root root 4096 Apr 4 13:14 uevent --w------- 1 root root 4096 Apr 4 13:25 unbind

/sys/bus/hid/drivers/razermouse: total 0 --w------- 1 root root 4096 Apr 4 13:12 bind lrwxrwxrwx 1 root root 0 Apr 4 13:12 module -> ../../../../module/razermouse --w------- 1 root root 4096 Apr 4 13:12 new_id --w------- 1 root root 4096 Apr 4 13:12 uevent --w------- 1 root root 4096 Apr 4 13:12 unbind `

terricain commented 8 years ago

Will continue the mamba discussion on an issues thread. Shall leave the pull request open as might fix things for that

terricain commented 8 years ago

Added Mamba TE to daemon etc...

smevawala commented 8 years ago

Confirming that the daemon and gui works with the stealth :)

terricain commented 8 years ago

Btw it only works as there is only the stealth plugged in ;)