aaronwmorris / indi-allsky

Software to manage a Linux-based All Sky Camera.
GNU General Public License v3.0
245 stars 41 forks source link

Add support for QHY5III585 #1494

Closed cfmorrell closed 2 months ago

cfmorrell commented 2 months ago

I've got a QHY5III585 that's just laying around, so I'm trying to build it into an allsky system. I've followed the fxload instructions provided for the QHY 485 (changed values from 485 to 585), and am able to see the driver loaded with lsusb:

Bus 002 Device 002: ID 1618:0586 QHYCCD QHY585U3G20-20230914

I'm unable to connect to the camera through the indi server from Ekos on my Mac.

cfmorrell commented 2 months ago

Also, not sure if it's related, but creating the custom driver rule wasn't working for me:

sudo tee /etc/udev/rules.d/99-qhyccd_custom.rules <<EOF
ACTION!="add", GOTO="qhy_end_new"
SUBSYSTEM!="usb", GOTO="qhy_end_new"

ATTRS{idVendor}=="1618", ATTRS{idProduct}=="0585", ENV{LD_LIBRARY_PATH}="/usr/local/lib", RUN+="/usr/local/sbin/fxload -t fx3 -I /lib/firmware/qhy/QHY5III585.img -d 1618:0585”

ATTRS{idVendor}=="1618", MODE="0666"

LABEL="qhy_end_new"
EOF

so I had to load the driver manually:

sudo LD_LIBRARY_PATH=/usr/local/lib /usr/local/sbin/fxload -t fx3 -I /lib/firmware/qhy/QHY5III585.img -d 1618:0585

Which results in the above lsusb results.

aaronwmorris commented 2 months ago

It looks like you are mostly there. The udev rule may not go into effect until you reboot or reload the udev rules (I updated the wiki for this).

You may just need to restart the indiserver since the indiserver needs to start after the firmware is loaded. The indiserver does not support hotplugged devices.

systemctl --user restart indiserver
cfmorrell commented 2 months ago

I am close. Restarting the indiserver brought the camera up in indi-allsky.

I think that the only issue I'm having now is that the driver doesn't persist after a reboot, so if I load it manually and restart the indiserver, we're ok. I tested this with a couple of reboots to verify that the problem persists and manual intervention resolves it.

morrell@allsky:~ $ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 1618:0585 Cypress WestBridge
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
morrell@allsky:~ $ sudo LD_LIBRARY_PATH=/usr/local/lib /usr/local/sbin/fxload -t fx3 -I /lib/firmware/qhy/QHY5III585.img -d 1618:0585
microcontroller type: fx3
/lib/firmware/qhy/QHY5III585.img: type Cypress IMG format
open firmware image /lib/firmware/qhy/QHY5III585.img for RAM upload
normal FW binary executable image with checksum
FX3 bootloader version: 0x000000A9
writing image...
transfer execution to Program Entry at 0x400181b8
morrell@allsky:~ $ systemctl --user restart indiserver
morrell@allsky:~ $ lsusb
Bus 002 Device 002: ID 1618:0586 QHYCCD QHY585U3G20-20230914
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

So I'm assuming that there's something wrong with my udev custom rule, but I don't see anything.

ACTION!="add", GOTO="qhy_end_new"
SUBSYSTEM!="usb", GOTO="qhy_end_new"

ATTRS{idVendor}=="1618", ATTRS{idProduct}=="0585", ENV{LD_LIBRARY_PATH}="/usr/local/lib", RUN+="/usr/local/sbin/fxload -t fx3 -I /lib/firmware/qhy/QHY5III585.img -d 1618:0585”

ATTRS{idVendor}=="1618", MODE="0666"

LABEL="qhy_end_new"

any suggestions?

cfmorrell commented 2 months ago

Ugh. Unicode quotes...

I copy/pasted from a text editor that changed the final quote on line 4 in the custom rule. I fixed it directly in vim on the allsky machine and good to go.

aaronwmorris commented 2 months ago

Hah. I see now the end quote is different. Glad you got it figured out.

cfmorrell commented 2 months ago

Thanks for the help and the great tool.