jath03 / openrgb-python

A python client for the OpenRGB SDK
GNU General Public License v3.0
115 stars 22 forks source link

Crash when loading client #33

Closed subterfugium closed 3 years ago

subterfugium commented 3 years ago

Running openrgb in server mode

otto@pc:~$ openrgb -V
OpenRGB 0.6, for controlling RGB lighting.
  Version:       0.6
  Build Date         Tue, 15 Jun 2021 20:17:36 +0300
  Git Commit ID      
  Git Commit Date    
  Git Branch    

Importing client (installed via pip)

Python 3.9.6 (default, Jun 30 2021, 10:22:16) 
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import openrgb
>>> from openrgb import OpenRGBClient
>>> client = OpenRGBClient()
Traceback (most recent call last):
  File "/home/otto/.local/lib/python3.9/site-packages/openrgb/network.py", line 137, in read
    self.callback(device_id, packet_type, utils.ControllerData.unpack(data, self._protocol_version))
  File "/home/otto/.local/lib/python3.9/site-packages/openrgb/utils.py", line 547, in unpack
    metadata = MetaData.unpack(data, version)
  File "/home/otto/.local/lib/python3.9/site-packages/openrgb/utils.py", line 489, in unpack
    serial = parse_string(data)
  File "/home/otto/.local/lib/python3.9/site-packages/openrgb/utils.py", line 116, in parse_string
    return parse_var(f'{length}s', data).decode().rstrip('\x00')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/otto/.local/lib/python3.9/site-packages/openrgb/orgb.py", line 287, in __init__
    self.comms.requestDeviceNum()
  File "/home/otto/.local/lib/python3.9/site-packages/openrgb/network.py", line 188, in requestDeviceNum
    self.read()
  File "/home/otto/.local/lib/python3.9/site-packages/openrgb/network.py", line 116, in read
    self.callback(device_id, packet_type, buff[0])
  File "/home/otto/.local/lib/python3.9/site-packages/openrgb/orgb.py", line 302, in _callback
    self.comms.requestDeviceData(x)
  File "/home/otto/.local/lib/python3.9/site-packages/openrgb/network.py", line 181, in requestDeviceData
    self.read()
  File "/home/otto/.local/lib/python3.9/site-packages/openrgb/network.py", line 139, in read
    raise utils.ControllerParsingError(f"Unable to parse data from request `{packet_type}` for device #{device_id}") from e
openrgb.utils.ControllerParsingError: Unable to parse data from request `1` for device #3

List of devices

otto@pc:~$ openrgb -l
Attempting to connect to local OpenRGB server.
Connected to server
Network client listener started
Client: Received controller count from server: 6
Client: Requesting controller 0
Client: Requesting controller 1
Client: Requesting controller 2
Client: Requesting controller 3
Client: Requesting controller 4
Client: Requesting controller 5
Client: All controllers received, adding them to master list
Local OpenRGB server connected, running in client mode
0: ASUS Aura DRAM
  Type:           DRAM
  Description:    ASUS Aura SMBus Device
  Version:        DIMM_LED-0103
  Location:       I2C: /dev/i2c-1, address 0x72
  Modes: Direct Off Static Breathing Flashing 'Spectrum Cycle' [Rainbow] 'Chase Fade' Chase 'Random Flicker'
  Zones: Unknown
  LEDs: 'Unknown LED 1' 'Unknown LED 2' 'Unknown LED 3' 'Unknown LED 4' 'Unknown LED 5'

1: ASUS Aura DRAM
  Type:           DRAM
  Description:    ASUS Aura SMBus Device
  Version:        DIMM_LED-0103
  Location:       I2C: /dev/i2c-1, address 0x73
  Modes: Direct Off Static Breathing Flashing 'Spectrum Cycle' [Rainbow] 'Chase Fade' Chase 'Random Flicker'
  Zones: Unknown
  LEDs: 'Unknown LED 1' 'Unknown LED 2' 'Unknown LED 3' 'Unknown LED 4' 'Unknown LED 5'

2: B550 AORUS ELITE
  Type:           Motherboard
  Description:    IT5702-GIGABYTE V2.0.8.0
  Version:        0x00080002
  Location:       HID: /dev/hidraw0
  Serial:         0x57020100
  Modes: [Direct] Static Breathing Blinking 'Color Cycle' Flashing
  Zones: 'D_LED1 Bottom' 'D_LED2 Top' Motherboard
  LEDs: 'Back I/O' 'CPU Header' PCIe 'LED C1/C2'

3: Glorious Model D / D-
  Type:           Mouse
  Description:    Sinowealth Device
  Location:       HID: /dev/hidraw5
  Serial:         �//@/b//
  Modes: [Static] Off 'Glorious Mode' 'Seemless Breathing' Tail 'Spectrum Cycle' Rave Epilepsy Wave Breathing
  Zones: Mouse
  LEDs: 'Mouse LED'

4: Glorious Model D / D-
  Type:           Mouse
  Description:    Sinowealth Device
  Location:       HID: /dev/hidraw5
  Serial:         �//@/b//
  Modes: [Static] Off 'Glorious Mode' 'Seemless Breathing' Tail 'Spectrum Cycle' Rave Epilepsy Wave Breathing
  Zones: Mouse
  LEDs: 'Mouse LED'

5: Glorious Model D / D-
  Type:           Mouse
  Description:    Sinowealth Device
  Location:       HID: /dev/hidraw5
  Serial:         �//@/b//
  Modes: [Static] Off 'Glorious Mode' 'Seemless Breathing' Tail 'Spectrum Cycle' Rave Epilepsy Wave Breathing
  Zones: Mouse
  LEDs: 'Mouse LED'
jath03 commented 3 years ago

It looks like this was fixed this in this commit: https://gitlab.com/CalcProgrammer1/OpenRGB/-/commit/22acdd1fed976392698753b349b74233e8e319ed but it didn't make it in before the .6 release.

So, if you update OpenRGB to .61 (the latest pipeline), it should work.

BTW thank you @kamaaina for implementing that, it should prevent more of these type of issues from occurring after OpenRGB .7

jath03 commented 3 years ago

Also, for future reference, this is the exact same issue as #29, #18, and (possibly) #32.

subterfugium commented 3 years ago

I did only check open issues and to closed. Sorry for that. I will build latest openrgb and try again.

subterfugium commented 3 years ago

Yes it does work after compiling latest openrgb.