1 //-----------------------------------------------------------------------------
3 //-----------------------------------------------------------------------------
12 #include "usart_defs.h"
13 #include "util_posix.h"
16 pm3_device
*pm3_open(char *port
) {
18 OpenProxmark(&session
.current_device
, port
, false, 20, false, USART_BAUD_RATE
);
19 if (session
.pm3_present
&& (TestProxmark(session
.current_device
) != PM3_SUCCESS
)) {
20 PrintAndLogEx(ERR
, _RED_("ERROR:") " cannot communicate with the Proxmark\n");
21 CloseProxmark(session
.current_device
);
24 if ((port
!= NULL
) && (!session
.pm3_present
))
27 if (!session
.pm3_present
)
28 PrintAndLogEx(INFO
, "Running in " _YELLOW_("OFFLINE") " mode");
29 // For now, there is no real device context:
30 return session
.current_device
;
33 void pm3_close(pm3_device
*dev
) {
35 if (session
.pm3_present
) {
37 SendCommandNG(CMD_QUIT_SESSION
, NULL
, 0);
38 msleep(100); // Make sure command is sent before killing client
43 int pm3_console(pm3_device
*dev
, char *Cmd
) {
44 // For now, there is no real device context:
46 return CommandReceived(Cmd
);
49 const char *pm3_name_get(pm3_device
*dev
) {
50 return dev
->conn
->serial_port_name
;
53 pm3_device
*pm3_get_current_dev(void) {
54 return session
.current_device
;