Преглед на файлове

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

clementinecomputing преди 6 години
родител
ревизия
51fccc7951

+ 7 - 1
busunit/client_supervisor/client_supervisor.c

@@ -305,6 +305,10 @@ void monitor_system_status()
     }
 }
 
+void send_heartbeat() {
+  route_debug_message("heartbeat\n");
+}
+
 int launch_module(int n)
 {
     pid_t fork_ret;
@@ -969,6 +973,8 @@ int main(int argc, char **argv)
         if( (time(NULL) - last_system_stat) >= SUPERVISOR_SYSTEM_STAT_INTERVAL)
         {
             monitor_system_status();
+
+            send_heartbeat();
             
             last_system_stat = time(NULL);
         }
@@ -1099,7 +1105,7 @@ int main(int argc, char **argv)
             
                 if(fds[i].fd == module_status[modnum].stdout_fd)
                 {
-                     route_debug_message("%s [%d]: %s", module_name[modnum], (int)module_status[modnum].pid, linebuffer);
+                     //route_debug_message("%s [%d]: %s", module_name[modnum], (int)module_status[modnum].pid, linebuffer);
                 }
                 else if(fds[i].fd == module_status[modnum].stderr_fd)
                 {

+ 5 - 5
busunit/common/common_config.h

@@ -398,14 +398,14 @@
 //This defines the expected size of the pass database and its RAM based index tables:
 //
 
-#define NUM_STORED_PASSES  (131072)  //A nice round number that multiplies by sizeof(rider_record) to a page boundary
-#define STORED_PASS_HASH  (131101)  //A prime number larger than NUM_STORED_PASSES
+//#define NUM_STORED_PASSES  (131072)  //A nice round number that multiplies by sizeof(rider_record) to a page boundary
+//#define STORED_PASS_HASH  (131101)  //A prime number larger than NUM_STORED_PASSES
 
 //#define NUM_STORED_PASSES  (262144)  //A nice round number that multiplies by sizeof(rider_record) to a page boundary
 //#define STORED_PASS_HASH  (262147)  //A prime number larger than NUM_STORED_PASSES
 
-//#define NUM_STORED_PASSES  (1048576)  //A nice round number that multiplies by sizeof(rider_record) to a page boundary
-//#define STORED_PASS_HASH  (1048583)  //A prime number larger than NUM_STORED_PASSES
+#define NUM_STORED_PASSES  (1048576)  //A nice round number that multiplies by sizeof(rider_record) to a page boundary
+#define STORED_PASS_HASH  (1048583)  //A prime number larger than NUM_STORED_PASSES
 
 //This defines the expected size of the billing cache:
 
@@ -516,7 +516,7 @@
 #endif
 
 //Which types of log entries should be sent to the server via the billing log?
-//#define SUPERVISOR_LOG_DEBUG_TO_BILLDB
+#define SUPERVISOR_LOG_DEBUG_TO_BILLDB
 #define SUPERVISOR_LOG_WARNING_TO_BILLDB
 #define SUPERVISOR_LOG_ERROR_TO_BILLDB
 

+ 59 - 21
busunit/passdb/pass_communication.c

@@ -185,27 +185,32 @@ int connect_to_pass_server()
   return fd;
 }
 
-int do_database_flush(passdb_context *ctx)
-{
-        int retval;
-
-        //Detach from the current pass database
-        detach_from_passdb(ctx);
-        //Format a new database file...
-        format_new_passdb();
-
-        retval = attach_to_passdb(ctx);
-
-        if( DB_FAIL(retval) )  //If we fail to attach to our new database
-        {
-            fprintf(stderr, "Error (%d) attaching to pass database during flush attempt\n", retval);  //report failure
-            return retval;
-        }
-        else  //Otherwise, report success.
-        {
-            printf("Pass database flushed!\n");
-            return 0;
-        }
+int do_database_flush(passdb_context *ctx) {
+  int retval;
+
+  // Detach from the current pass database
+  //
+  detach_from_passdb(ctx);
+
+  // Format a new database file...
+  //
+  format_new_passdb();
+
+  retval = attach_to_passdb(ctx);
+
+  // If we fail to attach to our new database
+  //
+  if( DB_FAIL(retval) ) {
+    fprintf(stderr, "Error (%d) attaching to pass database during flush attempt\n", retval);  //report failure
+    return retval;
+  }
+
+  // Otherwise, report success.
+  //
+  else {
+    printf("Pass database flushed!\n");
+    return 0;
+  }
 }
 
 int send_query_message(int fd, passdb_context *ctx)
@@ -640,6 +645,8 @@ int do_zflush(passdb_context *ctx, void *data, int len)
 
 //    printf("do_zflush(%p, %p, %d)\n", ctx, data, len);
 
+    memset(&incoming_msg, 0, sizeof(struct message_record));
+
     retval = inflateInit(&foo);
 
     if(retval != Z_OK)
@@ -996,6 +1003,29 @@ void maintain_ipc_hub_connect(char *progname)
     }
 }
 
+int passdb_context_alloc(passdb_context *ctx) {
+  ctx->logical_card_id_hash = (rider_node **)malloc(sizeof(rider_node *)*STORED_PASS_HASH);
+  if (!(ctx->logical_card_id_hash)) { return -1; }
+
+  ctx->rider_mag_hash = (rider_node **)malloc(sizeof(rider_node *)*STORED_PASS_HASH);
+  if (!(ctx->rider_mag_hash)) { return -1; }
+
+  ctx->rider_rf_hash = (rider_node **)malloc(sizeof(rider_node *)*STORED_PASS_HASH);
+  if (!(ctx->rider_rf_hash)) { return -1; }
+
+  memset(ctx->logical_card_id_hash, 0, sizeof(rider_node **)*STORED_PASS_HASH);
+  memset(ctx->rider_mag_hash, 0, sizeof(rider_node **)*STORED_PASS_HASH);
+  memset(ctx->rider_rf_hash, 0, sizeof(rider_node **)*STORED_PASS_HASH);
+
+  return 0;
+}
+
+void passdb_context_dealloc(passdb_context *ctx) {
+  if (ctx->logical_card_id_hash)  { free(ctx->logical_card_id_hash); }
+  if (ctx->rider_mag_hash)        { free(ctx->rider_mag_hash); }
+  if (ctx->rider_rf_hash)         { free(ctx->rider_rf_hash); }
+}
+
 int main(int argc, char **argv)
 {
     struct pollfd fds[2];
@@ -1013,6 +1043,13 @@ int main(int argc, char **argv)
 
     passdb_context ctx = {0};
 
+    passdb_context_alloc(&ctx);
+
+    //------------------
+
+    memset(input_line, 0, sizeof(char)*LINE_BUFFER_SIZE);
+    memset(&incoming_msg, 0, sizeof(struct message_record));
+
     //------------------
 
     configure_signal_handlers(argv[0]);
@@ -1395,6 +1432,7 @@ int main(int argc, char **argv)
 
     printf("Detatching from Pass Database\n");
     detach_from_passdb(&ctx);
+    passdb_context_dealloc(&ctx);
 
     printf("Closing connections\n");
     if(server_fd >= 0)

+ 42 - 23
busunit/passdb/passdb.c

@@ -365,36 +365,55 @@ int format_new_passdb()
     return 0;
 }
 
-int detach_from_passdb(passdb_context *ctx)
-{
-    int i;
 
-    if(!ctx)
-      return FAIL_PARAM;
+int detach_from_passdb(passdb_context *ctx) {
+  int i;
 
-    free_rider_node_list(ctx->freelist);
-    free_rider_node_list(ctx->activelist);
+  if(!ctx) {
+    return FAIL_PARAM;
+  }
 
-    for(i=0; i < STORED_PASS_HASH; i++)
-    {
-        free_rider_node_list(ctx->logical_card_id_hash[i]);
-        free_rider_node_list(ctx->rider_mag_hash[i]);
-        free_rider_node_list(ctx->rider_rf_hash[i]);
-    }
+  free_rider_node_list(ctx->freelist);
+  free_rider_node_list(ctx->activelist);
 
-    if(ctx->riders != NULL)
-    {
-        munmap(ctx->riders, PASS_MAP_SIZE);
-    }
+  for(i=0; i < STORED_PASS_HASH; i++) {
+    free_rider_node_list(ctx->logical_card_id_hash[i]);
+    free_rider_node_list(ctx->rider_mag_hash[i]);
+    free_rider_node_list(ctx->rider_rf_hash[i]);
+  }
 
-    if(ctx->mmap_broken)
-    {
-        close(ctx->passes_fd);
-    }
+  if(ctx->riders != NULL) {
+    munmap(ctx->riders, PASS_MAP_SIZE);
+  }
 
-    memset(ctx, 0, sizeof(passdb_context));
+  if(ctx->mmap_broken) {
+    close(ctx->passes_fd);
+  }
 
-    return 0;
+  //memset(ctx, 0, sizeof(passdb_context));
+
+  // explicitely zero out fields
+  //
+  ctx->riders = NULL;
+  ctx->freelist = NULL;
+  ctx->activelist = NULL;
+  ctx->seq = 0;
+  ctx->mmap_broken = 0;
+  ctx->passes_fd = 0;
+
+  if (ctx->logical_card_id_hash) {
+    memset(ctx->logical_card_id_hash, 0, sizeof(rider_node *)*STORED_PASS_HASH);
+  }
+
+  if (ctx->rider_mag_hash) {
+    memset(ctx->rider_mag_hash, 0, sizeof(rider_node *)*STORED_PASS_HASH);
+  }
+
+  if (ctx->rider_rf_hash) {
+    memset(ctx->rider_rf_hash, 0, sizeof(rider_node *)*STORED_PASS_HASH);
+  }
+
+  return 0;
 }
 
 int attach_to_passdb(passdb_context *ctx)

+ 16 - 12
busunit/passdb/passdb.h

@@ -2,17 +2,17 @@
  * Copyright (c) 2019 Clementine Computing LLC.
  *
  * This file is part of PopuFare.
- * 
+ *
  * PopuFare is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
- * 
+ *
  * PopuFare is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU Affero General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU Affero General Public License
  * along with PopuFare.  If not, see <https://www.gnu.org/licenses/>.
  *
@@ -35,12 +35,12 @@ typedef struct rider_record_struct
 {
     seq_t seq;				//sequence number
     logical_card_id_t  id;			//rider ID
-      
+
     char magstripe_value[CREDENTIAL_LEN];
     char rfid_value[CREDENTIAL_LEN];
-    
+
     char rule_name[RULENAME_LEN];
-    char rule_param[PARAM_LEN];    
+    char rule_param[PARAM_LEN];
 
 } rider_record;
 
@@ -55,14 +55,18 @@ typedef struct rider_node_struct
 typedef struct passdb_context_struct
 {
   rider_record *riders;
-  
+
   rider_node *freelist;
   rider_node *activelist;
-  
-  rider_node *logical_card_id_hash[STORED_PASS_HASH];
-  rider_node *rider_mag_hash[STORED_PASS_HASH];
-  rider_node *rider_rf_hash[STORED_PASS_HASH];
-  
+
+  //rider_node *logical_card_id_hash[STORED_PASS_HASH];
+  //rider_node *rider_mag_hash[STORED_PASS_HASH];
+  //rider_node *rider_rf_hash[STORED_PASS_HASH];
+
+  rider_node **logical_card_id_hash;
+  rider_node **rider_mag_hash;
+  rider_node **rider_rf_hash;
+
   seq_t seq;
 
   //THESE ARE USED IF MMAP IS DETERMINED TO BE BROKEN...

+ 53 - 0
busunit/ppp-dialer/etc/ppp/ip-down

@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# This script is run by the pppd _after_ the link is brought down.
+# It uses run-parts to run scripts in /etc/ppp/ip-down.d, so to delete
+# routes, unset IP addresses etc. you should create script(s) there.
+#
+# Be aware that other packages may include /etc/ppp/ip-down.d scripts (named
+# after that package), so choose local script names with that in mind.
+#
+# This script is called with the following arguments:
+#    Arg  Name                          Example
+#    $1   Interface name                ppp0
+#    $2   The tty                       ttyS1
+#    $3   The link speed                38400
+#    $4   Local IP number               12.34.56.78
+#    $5   Peer  IP number               12.34.56.99
+#    $6   Optional ``ipparam'' value    foo
+
+# The  environment is cleared before executing this script
+# so the path must be reset
+PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
+export PATH
+
+# These variables are for the use of the scripts run by run-parts
+PPP_IFACE="$1"
+PPP_TTY="$2"
+PPP_SPEED="$3"
+PPP_LOCAL="$4"
+PPP_REMOTE="$5"
+PPP_IPPARAM="$6"
+export PPP_IFACE PPP_TTY PPP_SPEED PPP_LOCAL PPP_REMOTE PPP_IPPARAM
+
+# as an additional convenience, $PPP_TTYNAME is set to the tty name,
+# stripped of /dev/ (if present) for easier matching.
+PPP_TTYNAME=`/usr/bin/basename "$2"`
+export PPP_TTYNAME 
+
+# If /var/log/ppp-ipupdown.log exists use it for logging.
+if [ -e /var/log/ppp-ipupdown.log ]; then
+  exec >> /var/log/ppp-ipupdown.log 2>&1
+  echo $0 $@
+  echo
+fi
+
+# This script can be used to override the .d files supplied by other packages.
+if [ -x /etc/ppp/ip-down.local ]; then
+  exec /etc/ppp/ip-down.local "$@"
+fi
+
+run-parts /etc/ppp/ip-down.d \
+  --arg="$1" --arg="$2" --arg="$3" --arg="$4" --arg="$5" --arg="$6"
+
+/bin/rm -f /tmp/network-is-up

+ 3 - 0
busunit/ppp-dialer/etc/ppp/ip-down.d/ridelogic

@@ -0,0 +1,3 @@
+#!/bin/bash
+
+/bin/rm -f /tmp/network-is-up

+ 60 - 0
busunit/ppp-dialer/etc/ppp/ip-up

@@ -0,0 +1,60 @@
+#!/bin/sh
+#
+# This script is run by the pppd after the link is established.
+# It uses run-parts to run scripts in /etc/ppp/ip-up.d, so to add routes,
+# set IP address, run the mailq etc. you should create script(s) there.
+#
+# Be aware that other packages may include /etc/ppp/ip-up.d scripts (named
+# after that package), so choose local script names with that in mind.
+#
+# This script is called with the following arguments:
+#    Arg  Name                          Example
+#    $1   Interface name                ppp0
+#    $2   The tty                       ttyS1
+#    $3   The link speed                38400
+#    $4   Local IP number               12.34.56.78
+#    $5   Peer  IP number               12.34.56.99
+#    $6   Optional ``ipparam'' value    foo
+
+# The  environment is cleared before executing this script
+# so the path must be reset
+PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
+export PATH
+
+# These variables are for the use of the scripts run by run-parts
+PPP_IFACE="$1"
+PPP_TTY="$2"
+PPP_SPEED="$3"
+PPP_LOCAL="$4"
+PPP_REMOTE="$5"
+PPP_IPPARAM="$6"
+export PPP_IFACE PPP_TTY PPP_SPEED PPP_LOCAL PPP_REMOTE PPP_IPPARAM
+
+# as an additional convenience, $PPP_TTYNAME is set to the tty name,
+# stripped of /dev/ (if present) for easier matching.
+PPP_TTYNAME=`/usr/bin/basename "$2"`
+export PPP_TTYNAME 
+
+# If /var/log/ppp-ipupdown.log exists use it for logging.
+if [ -e /var/log/ppp-ipupdown.log ]; then
+  exec > /var/log/ppp-ipupdown.log 2>&1
+  echo $0 $@
+  echo
+fi
+
+# This script can be used to override the .d files supplied by other packages.
+if [ -x /etc/ppp/ip-up.local ]; then
+  exec /etc/ppp/ip-up.local "$@"
+fi
+
+run-parts /etc/ppp/ip-up.d \
+  --arg="$1" --arg="$2" --arg="$3" --arg="$4" --arg="$5" --arg="$6"
+
+# if pon was called with the "quick" argument, stop pppd
+if [ -e /var/run/ppp-quick ]; then
+  rm /var/run/ppp-quick
+  wait
+  kill $PPPD_PID
+fi
+
+/bin/touch /tmp/network-is-up

+ 3 - 0
busunit/ppp-dialer/etc/ppp/ip-up.d/ridelogic

@@ -0,0 +1,3 @@
+#!/bin/bash
+
+/bin/touch /etc/network-is-up

+ 12 - 12
busunit/scripts/connection_tether-ppp.sh

@@ -18,7 +18,11 @@
 # along with PopuFare.  If not, see <https://www.gnu.org/licenses/>.
 #
 
-. $HOME/bin/common_values.sh 
+export BASEDIR='/home/bus/'
+
+echo "## connection_tether-ppp $BASEDIR"
+
+. $BASEDIR/bin/common_values.sh
 
 # Do this once at boot time, but do it again after a tunnel abort request...
 #
@@ -80,16 +84,16 @@ perform_post_connect_checkin()
   imsi="`output_net_ids_field IMSI`"
   mac="`output_net_ids_field ETH0`"
 
-  #     Send these gathered data to the update daemon.  The leading '#' tells the server that this is a 
+  #     Send these gathered data to the update daemon.  The leading '#' tells the server that this is a
   #checkin, not an update request.
-  echo -e "#$busunitnum\t$equipnum\t$mac\t$imei\t$imsi\t$version" | nc localhost $UPDATE_DAEMON_PORT
+  echo -e "#$busunitnum\t$equipnum\t$mac\t$imei\t$imsi\t$version" | nc -q1 localhost $UPDATE_DAEMON_PORT
 }
 
 #    This function generates the server->client port forwards to allow a sysadmin to log into any unit that is on
 # the network by equipment number, serial number, or bus number. The three parameters are:
 #
 # 1:   The path to the file containing the identifying number
-# 2:   The base port number on the remote server to add the identifying number to to get the server-side port that will 
+# 2:   The base port number on the remote server to add the identifying number to to get the server-side port that will
 #    forward to port 22 (sshd) on the client side.
 # 3:   An optional parameter which if present is taken as a set of command line flags to cut to apply to the contents
 #    of the file specified by $1 to extract the numeric component (for instance, serial numbers may be in the form XYZ-1234
@@ -108,7 +112,7 @@ generate_reverse_phonehome_component()
       #Grab the desired substring
       num="`cat $file | cut $cut_cmdline`"
     else
-      #Grab its contents   
+      #Grab its contents
       num="`cat $file`";
     fi
 
@@ -162,7 +166,7 @@ clean_up_after_tunnel_teardown()
     #Sleep until it is time to try again
     /bin/sleep $SLEEP_AFTER_TUNNEL_ABORT
 
-    
+
   else
     #OTHERWISE, we assume that the modem lost signal, or the router or remote server went wonky...
 
@@ -180,7 +184,7 @@ clean_up_after_tunnel_teardown()
     debug_print "Sleeping before any retry attempts..."
     #Sleep before trying this again...
     /bin/sleep $SLEEP_AFTER_TUNNEL_FAILURE
-  
+
   fi
 }
 
@@ -192,11 +196,7 @@ while true; do
     ssh_fail_counter=0
     debug_print "Attempting to dial..."
 
-    # Try to re-"dial" our ISP 
-    #
-    /usr/bin/pon gprs
-
-    # Give the modem a minute to do its thing...
+    # Try to re-"dial" our ISP
     #
     /usr/bin/pon gprs
 

+ 23 - 1
busunit/scripts/get_net_ids.sh

@@ -50,6 +50,7 @@ function query_modem
 	query_command="$1"
 	reply_regex="$2"
 	
+  if [[ ! -e $SERIAL_PORT ]] ; then return ; fi
 
 	if [ -z "$query_command" ]; then
 		query_command="AT"
@@ -95,6 +96,8 @@ function query_mac_address
 
 function setup_modem
 {
+  if [[ ! -e $SERIAL_PORT ]] ; then return ; fi
+
 	stty -F $SERIAL_PORT $PORT_CONFIG
 	query_modem 'AT' 2>&1 > /dev/null
 	sleep 2
@@ -103,10 +106,25 @@ function setup_modem
 	query_modem 'ATZ' 'OK' 2>&1 > /dev/null
 }
 
+maxtries=5
+tries=0
+
+while [[ ! -e $SERIAL_PORT && $tries -lt $maxtries ]] ; do
+  echo "# $tries / $maxtries"
+  sleep 5
+	tries=$((tries + 1))
+done
+
+if [[ ! -e $SERIAL_PORT ]] ; then
+  echo "IMEI = " > $COOKED_DROPFILE
+  echo "IMSI = " >> $COOKED_DROPFILE
+  echo "ETH0 = `query_mac_address eth0 2> /dev/null`"  >> $COOKED_DROPFILE
+  exit
+fi
+
 setup_modem
 query_modem 'AT+CMEE=1'	'OK' 2>&1 > /dev/null
 
-maxtries=5
 tries=0
 
 while !(echo $imei | egrep '[0-9]+') && [ $tries -lt $maxtries ]; do
@@ -114,6 +132,8 @@ while !(echo $imei | egrep '[0-9]+') && [ $tries -lt $maxtries ]; do
 	tries=$((tries + 1))
 done
 
+echo ">> $tries"
+
 tries=0
 
 while !(echo $imsi | egrep '[0-9]+') && [ $tries -lt $maxtries ]; do
@@ -121,6 +141,8 @@ while !(echo $imsi | egrep '[0-9]+') && [ $tries -lt $maxtries ]; do
 	tries=$((tries + 1))
 done
 
+echo ">> $tries"
+
 echo "IMEI = $imei" > $COOKED_DROPFILE
 echo "IMSI = $imsi" >> $COOKED_DROPFILE
 echo "ETH0 = `query_mac_address eth0 2> /dev/null`"  >> $COOKED_DROPFILE

+ 52 - 0
busunit/scripts/setup-serial-dmesg.py

@@ -0,0 +1,52 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Clementine Computing LLC.
+#
+# This file is part of PopuFare.
+#
+# PopuFare is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# PopuFare is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with PopuFare.  If not, see <https://www.gnu.org/licenses/>.
+#
+
+import serial
+import sys
+import re
+import time
+import subprocess as sp
+from os import listdir
+from os.path import isfile, join
+from os import system
+
+DEBUG = True
+VERBOSE = True
+
+ret = system("rm -f /dev/ttyPIU /dev/ttyGPRS /dev/ttyDIU /dev/ttyGPS")
+
+DEVDIR = "/dev"
+
+for devfn in ["ttyUSB0", "ttyUSB1"]:
+  s = sp.check_output("dmesg | grep " + devfn + " | tail -n1", shell=True)
+  s = s.strip()
+
+  print s
+
+  if re.search(r'FTDI', s):
+    print devfn, "-> /dev/ttyPIU (ftdi)"
+    system("ln -s " + devfn + " /dev/ttyPIU")
+  elif re.search(r'pl2303', s):
+    print devfn, "-> /dev/ttyGPRS (pl2303)"
+    system("ln -s " + devfn + " /dev/ttyGPRS")
+
+system("ln -s /dev/ttyACM0 /dev/ttyGPS")
+
+

+ 20 - 1
busunit/scripts/setup-serial.py

@@ -1,4 +1,23 @@
 #!/usr/bin/python
+#
+# Copyright (c) 2019 Clementine Computing LLC.
+#
+# This file is part of PopuFare.
+#
+# PopuFare is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# PopuFare is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with PopuFare.  If not, see <https://www.gnu.org/licenses/>.
+#
+
 
 import serial
 import sys
@@ -8,7 +27,7 @@ from os import listdir
 from os.path import isfile, join
 from os import system
 
-DEBUG = False
+DEBUG = True
 VERBOSE = True
 
 ret = system("rm -f /dev/ttyPIU /dev/ttyGPRS /dev/ttyDIU /dev/ttyGPS")