-void CloseProxmark(receiver_arg* conn, char* serial_port_name) {
- pthread_mutex_lock(&conn->recv_lock);
-
- // Block the port from being used by anything
- serial_port* my_port = GetSerialPort();
- SetSerialPort(NULL);
-
- // Then close the port.
- uart_close(my_port);
- pthread_mutex_unlock(&conn->recv_lock);
-
- // Fix for linux, it seems that it is extremely slow to release the serial port file descriptor /dev/*
- unlink(serial_port_name);
-}
-
-bool OpenProxmark(char* serial_port_name) {
- serial_port *new_port = uart_open(serial_port_name);
- if (new_port == INVALID_SERIAL_PORT || new_port == CLAIMED_SERIAL_PORT) {
- //poll once a second
- return false;
- }
-
- SetSerialPort(new_port);
- return true;
-}
-