mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-19 06:48:34 +03:00
sniffer functionality fixed buffer
It is possible to use sniffer.py to sniff the phone-simcard-communication. To be fixed: The buffer size read is fixed and the data is only send over USB if the buffer max length is reached. which means we don not get the last bytes of the transaction. This should be changed in one of the next commits. Maybe the former simtrace code can give some inspiration on this topic.
This commit is contained in:
@@ -38,6 +38,8 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Internal definitions
|
||||
*------------------------------------------------------------------------------*/
|
||||
// FIXME: Remove:
|
||||
#define PR TRACE_DEBUG
|
||||
|
||||
/** Maximum ucSize in bytes of the smartcard answer to a command.*/
|
||||
#define MAX_ANSWER_SIZE 10
|
||||
@@ -60,6 +62,7 @@ static const Pin pPwr[] = {
|
||||
|
||||
extern uint32_t char_stat;
|
||||
extern uint8_t rcvdChar;
|
||||
extern ring_buffer buf;
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Initialization routine
|
||||
@@ -80,8 +83,16 @@ void Sniffer_Init( void )
|
||||
|
||||
void Sniffer_run( void )
|
||||
{
|
||||
uint8_t c = 0;
|
||||
c++;
|
||||
|
||||
if (rcvdChar != 0) {
|
||||
TRACE_DEBUG("Rcvd char _%x_ \n\r", rcvdChar);
|
||||
/* DATA_IN for host side is data_out for simtrace side */
|
||||
/* FIXME: Performancewise sending a USB packet for every byte is a disaster */
|
||||
PR("----- %x %x %x ..\n\r", buf.buf[0], buf.buf[1],buf.buf[2] );
|
||||
USBD_Write( DATAIN, buf.buf, BUFLEN, 0, 0 );
|
||||
// USBD_Write( DATAIN, &c, 1, 0, 0 );
|
||||
PR("----- Rcvd char\n\r");
|
||||
rcvdChar = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user