miskcoo / ugreen_leds_controller

An LED Controller for UGREEN's DX/DXP NAS Series
180 stars 26 forks source link

ugreen_leds_cli: Segmentation fault when turning on blink or breath for exactly 3 or 5 leds #24

Closed derandiunddasbo closed 2 months ago

derandiunddasbo commented 2 months ago

The ugreen_leds_cli command line tool crashes with a Segmentation fault, when turning on blink or breath for exactly three or five leds in one call. All other combinations seem to work fine:

root@proxmoxn2:/usr/local/bin# ugreen_leds_cli power netdev disk1 disk2 disk3 disk4 disk5 disk6 disk7 disk8 -blink 2000 50
root@proxmoxn2:/usr/local/bin# ugreen_leds_cli power netdev disk1 disk2 disk3 disk4 disk5 disk6 disk7 -blink 2000 50
root@proxmoxn2:/usr/local/bin# ugreen_leds_cli power netdev disk1 disk2 disk3 disk4 disk5 disk6 -blink 2000 50
root@proxmoxn2:/usr/local/bin# ugreen_leds_cli power netdev disk1 disk2 disk3 disk4 disk5 -blink 2000 50
root@proxmoxn2:/usr/local/bin# ugreen_leds_cli power netdev disk1 disk2 disk3 disk4 -blink 2000 50
root@proxmoxn2:/usr/local/bin# ugreen_leds_cli power netdev disk1 disk2 disk3 -blink 2000 50
Segmentation fault
root@proxmoxn2:/usr/local/bin# ugreen_leds_cli power netdev disk1 disk2 -blink 2000 50
root@proxmoxn2:/usr/local/bin# ugreen_leds_cli power netdev disk1 -blink 2000 50
Segmentation fault
root@proxmoxn2:/usr/local/bin# ugreen_leds_cli power netdev -blink 2000 50
root@proxmoxn2:/usr/local/bin# ugreen_leds_cli power -blink 2000 50
root@proxmoxn2:/usr/local/bin# ugreen_leds_cli netdev disk1 disk2 disk3 disk4 disk5 disk6 disk7 disk8 -blink 2000 50
root@proxmoxn2:/usr/local/bin# ugreen_leds_cli disk1 disk2 disk3 disk4 disk5 disk6 disk7 disk8 -blink 2000 50
root@proxmoxn2:/usr/local/bin# ugreen_leds_cli disk2 disk3 disk4 disk5 disk6 disk7 disk8 -blink 2000 50
root@proxmoxn2:/usr/local/bin# ugreen_leds_cli disk3 disk4 disk5 disk6 disk7 disk8 -blink 2000 50
root@proxmoxn2:/usr/local/bin# ugreen_leds_cli disk4 disk5 disk6 disk7 disk8 -blink 2000 50
Segmentation fault
root@proxmoxn2:/usr/local/bin# ugreen_leds_cli disk5 disk6 disk7 disk8 -blink 2000 50
root@proxmoxn2:/usr/local/bin# ugreen_leds_cli disk6 disk7 disk8 -blink 2000 50
Segmentation fault
root@proxmoxn2:/usr/local/bin# ugreen_leds_cli disk7 disk8 -blink 2000 50
root@proxmoxn2:/usr/local/bin# ugreen_leds_cli disk8 -blink 2000 50
root@proxmoxn2:/usr/local/bin# ugreen_leds_cli disk8 -blink 2000 50

The other commands (on, off, brightness) are working fine with any number of LEDs.

My device is a DXP2800 and yes, there are no disk3 to disk8 leds, but as the controller is the same for all UGreen NAS devices, it doesn't bother setting the light for non existent leds.

Just in case this may be related to the issue: The "blink" effect isn't working as expexted on a DXP2800. It does exactly the same as "breath", even the status is showing "breath" after using the "blink" argument:

root@proxmoxn2:/usr/local/bin# ugreen_leds_cli power -blink 2000 50
root@proxmoxn2:/usr/local/bin# ugreen_leds_cli power -status
power: status = breath, brightness = 255, color = RGB(255, 255, 255)
miskcoo commented 2 months ago

Fixed. You can download the release again.

The blink status should also work.

derandiunddasbo commented 2 months ago

Yes, it's working now. Thank you for the quick fix!