Browse Source

Merge branch 'release' of https://tree.clementinecomputing.com/clementinecomputing/popufare into release

clementinecomputing 5 years ago
parent
commit
654e31b8ae
2 changed files with 21 additions and 7 deletions
  1. 1 1
      aux/deploy-busunit-interactive
  2. 20 6
      busunit/DIUv2/diu_main.c

+ 1 - 1
aux/deploy-busunit-interactive

@@ -123,7 +123,7 @@ read adddeps
 
 if [[ "$adddeps" =~ ^[yY]?$ ]]; then
 
-  deps="espeak mplayer git ppp ppp-dev sox alsa-utils unclutter fbi xinput-calibrator ffmpeg jq matchbox-window-manager libi2c-dev "
+  deps="espeak mplayer git ppp ppp-dev sox alsa-utils unclutter fbi xinput-calibrator ffmpeg jq matchbox-window-manager libi2c-dev socat "
 
   echo ""
   echo "  Installing: $deps"

+ 20 - 6
busunit/DIUv2/diu_main.c

@@ -556,7 +556,9 @@ message_callback_return handle_status_request(struct message_record *msg, void *
 }
 
 message_callback_return handle_vault_drop(struct message_record *msg, void *param) {
-  if(diu_fd >= 0) { write(diu_fd, "/V:\r", 4); }
+  if(diu_fd >= 0) {
+    write(diu_fd, "/V:\r", 4);
+  }
   return MESSAGE_HANDLED_CONT;
 }
 
@@ -1391,6 +1393,7 @@ static void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
 
 
 //DEBUG
+//
 void _test_ws(struct mg_mgr *mgr) {
   struct mg_connection *conn;
   char buf[_SLEN];
@@ -1531,7 +1534,7 @@ int main(int argc, char **argv) {
     //
     if((now - last_diu_clock) > 0) {
 
-      if(diu_fd) {
+      if (diu_fd>=0) {
         set_diu_clock(diu_fd, now);
         last_diu_clock = now;
       }
@@ -1592,8 +1595,15 @@ int main(int argc, char **argv) {
       //draw_menu(mt);
       //
       #ifdef TOUCHSCREEN_QUIET
-        write(diu_fd, "/Q:t\r", 5);    //Un-Quiet the touch screen, now that we've responded to the user we want
-      #endif                    //to hear if they have any further input to give us...
+
+      // to hear if they have any further input to give us...
+      // Un-Quiet the touch screen, now that we've responded to the user we want
+      //
+      if (diu_fd >= 0) {
+        write(diu_fd, "/Q:t\r", 5);
+      }
+
+      #endif
 
     }
 
@@ -1666,7 +1676,9 @@ int main(int argc, char **argv) {
         if(fds[i].revents & (POLLHUP | POLLERR | POLLNVAL)) {
           fprintf(stderr, "This is very odd... Poll returned flags %d on our serial port...\n", fds[i].revents);
 
-          close(diu_fd);
+          if (diu_fd >= 0) {
+            close(diu_fd);
+          }
           diu_fd = -1;
           break;
         }
@@ -1810,7 +1822,9 @@ int main(int argc, char **argv) {
           else {
             fprintf(stderr, "Read from %s returned %d!\n", DRIVER_UI_PORT, read_return);
 
-            close(diu_fd);
+            if (diu_fd >= 0) {
+              close(diu_fd);
+            }
             diu_fd = -1;
             break;
           }