Skybrake stuff, supposes a particular MAC.
[goodfet] / client / goodfet.nrf
index a7dc51a..1bd234d 100755 (executable)
@@ -45,6 +45,7 @@ if(len(sys.argv)==1):
     print "%s info" % sys.argv[0];
     print "%s test" % sys.argv[0];
     print "%s regs" % sys.argv[0];
+    print "%s regbits" % sys.argv[0];
     print "%s pyregs" % sys.argv[0];
 
     print "%s sniff\n\tSniffs packets by current config." % sys.argv[0];
@@ -52,6 +53,8 @@ if(len(sys.argv)==1):
     print "%s snifftp\n\tSniffs Turning Point Clicker traffic." % sys.argv[0];
     print "%s snifftp\n\tSniffs SparkFun Dongle traffic." % sys.argv[0];
     
+    print "%s sniffprom\n\tSniffs promiscuously." % sys.argv[0];
+    
     print "%s hosttp\n\tHosts Turning Point Clicker traffic." % sys.argv[0];
 
     print "%s carrier [freq]\n\tHolds a carrier on [freq] Hz." % sys.argv[0];
@@ -197,9 +200,11 @@ if(sys.argv[1]=="sniffprom"):
     #OpenBeacon defines these in little endian as follows.
     client.RF_setmaclen(5); # SETUP_AW for 3-byte addresses.
     #0x01, 0x02, 0x03, 0x02, 0x01
-    client.RF_setsmac(0x0102030201);
+    #client.RF_setsmac(0x0102030201);
+    #client.RF_setsmac(0x0000000201);
+    client.RF_setsmac(0x0102);
     #'O', 'C', 'A', 'E', 'B'
-    client.RF_settmac(0x424541434F);
+    #client.RF_settmac(0x424541434F);
     
     #Mac packet length, illegally 0-length address field.
     client.RF_setpacketlen(32);
@@ -219,6 +224,47 @@ if(sys.argv[1]=="sniffprom"):
         printpacket(packet);
         sys.stdout.flush();
 
+
+
+if(sys.argv[1]=="sniffskybrake"):
+    #Reversal of transmitter code from nRF_CMD.c of OpenBeacon
+    #TODO remove all poke() calls.
+    
+    client.poke(0x00,0x00); #Stop nRF
+    client.poke(0x01,0x00); #Disable Shockburst
+    client.poke(0x02,0x01); #Set RX Pipe 0
+    
+    client.RF_setfreq(2439 * 10**6);
+    client.poke(0x06,0x00); #1MBps
+    client.poke(0x07,0x78); #Reset status register
+    
+    #OpenBeacon defines these in little endian as follows.
+    client.RF_setmaclen(2); # SETUP_AW for 3-byte addresses.
+    #0x01, 0x02, 0x03, 0x02, 0x01
+    
+    client.RF_setsmac(0x070700d2c4); #reversed
+    
+    #client.RF_setsmac(0xd2c4);
+    #client.RF_setsmac(0);
+    
+    #Mac packet length, illegally 0-length address field.
+    client.RF_setpacketlen(32);
+    
+    #Power radio, prime for RX, one-byte checksum.
+    client.poke(0x00,0x70|0x03); #0x08 for one byte, 0x04 for two.
+    
+    print "Listening as %010x on %i MHz" % (client.RF_getsmac(),
+                                           client.RF_getfreq()/10**6);
+    print "%i byte mac match." % client.RF_getmaclen();
+    #Now we're ready to get packets.
+    while 1:
+        packet=None;
+        while packet==None:
+            #time.sleep(0.1);
+            packet=client.RF_rxpacket();
+        printpacket(packet);
+        sys.stdout.flush();
+
 if(sys.argv[1]=="sniffsf"):
     #Reversal of transmitter code from nRF_CMD.c of OpenBeacon
     #TODO remove all poke() calls.