]> mj.ucw.cz Git - ursary.git/blobdiff - nocturn.c
Nocturn: Do not write to a missing USB device
[ursary.git] / nocturn.c
index 510fb33590178118743bbef1252c382e7f7d4df0..158f1407df6f58e2915a8699f3d7e4390ce2e14b 100644 (file)
--- a/nocturn.c
+++ b/nocturn.c
@@ -229,9 +229,9 @@ static byte noct_button_light[16];
 static byte noct_ring_mode[8];         // RING_MODE_xxx
 static byte noct_ring_val[9];
 
-static uns noct_dirty_button;
-static uns noct_dirty_ring_mode;
-static uns noct_dirty_ring_val;
+static uint noct_dirty_button;
+static uint noct_dirty_ring_mode;
+static uint noct_dirty_ring_val;
 
 static struct libusb_transfer *noct_write_xfer;
 static bool noct_write_pending;
@@ -251,7 +251,7 @@ static void noct_write_done(struct libusb_transfer *xfer)
   noct_sched_write();
 }
 
-static void noct_do_write(uns cmd, uns arg)
+static void noct_do_write(uint cmd, uint arg)
 {
   DBG("USB: Submitting write %02x %02x", cmd, arg);
   ASSERT(!noct_write_pending);
@@ -270,7 +270,7 @@ static void noct_do_write(uns cmd, uns arg)
 
 static void noct_sched_write(void)
 {
-  if (noct_write_pending)
+  if (!usb_dev || noct_write_pending)
     return;
 
   if (noct_dirty_button)