mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 18:48:13 -07:00
FPC: got RX working, got client over usart somehow working..., see detailed commit msg
* using WITH_FPC: * activate basic usart * no double buffer for now, no interrupt * usart_dataavailable/usart_readbuffer/usart_writebuffer, to demo it: * pm3 client over USB, minicom over usart * analyse a d 414243 * using WITH_FPC_HOST: * it implies WITH_FPC as it's based on it * control pm3 with client over usart * EXPERIMENTAL! still some frame desync issues * you can connect both from usart & USB with two pm3 clients * actually you *have* to connect USB for the moment because it's used to send debug messages about buggy usart... See Dbprintf_usb below * "sessions": msgs are directed to the latest client to have sent a cmd * Dbprintf_usb macro to send msgs to USB client to help debugging usart... * We now have an option to run client at different speed as usart is 115200: client/proxmark3 /dev/ttyUSB0 -b 115200 * Consequently, argc,argv handling is a bit revamped, it was so messy... * USB and flashing are still at 460800, don't try flashing over usart yet ^^
This commit is contained in:
parent
4c007beefd
commit
21be6d4400
15 changed files with 174 additions and 84 deletions
|
@ -632,7 +632,6 @@ void ListenReaderField(int limit) {
|
|||
|
||||
void UsbPacketReceived(uint8_t *packet, int len) {
|
||||
UsbCommand *c = (UsbCommand *)packet;
|
||||
|
||||
//Dbprintf("received %d bytes, with command: 0x%04x and args: %d %d %d", len, c->cmd, c->arg[0], c->arg[1], c->arg[2]);
|
||||
|
||||
switch (c->cmd) {
|
||||
|
@ -1106,8 +1105,12 @@ void UsbPacketReceived(uint8_t *packet, int len) {
|
|||
|
||||
|
||||
char dest[USB_CMD_DATA_SIZE]={'\0'};
|
||||
sprintf(dest, usart_dataavailable() ? "DATA!\r\n" : "no data\r\n");
|
||||
cmd_send(CMD_DEBUG_PRINT_STRING, strlen(dest), 0, 0, dest, strlen(dest));
|
||||
if (usart_dataavailable()) {
|
||||
Dbprintf("RX DATA!");
|
||||
uint16_t len = usart_readbuffer((uint8_t*)dest);
|
||||
dest[len] = '\0';
|
||||
Dbprintf("RX: %d | %02X %02X %02X %02X %02X %02X %02X %02X ", len, dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]);
|
||||
}
|
||||
|
||||
static const char *welcome = "Proxmark3 Serial interface via FPC ready\r\n";
|
||||
usart_writebuffer((uint8_t *)welcome, strlen(welcome));
|
||||
|
@ -1126,9 +1129,6 @@ void UsbPacketReceived(uint8_t *packet, int len) {
|
|||
|
||||
//usb
|
||||
cmd_send(CMD_DEBUG_PRINT_STRING, strlen(dest), 0, 0, dest, strlen(dest));
|
||||
|
||||
sprintf(dest, usart_dataavailable() ? "DATA!\r\n" : "no data\r\n");
|
||||
cmd_send(CMD_DEBUG_PRINT_STRING, strlen(dest), 0, 0, dest, strlen(dest));
|
||||
LED_A_OFF();
|
||||
/*
|
||||
uint8_t my_rx[sizeof(UsbCommand)];
|
||||
|
@ -1560,16 +1560,17 @@ void __attribute__((noreturn)) AppMain(void) {
|
|||
// Check if there is a usb packet available
|
||||
if (usb_poll_validate_length()) {
|
||||
if (usb_read(rx, sizeof(rx)))
|
||||
#ifdef WITH_FPC_HOST
|
||||
reply_via_fpc = 0;
|
||||
#endif
|
||||
UsbPacketReceived(rx, sizeof(rx));
|
||||
}
|
||||
#ifdef WITH_FPC
|
||||
// Check is there is FPC package available
|
||||
/*
|
||||
usart_init();
|
||||
if (usart_readbuffer(rx, sizeof(rx)) )
|
||||
UsbPacketReceived(rx, sizeof(rx) );
|
||||
*/
|
||||
|
||||
#ifdef WITH_FPC_HOST
|
||||
// Check if there is a FPC packet available
|
||||
if (usart_readcommand(rx) > 0) {
|
||||
reply_via_fpc = 1;
|
||||
UsbPacketReceived(rx, sizeof(rx));
|
||||
}
|
||||
#endif
|
||||
|
||||
// Press button for one second to enter a possible standalone mode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue