mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-30 19:40:37 -07:00
rename usb_present
This commit is contained in:
parent
4a576efc44
commit
897632a717
5 changed files with 21 additions and 21 deletions
|
@ -15,14 +15,14 @@
|
||||||
static ProxGuiQT *gui = NULL;
|
static ProxGuiQT *gui = NULL;
|
||||||
static WorkerThread *main_loop_thread = NULL;
|
static WorkerThread *main_loop_thread = NULL;
|
||||||
|
|
||||||
WorkerThread::WorkerThread(char *script_cmds_file, char *script_cmd, bool usb_present) : script_cmds_file(script_cmds_file), script_cmd(script_cmd), usb_present(usb_present) {
|
WorkerThread::WorkerThread(char *script_cmds_file, char *script_cmd, bool pm3_present) : script_cmds_file(script_cmds_file), script_cmd(script_cmd), pm3_present(pm3_present) {
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkerThread::~WorkerThread() {
|
WorkerThread::~WorkerThread() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorkerThread::run() {
|
void WorkerThread::run() {
|
||||||
main_loop(script_cmds_file, script_cmd, usb_present);
|
main_loop(script_cmds_file, script_cmd, pm3_present);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void ShowGraphWindow(void) {
|
extern "C" void ShowGraphWindow(void) {
|
||||||
|
@ -53,12 +53,12 @@ extern "C" void MainGraphics(void) {
|
||||||
gui->MainLoop();
|
gui->MainLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void InitGraphics(int argc, char **argv, char *script_cmds_file, char *script_cmd, bool usb_present) {
|
extern "C" void InitGraphics(int argc, char **argv, char *script_cmds_file, char *script_cmd, bool pm3_present) {
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
if (getenv("DISPLAY") == NULL)
|
if (getenv("DISPLAY") == NULL)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
main_loop_thread = new WorkerThread(script_cmds_file, script_cmd, usb_present);
|
main_loop_thread = new WorkerThread(script_cmds_file, script_cmd, pm3_present);
|
||||||
gui = new ProxGuiQT(argc, argv, main_loop_thread);
|
gui = new ProxGuiQT(argc, argv, main_loop_thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ void ShowGraphWindow(void);
|
||||||
void HideGraphWindow(void);
|
void HideGraphWindow(void);
|
||||||
void RepaintGraphWindow(void);
|
void RepaintGraphWindow(void);
|
||||||
void MainGraphics(void);
|
void MainGraphics(void);
|
||||||
void InitGraphics(int argc, char **argv, char *script_cmds_file, char *script_cmd, bool usb_present);
|
void InitGraphics(int argc, char **argv, char *script_cmds_file, char *script_cmd, bool pm3_present);
|
||||||
void ExitGraphics(void);
|
void ExitGraphics(void);
|
||||||
#ifndef MAX_GRAPH_TRACE_LEN
|
#ifndef MAX_GRAPH_TRACE_LEN
|
||||||
#define MAX_GRAPH_TRACE_LEN (40000 * 8)
|
#define MAX_GRAPH_TRACE_LEN (40000 * 8)
|
||||||
|
|
|
@ -99,7 +99,7 @@ class WorkerThread : public QThread {
|
||||||
private:
|
private:
|
||||||
char *script_cmds_file = NULL;
|
char *script_cmds_file = NULL;
|
||||||
char *script_cmd = NULL;
|
char *script_cmd = NULL;
|
||||||
bool usb_present;
|
bool pm3_present;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ProxGuiQT : public QObject {
|
class ProxGuiQT : public QObject {
|
||||||
|
|
|
@ -58,7 +58,7 @@ void
|
||||||
__attribute__((force_align_arg_pointer))
|
__attribute__((force_align_arg_pointer))
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
main_loop(char *script_cmds_file, char *script_cmd, bool usb_present) {
|
main_loop(char *script_cmds_file, char *script_cmd, bool pm3_present) {
|
||||||
|
|
||||||
char *cmd = NULL;
|
char *cmd = NULL;
|
||||||
bool execCommand = (script_cmd != NULL);
|
bool execCommand = (script_cmd != NULL);
|
||||||
|
@ -68,7 +68,7 @@ main_loop(char *script_cmds_file, char *script_cmd, bool usb_present) {
|
||||||
|
|
||||||
PrintAndLogEx(DEBUG, "ISATTY/STDIN_FILENO == %s\n", (stdinOnPipe) ? "true" : "false");
|
PrintAndLogEx(DEBUG, "ISATTY/STDIN_FILENO == %s\n", (stdinOnPipe) ? "true" : "false");
|
||||||
|
|
||||||
if (usb_present) {
|
if (pm3_present) {
|
||||||
SetOffline(false);
|
SetOffline(false);
|
||||||
// cache Version information now:
|
// cache Version information now:
|
||||||
if (execCommand || script_cmds_file || stdinOnPipe)
|
if (execCommand || script_cmds_file || stdinOnPipe)
|
||||||
|
@ -98,10 +98,10 @@ main_loop(char *script_cmds_file, char *script_cmd, bool usb_present) {
|
||||||
if ( IsOffline() ) {
|
if ( IsOffline() ) {
|
||||||
|
|
||||||
// sets the global variable, SP and offline)
|
// sets the global variable, SP and offline)
|
||||||
usb_present = hookUpPM3();
|
pm3_present = hookUpPM3();
|
||||||
|
|
||||||
// usb and the reader_thread is NULL, create a new reader thread.
|
// usb and the reader_thread is NULL, create a new reader thread.
|
||||||
if (usb_present && !IsOffline() ) {
|
if (pm3_present && !IsOffline() ) {
|
||||||
rarg.run = 1;
|
rarg.run = 1;
|
||||||
pthread_create(&reader_thread, NULL, &uart_receiver, &rarg);
|
pthread_create(&reader_thread, NULL, &uart_receiver, &rarg);
|
||||||
// cache Version information now:
|
// cache Version information now:
|
||||||
|
@ -275,7 +275,7 @@ static void show_help(bool showFullHelp, char *exec_name) {
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
srand(time(0));
|
srand(time(0));
|
||||||
|
|
||||||
bool usb_present = false;
|
bool pm3_present = false;
|
||||||
bool waitCOMPort = false;
|
bool waitCOMPort = false;
|
||||||
bool addLuaExec = false;
|
bool addLuaExec = false;
|
||||||
char *script_cmds_file = NULL;
|
char *script_cmds_file = NULL;
|
||||||
|
@ -465,35 +465,35 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
// try to open USB connection to Proxmark
|
// try to open USB connection to Proxmark
|
||||||
if (port != NULL)
|
if (port != NULL)
|
||||||
usb_present = OpenProxmark(port, waitCOMPort, 20, false, speed);
|
pm3_present = OpenProxmark(port, waitCOMPort, 20, false, speed);
|
||||||
|
|
||||||
if (usb_present && (TestProxmark() == 0))
|
if (pm3_present && (TestProxmark() == 0))
|
||||||
usb_present = false;
|
pm3_present = false;
|
||||||
if (!usb_present)
|
if (!pm3_present)
|
||||||
PrintAndLogEx(INFO, "Running in " _YELLOW_("OFFLINE") "mode. Check \"%s -h\" if it's not what you want.\n", exec_name);
|
PrintAndLogEx(INFO, "Running in " _YELLOW_("OFFLINE") "mode. Check \"%s -h\" if it's not what you want.\n", exec_name);
|
||||||
|
|
||||||
#ifdef HAVE_GUI
|
#ifdef HAVE_GUI
|
||||||
|
|
||||||
# ifdef _WIN32
|
# ifdef _WIN32
|
||||||
InitGraphics(argc, argv, script_cmds_file, script_cmd, usb_present);
|
InitGraphics(argc, argv, script_cmds_file, script_cmd, pm3_present);
|
||||||
MainGraphics();
|
MainGraphics();
|
||||||
# else
|
# else
|
||||||
// for *nix distro's, check enviroment variable to verify a display
|
// for *nix distro's, check enviroment variable to verify a display
|
||||||
char *display = getenv("DISPLAY");
|
char *display = getenv("DISPLAY");
|
||||||
if (display && strlen(display) > 1) {
|
if (display && strlen(display) > 1) {
|
||||||
InitGraphics(argc, argv, script_cmds_file, script_cmd, usb_present);
|
InitGraphics(argc, argv, script_cmds_file, script_cmd, pm3_present);
|
||||||
MainGraphics();
|
MainGraphics();
|
||||||
} else {
|
} else {
|
||||||
main_loop(script_cmds_file, script_cmd, usb_present);
|
main_loop(script_cmds_file, script_cmd, pm3_present);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
main_loop(script_cmds_file, script_cmd, usb_present);
|
main_loop(script_cmds_file, script_cmd, pm3_present);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Clean up the port
|
// Clean up the port
|
||||||
if (usb_present) {
|
if (pm3_present) {
|
||||||
CloseProxmark();
|
CloseProxmark();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ extern "C" {
|
||||||
|
|
||||||
const char *get_my_executable_path(void);
|
const char *get_my_executable_path(void);
|
||||||
const char *get_my_executable_directory(void);
|
const char *get_my_executable_directory(void);
|
||||||
void main_loop(char *script_cmds_file, char *script_cmd, bool usb_present);
|
void main_loop(char *script_cmds_file, char *script_cmd, bool pm3_present);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue