Multiple users in https://github.com/polychromatic/polychromatic/issues/266 have reported this exception being thrown when attempting to draw a matrix using the Python library for the Razer Naga Trinity.
ERROR:dbus.connection:Unable to set arguments (b'\x00\x00\x02\x00\xff\x00\x00\x00\x00\x00\x00\x00',) according to signature None: <class 'ValueError'>: embedded null byte
Traceback (most recent call last):
File "step-through-matrix.py", line 40, in <module>
device.fx.advanced.draw()
File "/usr/lib/python3.8/site-packages/openrazer/client/fx.py", line 600, in draw
self._draw(bytes(self.matrix))
File "/usr/lib/python3.8/site-packages/openrazer/client/fx.py", line 592, in _draw
self._lighting_dbus.setKeyRow(ba)
File "/usr/lib/python3.8/site-packages/dbus/proxies.py", line 141, in __call__
return self._connection.call_blocking(self._named_service,
File "/usr/lib/python3.8/site-packages/dbus/connection.py", line 643, in call_blocking
message.append(signature=signature, *args)
ValueError: embedded null byte
To reproduce:
import openrazer.client as rclient
a = rclient.DeviceManager()
device = devman.devices[0] # Assume first device
device.fx.advanced.matrix[0, 0] = [0, 255, 0]
device.fx.advanced.draw()
Normally when a D-Bus method can't be found this exception gets thrown:
dbus.exceptions.UnknownMethodException: org.freedesktop.DBus.Error.UnknownMethod: Unknown method: hasMatrix is not a valid method of interface razer.device.misc
But for some reason it seems that when the we're trying to send binary data to a method but that method doesn't exist we get the exception
ValueError: embedded null byte
So actually the set_key_row method is missing from dbus - either driver has missing values or daemon has invalid HAS_MATRIX = True - the same seems to apply to other devices as well :(
A.k.a a bunch of devices that declare HAS_MATRIX = True don't actually have the set_key_row method and fail because of that. Technically this is also the same as #683 but the original issue there was that the daemon had a typo causing the set_key_row method not to be added to dbus
So, based on the fake driver, these devices are affected. These specify the capability lighting_led_matrix.
dbus.exceptions.UnknownMethodException: org.freedesktop.DBus.Error.UnknownMethod: Unknown method: setCustom is not a valid method of interface razer.device.lighting.chromaembedded null byteembedded null byteembedded null bytedbus.exceptions.UnknownMethodException: org.freedesktop.DBus.Error.UnknownMethod: Unknown method: setCustom is not a valid method of interface razer.device.lighting.chromaembedded null byteembedded null bytedbus.exceptions.UnknownMethodException: org.freedesktop.DBus.Error.UnknownMethod: Unknown method: setCustom is not a valid method of interface razer.device.lighting.chromaembedded null byteThe test script:
#!/usr/bin/python3
import openrazer.client
a = openrazer.client.DeviceManager()
for d in a.devices:
if d.has("lighting_led_matrix"):
d.fx.advanced.matrix[0,0] = [0,255,0]
try:
d.fx.advanced.draw()
except Exception as e:
print('\n~~~ ' + d.name + ' ~~~\n')
print(e)
@nightsky30 I'm pretty sure Razer Viper should support razer_chroma_extended_matrix_set_custom_frame with transaction id 0x1f and matrix dimensions [1, 1] (so index 0, 0 only). I'm guessing Viper Ultimate should be the same but I don't have packet captures for that device.
@z3ntu Don't have the Viper or Viper Ultimate, but do have the Mini. Here's a sample packet capture:
viper-mini_static_spectrum_static_spectrum_static.pcapng.zip
Does appear to be using transaction ID 0x1f. I imagine the other two would support the same.
@nightsky30 Okay could you please prepare a PR for these devices and add the neccessary methods to the driver & daemon?
Most helpful comment
So, based on the fake driver, these devices are affected. These specify the capability
lighting_led_matrix.dbus.exceptions.UnknownMethodException: org.freedesktop.DBus.Error.UnknownMethod: Unknown method: setCustom is not a valid method of interface razer.device.lighting.chromaembedded null byteembedded null byteembedded null bytedbus.exceptions.UnknownMethodException: org.freedesktop.DBus.Error.UnknownMethod: Unknown method: setCustom is not a valid method of interface razer.device.lighting.chromaembedded null byteembedded null bytedbus.exceptions.UnknownMethodException: org.freedesktop.DBus.Error.UnknownMethod: Unknown method: setCustom is not a valid method of interface razer.device.lighting.chromaembedded null byteThe test script: