mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
Merge branch 'master' of https://github.com/RfidResearchGroup/proxmark3
This commit is contained in:
commit
fdabfc09d2
1 changed files with 273 additions and 272 deletions
|
@ -68,12 +68,13 @@ typedef struct {
|
|||
} serial_port_unix;
|
||||
|
||||
// Set time-out on 30 miliseconds
|
||||
const struct timeval timeout = {
|
||||
struct timeval timeout = {
|
||||
.tv_sec = 0, // 0 second
|
||||
.tv_usec = 30000 // 30 000 micro seconds
|
||||
.tv_usec = 30000 // 30000 micro seconds
|
||||
};
|
||||
|
||||
serial_port uart_open(const char* pcPortName) {
|
||||
serial_port uart_open(const char* pcPortName)
|
||||
{
|
||||
serial_port_unix* sp = calloc(sizeof(serial_port_unix), sizeof(uint8_t));
|
||||
if (sp == 0) return INVALID_SERIAL_PORT;
|
||||
|
||||
|
@ -86,10 +87,12 @@ serial_port uart_open(const char* pcPortName) {
|
|||
return INVALID_SERIAL_PORT;
|
||||
}
|
||||
|
||||
timeout.tv_usec = 300000 // 300 000 micro seconds
|
||||
|
||||
char *colon = strrchr(addrstr, ':');
|
||||
char *portstr;
|
||||
|
||||
// Set time-out to 300 miliseconds only for TCP port
|
||||
timeout.tv_usec = 300000;
|
||||
|
||||
if (colon) {
|
||||
portstr = colon + 1;
|
||||
*colon = '\0';
|
||||
|
@ -366,10 +369,7 @@ uint32_t uart_get_speed(const serial_port sp) {
|
|||
struct termios ti;
|
||||
uint32_t uiPortSpeed;
|
||||
const serial_port_unix* spu = (serial_port_unix*)sp;
|
||||
|
||||
if (tcgetattr(spu->fd, &ti) == -1)
|
||||
return 0;
|
||||
|
||||
if (tcgetattr(spu->fd, &ti) == -1) return 0;
|
||||
// Set port speed (Input)
|
||||
speed_t stPortSpeed = cfgetispeed(&ti);
|
||||
switch (stPortSpeed) {
|
||||
|
@ -407,4 +407,5 @@ uint32_t uart_get_speed(const serial_port sp) {
|
|||
};
|
||||
return uiPortSpeed;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue