From 392ee268f518dbd4fa8d5e3dd65752823188f65d Mon Sep 17 00:00:00 2001 From: travisutk Date: Mon, 10 Jan 2011 18:04:01 +0000 Subject: [PATCH] Skybrake stuff, supposes a particular MAC. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@825 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- client/GoodFETNRF.py | 8 ++++--- client/goodfet.nrf | 50 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/client/GoodFETNRF.py b/client/GoodFETNRF.py index 3c780a5..c21ae2b 100644 --- a/client/GoodFETNRF.py +++ b/client/GoodFETNRF.py @@ -178,14 +178,16 @@ class GoodFETNRF(GoodFET): maclen=5; def RF_getmaclen(self): """Get the number of bytes in the MAC address.""" - choices=[0, 3, 4, 5]; + choices=[2, 3, 4, 5]; choice=self.peek(0x03)&3; self.maclen=choices[choice]; return self.maclen; def RF_setmaclen(self,len): """Set the number of bytes in the MAC address.""" - choices=["illegal", "illegal", "illegal", - 1, 2, 3]; + choices=["illegal", "illegal", + 0, #undocumented + 1, 2, 3 #documented + ]; choice=choices[len]; self.poke(0x03,choice); self.maclen=len; diff --git a/client/goodfet.nrf b/client/goodfet.nrf index a7dc51a..1bd234d 100755 --- a/client/goodfet.nrf +++ b/client/goodfet.nrf @@ -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. -- 2.20.1