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

Fix persistence for devices with UNKWN00000000xxxx serial number #2220

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vcelarde
Copy link

  • Replace randomly generated (UNKWN00000000xxxx) serial number for unknown devices (Default string, etc.) with a serial number generated by the unique device ID in the last element of the device path. This way the device will always get the same (unique) serial number and persistence will work correctly.
  • Original version worked fine, but since serial number was randomly generated on each startup, persistence did not work and the persistence.conf file fills up with settings from all the randomly generated serial numbers over time.

…own devices (Default string, etc.) with a serial number generated by the unique device ID in the last element of the device path. This way the device will always get the same (unique) serial number and persistence will work correctly.
@z3ntu
Copy link
Member

z3ntu commented Apr 4, 2024

Are you sure the serial numbers are consistent?

2024-04-04 21:20:53 | razer.device2                  | INFO     | Initialising device.2 RazerMambaElite
ERROR:root:random serial! 00031532006C0004

I unplugged and replugged the usb hub where my devices are connected and then the serial was different

2024-04-04 21:21:38 | razer.device2                  | INFO     | Initialising device.2 RazerMambaElite
ERROR:root:random serial! 00031532006C0010

("error" logging is added by me, diff attached)

diff --git a/daemon/openrazer_daemon/hardware/device_base.py b/daemon/openrazer_daemon/hardware/device_base.py
index 635f694b..fa332a01 100644
--- a/daemon/openrazer_daemon/hardware/device_base.py
+++ b/daemon/openrazer_daemon/hardware/device_base.py
@@ -974,8 +974,9 @@ class RazerDevice(DBusService):
                     time.sleep(0.1)
                     self.logger.debug('getting serial: {0} count:{1}'.format(serial, count))
 
-            if serial == '' or serial == 'Default string' or serial == 'empty (NULL)' or serial == 'As printed in the D cover':
-                serial = "".join([i for i in os.path.basename(self._device_path) if i.isalnum()])
+            #if serial == '' or serial == 'Default string' or serial == 'empty (NULL)' or serial == 'As printed in the D cover':
+            serial = "".join([i for i in os.path.basename(self._device_path) if i.isalnum()])
+            logging.error("random serial! " + str(serial))
 
             self._serial = serial.replace(' ', '_')
 

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

Successfully merging this pull request may close these issues.

None yet

2 participants