From 34a8ba998986fbe696a41adb5eee36becba0831a Mon Sep 17 00:00:00 2001 From: iximeow Date: Mon, 19 Oct 2020 01:20:39 -0700 Subject: teach load_firmware.py about different kinds of cameras --- load_firmware.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'load_firmware.py') diff --git a/load_firmware.py b/load_firmware.py index 1e3015f..f038ad7 100644 --- a/load_firmware.py +++ b/load_firmware.py @@ -3,6 +3,21 @@ import os import subprocess import time +CAMERA_NAMES = { + "qhy367c": { + "image": "QHY367.img", + "device_id": "1618:c367", + "active_id": "1618:c368" + }, + "qhy600m": { + "image": "QHY600.img", + "device_id": "1618:c600", + "active_id": "1618:c601" + }, +} + +PARAMETERS = CAMERA_NAMES["qhy600m"] + def get_path(dev_id): if len(dev_id) != 9: raise Exception("Invalid device id: {}. Expected a string 9 characters long (ex: aaaa:bbbb)".format(dev_id)) @@ -26,7 +41,7 @@ def fix_perms(camera_path): print("Fixing permissions..") os.system("sudo chown iximeow:iximeow {}".format(camera_path)) -camera_path = get_path("1618:c367") +camera_path = get_path(PARAMETERS["device_id"]) if camera_path == None: print("couldn't find the camera, firmware may have been loaded already?") @@ -34,23 +49,24 @@ if camera_path == None: fix_perms(camera_path) -fxload_binary = "./sdks/LINUX_X64_qhyccd_V20190628_0/sbin/fxload" +# fxload_binary = "./sdks/LINUX_X64_qhyccd_V20190628_0/sbin/fxload" +fxload_binary = "./sdks/sdk_linux64_20.07.26/sbin/fxload" fw_cmd = "{} -t fx3 -I firmware/qhy/{} -D {}".format( fxload_binary, - "QHY367.img", + PARAMETERS["image"], camera_path ) print(fw_cmd) fw_load = subprocess.check_output([ - fxload_binary, '-t', 'fx3', '-I', 'firmware/qhy/{}'.format("QHY367.img"), '-D', camera_path]) + fxload_binary, '-t', 'fx3', '-I', 'firmware/qhy/{}'.format(PARAMETERS["image"]), '-D', camera_path]) print(fw_load) time.sleep(1) -path = get_path("1618:c368") +path = get_path(PARAMETERS["active_id"]) if path == None: print("couldn't find camera id after loading firmware. did the camera die?") -- cgit v1.1