]> git.defcon.no Git - hm-trp-tool/commitdiff
Cleaning up a bit. set_speed no longer needed, QT-Tool does the job better.
authorJon Langseth <jon.langseth@lilug.no>
Mon, 9 Jul 2012 21:51:57 +0000 (23:51 +0200)
committerJon Langseth <jon.langseth@lilug.no>
Mon, 9 Jul 2012 21:51:57 +0000 (23:51 +0200)
build.sh
set_speed.c [deleted file]
swap.c_example [deleted file]

index 21cc4816cc406e2e787339b2b087647018470065..8c2c6941d2fa8a68dc15d5684b4058ea8428ea06 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -7,5 +7,3 @@ do
 done
 
 gcc read_hm-trp.o hm-trp.o serial.o -o read_hm-trp
-gcc set_speed.o hm-trp.o serial.o -o set_speed
-
diff --git a/set_speed.c b/set_speed.c
deleted file mode 100644 (file)
index c29393c..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-#include <errno.h>   /* Error number definitions */
-#include <string.h>  /* String function definitions */
-#include <stdio.h>   /* Standard I/O */
-#include <unistd.h>  /* sleep */
-#include <stdlib.h>  /* malloc, free */
-
-#include "hm-trp.h"
-#include "serial.h"
-
-#define CBUFFER_SIZE 32
-
-int main ( int argc, char** argv )
-{
-       int fd;
-       int res;
-       int r, c, f;
-       long rate;
-
-       unsigned char buf[CBUFFER_SIZE];
-
-       config_t* config = malloc(sizeof(config_t));
-       bzero(config, sizeof(config_t));
-
-       if ( ! argv[1] )
-       {
-               printf("Serial port device required as argument, e.g. /dev/ttyUSB0\n");
-               return 1;
-       }
-
-       if ( ! argv[2] )
-       {
-               printf("Desired bit-rate required. Use RS232 rates only.\n");
-               return 1;
-       }
-
-       rate = atol( argv[2] );
-       for ( r = 0; r <= count_rates; r++ )
-               if ( port_rate_value[r] == rate ) { rate = r; break; }
-
-       if ( r >= count_rates ) { printf("Invalid data rate requested\n"); return 1; }
-
-       printf("Looking for device on port %s\n", argv[1]);
-
-       for ( r = 0; r <= count_rates; r++ )
-       {
-               fd = open_port( argv[1], port_rates[r] );
-               if ( fd < 0 )
-               {
-                       perror(argv[1]); 
-                       return(-1);
-               }
-
-               if ( read_config( fd, config )  == 1 )
-               {
-                       printf("Found device at baud-rate %d.\n", port_rate_value[r] );
-
-                       if ( r == rate  && ( config->air_rate == config->uart_rate ) )
-                       {
-                               printf("Data rate is already set to %d\n", port_rate_value[r] );
-                               return 0;
-                       }
-
-                       write_cmd( fd, cmd_air_rate );
-                       write_uint32_t( fd, port_rate_value[rate] );
-
-                       if ( ! read_ok( fd ) )
-                       {
-                               printf("Air rate NOT set\n");
-                               return 1;
-                       }
-
-                       write_cmd( fd, cmd_uart_rate );
-                       write_uint32_t( fd, port_rate_value[rate] );
-
-                       read_ok( fd ); // Clear buffer.
-
-                       printf("Device UART and air data rate set to %d\n", port_rate_value[rate] );
-                       return(0);
-               }
-               close(fd);
-       }
-       printf("Unable to find device on %s\n", argv[1]);
-       return(1);
-}
-
diff --git a/swap.c_example b/swap.c_example
deleted file mode 100644 (file)
index 401f53a..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <bits/byteswap.h> /* __bwap_{16,32} */
-
-/*
-  Basically, does:
-uint32_t swap_uint32 ( uint32_t num )
-{
-       return  ( (num>>24) & 0x000000ff) |    // move byte 3 to byte 0
-               ( (num<<8)  & 0x00ff0000) |   // move byte 1 to byte 2
-               ( (num>>8)  & 0x0000ff00) |     // move byte 2 to byte 1
-               ( (num<<24) & 0xff000000); // byte 0 to byte 3
-}
-
-uint16_t swap_uint16 ( uint16_t num )
-{
-       //          Move UP and mask    | Move DOWN and mask
-       return( (num<<8) & 0xff00 ) | ( (num>>8) & 0x00ff ); 
-}
-*/
-