summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2020-10-19 01:20:39 -0700
committeriximeow <me@iximeow.net>2020-10-19 01:20:39 -0700
commit34a8ba998986fbe696a41adb5eee36becba0831a (patch)
tree2213360af5611776bb6e757aab8f6376f3a90734
parentaf13b8c588ca7b5e4f761c4bd3baf03807e7d61b (diff)
teach load_firmware.py about different kinds of cameras
-rw-r--r--load_firmware.py26
1 files changed, 21 insertions, 5 deletions
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?")