mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
FIX: bootrom - flashmode should also not assume sizeof(usbcommand) 544 bytes
This commit is contained in:
parent
16028f7d33
commit
d46955e309
2 changed files with 12 additions and 9 deletions
|
@ -1163,13 +1163,12 @@ void __attribute__((noreturn)) AppMain(void) {
|
||||||
byte_t rx[sizeof(UsbCommand)];
|
byte_t rx[sizeof(UsbCommand)];
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
WDT_HIT();
|
||||||
|
|
||||||
// Check if there is a usb packet available
|
// Check if there is a usb packet available
|
||||||
if ( cmd_receive( (UsbCommand*)rx ) )
|
if ( cmd_receive( (UsbCommand*)rx ) )
|
||||||
UsbPacketReceived(rx, sizeof(UsbCommand) );
|
UsbPacketReceived(rx, sizeof(UsbCommand) );
|
||||||
|
|
||||||
WDT_HIT();
|
|
||||||
|
|
||||||
// Press button for one second to enter a possible standalone mode
|
// Press button for one second to enter a possible standalone mode
|
||||||
if (BUTTON_HELD(1000) > 0) {
|
if (BUTTON_HELD(1000) > 0) {
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ static void flash_mode(int externally_entered) {
|
||||||
end_addr = 0;
|
end_addr = 0;
|
||||||
bootrom_unlocked = 0;
|
bootrom_unlocked = 0;
|
||||||
byte_t rx[sizeof(UsbCommand)];
|
byte_t rx[sizeof(UsbCommand)];
|
||||||
size_t rx_len;
|
//size_t rx_len;
|
||||||
|
|
||||||
usb_enable();
|
usb_enable();
|
||||||
//for (volatile size_t i=0; i<0x100000; i++) {};
|
//for (volatile size_t i=0; i<0x100000; i++) {};
|
||||||
|
@ -199,11 +199,15 @@ static void flash_mode(int externally_entered) {
|
||||||
for(;;) {
|
for(;;) {
|
||||||
WDT_HIT();
|
WDT_HIT();
|
||||||
|
|
||||||
if ( usb_poll_validate_length()) {
|
// Check if there is a usb packet available
|
||||||
rx_len = usb_read(rx, sizeof(UsbCommand));
|
if ( cmd_receive( (UsbCommand*)rx ) )
|
||||||
if (rx_len == sizeof(UsbCommand))
|
UsbPacketReceived(rx, sizeof(UsbCommand) );
|
||||||
UsbPacketReceived(rx, rx_len);
|
|
||||||
}
|
// if ( usb_poll_validate_length()) {
|
||||||
|
// rx_len = usb_read(rx, sizeof(UsbCommand));
|
||||||
|
// if (rx_len)
|
||||||
|
// UsbPacketReceived(rx, rx_len);
|
||||||
|
//}
|
||||||
|
|
||||||
if (!externally_entered && !BUTTON_PRESS()) {
|
if (!externally_entered && !BUTTON_PRESS()) {
|
||||||
/* Perform a reset to leave flash mode */
|
/* Perform a reset to leave flash mode */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue