modified hf 14a apdu to report back when extending time and also added a possibililty to interrupt the extension loop with button press or usb commad. A bunch of minor textual changes
This commit is contained in:
1 parent
db877ce4fd
commit
b4cc21c68f
19 files changed
+99
-57
No files matched your search
@@ -362,8 +362,9 @@ serial_port uart_open(const char *pcPortName, uint32_t speed, bool slient) {
|
||||
// Freshly available port can take a while before getting permission to access it. Up to 600ms on my machine...
|
||||
for (uint8_t i = 0; i < 10; i++) {
|
||||
sp->fd = open(pcPortName, O_RDWR | O_NOCTTY | O_NDELAY | O_NONBLOCK);
|
||||
if (sp->fd != -1 || errno != EACCES)
|
||||
if (sp->fd != -1 || errno != EACCES) {
|
||||
break;
|
||||
}
|
||||
msleep(100);
|
||||
}
|
||||
if (sp->fd == -1) {
|
||||
@@ -450,6 +451,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed, bool slient) {
|
||||
|
||||
void uart_close(const serial_port sp) {
|
||||
serial_port_unix_t_t *spu = (serial_port_unix_t_t *)sp;
|
||||
msleep(100);
|
||||
tcflush(spu->fd, TCIOFLUSH);
|
||||
tcsetattr(spu->fd, TCSANOW, &(spu->tiOld));
|
||||
struct flock fl;
|
||||
@@ -711,14 +713,16 @@ bool uart_set_speed(serial_port sp, const uint32_t uiPortSpeed) {
|
||||
};
|
||||
|
||||
struct termios ti;
|
||||
if (tcgetattr(spu->fd, &ti) == -1)
|
||||
if (tcgetattr(spu->fd, &ti) == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set port speed (Input and Output)
|
||||
cfsetispeed(&ti, stPortSpeed);
|
||||
cfsetospeed(&ti, stPortSpeed);
|
||||
|
||||
// flush
|
||||
msleep(100);
|
||||
tcflush(spu->fd, TCIOFLUSH);
|
||||
|
||||
bool result = tcsetattr(spu->fd, TCSANOW, &ti) != -1;
|
||||
|
||||
Reference in new issue
Block a user