rate=False;
chan=False;
sync=False;
+ startch=0; #Useful for forcing an early match.
def init(self,goodfet,
rate=True,chan=True,sync=True):
"""Initializes a link to the GoodFET for autotuning."""
client.poke(0x00,0x00); #Stop nRF
client.poke(0x01,0x00); #Disable Shockburst
client.poke(0x02,0x01); #Set RX Pipe 0
+
+ #Disable shockburst.
+ client.poke(0x1C,0x00);
+ client.poke(0x1D,0x00);
+
client.RF_setmaclen(2); # SETUP_AW for shortest
#historic
def handle(self,packet):
"""Handles a packet."""
#printpacket(packet);
+
if not self.validmac(packet):
- #print "Dropped packet:";
+ #print "Dropped packet from %s" % self.packetaddr(packet,justmac=True);
#printpacket(packet);
return;
+
addr=self.packetaddr(packet);
#Increment the address count.
It's important that this not get triggered by false positives."""
while 1:
+ self.retune();
start=time.mktime(time.localtime());
while (time.mktime(time.localtime())-start) < delay:
packet=None;
#Tune it in here?
client.tune(addr);
return addr;
- self.retune();
sys.stdout.flush();
def retune(self):
if self.chan:
self.client.poke(0x05,
- (count+0x12)&0x7f);
+ (count+self.startch)&0x7f);
print "Tuned to %i MHz" % (
self.client.RF_getfreq()
/(10**6));
print "Searching for a keyboard.";
guesser=AutoTuner();
- guesser.init(client, rate=False, sync=True, chan=False);
+ guesser.init(client, rate=False, sync=True, chan=True);
guesser.selftune(threshold=4,forever=False,
- delay=3.0);
+ delay=10.0);
client.poke(0x00,0x00); #Stop nRF
client.poke(0x01,0x00); #Disable Shockburst