I was somewhat pushed into moving to a MacBook Pro last year and it has definitely had some weird USB behavior like the periodic kernel panic, bus hang, and of course there is the fact that the keyboard/mouse hang when the PM3 boots.
Anyway -- regarding the performance I think it is unlikely that this would affect timing more than just having the usb_poll() since usb_read() will only execute if usb_poll() is true in which case the current code would be aborting simulation anyway. In my environment, I just get one time with the empty UsbCommand so it might also be possible to check the USB buffer before going into the loop to completely avoid a performance hit. I have had successful tests on an HID-37 and an AWID26.
]]>Will adding the usb_read affect the timing of the sim?
]]>I did some testing and found that in my environment, usb_poll() is returning true on the first call but when I usb_read, I get back 0 bytes.
How about:
#define SHORT_COIL() LOW(GPIO_SSC_DOUT)
#define OPEN_COIL() HIGH(GPIO_SSC_DOUT)
i = 0;
byte_t rx[sizeof(UsbCommand)];
for(;;) {
//wait until SSC_CLK goes HIGH
while(!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)) {
if(BUTTON_PRESS() || (usb_poll() && usb_read(rx,sizeof(UsbCommand)))) {
Does anyone know why I would get an empty UsbCommand? Does it happen to anyone else? I can reproduce by just running 'lf hid sim deadbeef' or doing any basic lf simfsk commands.
]]>I do not know how github works on a pull for a change so if someone has a chance to look at the changes and see if they are worth pushing.
The link below is my changed version of the armsrc/iclass.c file
https://drive.google.com/file/d/0B3LeAUIHyQVRdUo3LW9VMGpzb2M/view?usp=sharing
EDIT:
I am looking at adding a stop command to the hf iclass function that just sends something over USB that triggers the stop with the previous changes to the iclass code adding usb_poll().
Is there any issues with sending the usb command CMD_UNKNOWN to trigger a stop/button press message over USB
I am looking for something simple that doesnt cause any other events and the CMD_UNKNOWN might fit the bill.
Thanks a lot guys.
]]>Aborting lf simulation without pressing any button:
proxmark3> lf simask c i
preparing to sim ask data: 0 bits
#db# Simulating with clk: 255, invert: 0, manchester: 1, separator: 0, n: 0
proxmark3> hw version
#db# Stopped
#db# Prox/RFID mark3 RFID instrument
#db# bootrom: master/v1.1.0-38-gd6a120a-dirty-suspect 2014-12-08 19:51:04
#db# os: master/v2.0.0-rc2-28-g04bc1c6-dirty-suspect 2015-03-12 15:28:04
#db# LF FPGA image built on 2015/03/06 at 07:38:04
uC: AT91SAM7S512 Rev A
Embedded Processor: ARM7TDMI
Nonvolatile Program Memory Size: 512K bytes
Second Nonvolatile Program Memory Size: None
Internal SRAM Size: 64K bytes
Architecture Identifier: AT91SAM7Sxx Series
Nonvolatile Program Memory Type: Embedded Flash Memory
As always, thank you!
]]>