OSDN Git Service

tools/l2test: Fix default LE PSM value
authorJohan Hedberg <johan.hedberg@intel.com>
Mon, 7 Oct 2013 12:06:08 +0000 (15:06 +0300)
committerJohan Hedberg <johan.hedberg@intel.com>
Sun, 1 Dec 2013 17:36:16 +0000 (19:36 +0200)
LE has different ranges for dynamic PSMs.

tools/l2test.c

index c5c8763..ce512c1 100644 (file)
@@ -48,6 +48,9 @@
 
 #define NIBBLE_TO_ASCII(c)  ((c) < 0x0a ? (c) + 0x30 : (c) + 0x57)
 
+#define BREDR_DEFAULT_PSM      0x1011
+#define LE_DEFAULT_PSM         0x0080
+
 /* Test modes */
 enum {
        SEND,
@@ -87,7 +90,7 @@ static long buffer_size = 2048;
 
 /* Default addr and psm and cid */
 static bdaddr_t bdaddr;
-static unsigned short psm = 0x1011;
+static unsigned short psm = 0;
 static unsigned short cid = 0;
 
 /* Default number of frames to send (-1 = infinite) */
@@ -1525,6 +1528,13 @@ int main(int argc, char *argv[])
                }
        }
 
+       if (!psm) {
+               if (bdaddr_type == BDADDR_BREDR)
+                       psm = BREDR_DEFAULT_PSM;
+               else
+                       psm = LE_DEFAULT_PSM;
+       }
+
        if (need_addr && !(argc - optind)) {
                usage();
                exit(1);