gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] [PATCH] gpscat: fix incorrect test againt rfcomm for bluetoot


From: Alban Browaeys
Subject: [gpsd-dev] [PATCH] gpscat: fix incorrect test againt rfcomm for bluetooth address
Date: Mon, 09 Jan 2012 18:24:57 +0100

We feed arguments[0] to the bluetooth socket so this has to be
the address and cannot contains "rfcomm" string.
---
 gpscat |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gpscat b/gpscat
index f3903fa..a4b8ed3 100755
--- a/gpscat
+++ b/gpscat
@@ -70,12 +70,12 @@ if __name__ == '__main__':
                 printusage()
                 raise SystemExit, 1
 
-        if "rfcomm" in arguments[0]:     # Bluetooth special case
+        if arguments[0][0] == '/':       # Ordinary device
+            tty = os.open(arguments[0], os.O_RDWR)
+        else:     # Bluetooth special case
             s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, 
socket.BTPROTO_RFCOMM)
             s.connect((arguments[0], 1))
             tty = s.fileno()
-        else:                            # Ordinary device
-            tty = os.open(arguments[0], os.O_RDWR)
 
         if speed != None:
             (iflag, oflag, cflag, lflag, ispeed, ospeed, cc) = 
termios.tcgetattr(tty)
-- 
1.7.8.2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]