Merge branch 'master' into desf_update2
This commit is contained in:
7 files changed
+177
-102
No files matched your search
@@ -313,10 +313,7 @@ int CLIGetOptionList(struct arg_str *argstr, const CLIParserOption *option_array
|
||||
|
||||
int val = -1;
|
||||
int cntr = 0;
|
||||
for (int i = 0; i < CLI_MAX_OPTLIST_LEN; i++) {
|
||||
// end of array
|
||||
if (option_array[i].text == NULL)
|
||||
break;
|
||||
for (int i = 0; i < CLI_MAX_OPTLIST_LEN && option_array[i].text != NULL; i++) {
|
||||
// exact match
|
||||
if (strcmp(option_array[i].text, data) == 0) {
|
||||
*value = option_array[i].code;
|
||||
@@ -345,10 +342,8 @@ int CLIGetOptionList(struct arg_str *argstr, const CLIParserOption *option_array
|
||||
|
||||
const char *CLIGetOptionListStr(const CLIParserOption *option_array, int value) {
|
||||
static const char *errmsg = "n/a";
|
||||
|
||||
for (int i = 0; i < CLI_MAX_OPTLIST_LEN; i++) {
|
||||
if (option_array[i].text == NULL)
|
||||
break;
|
||||
|
||||
for (int i = 0; i < CLI_MAX_OPTLIST_LEN && option_array[i].text != NULL; i++) {
|
||||
if (option_array[i].code == value)
|
||||
return option_array[i].text;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@ E9920427
|
||||
50520901
|
||||
# iCopy-X
|
||||
20206666
|
||||
# ID/HID CARD COPER SK-663
|
||||
65857569
|
||||
# Default pwd, simple:
|
||||
00000000
|
||||
11111111
|
||||
|
||||
@@ -231,7 +231,7 @@ static void asn1_tag_dump_integer(const struct tlv *tlv, const struct asn1_tag *
|
||||
return;
|
||||
}
|
||||
uint32_t val = asn1_value_integer(tlv, 0, tlv->len * 2);
|
||||
PrintAndLogEx(NORMAL, " value: %lu (0x%X)", val, val);
|
||||
PrintAndLogEx(NORMAL, " value: %" PRIu32 " (0x%X)", val, val);
|
||||
}
|
||||
|
||||
static char *asn1_oid_description(const char *oid, bool with_group_desc) {
|
||||
@@ -327,7 +327,7 @@ bool asn1_tag_dump(const struct tlv *tlv, int level, bool *candump) {
|
||||
*/
|
||||
|
||||
PrintAndLogEx(INFO,
|
||||
"%*s-- %02X [%02X] '"_YELLOW_("%s") "'" NOLF
|
||||
"%*s-- %02X [%02ZX] '"_YELLOW_("%s") "'" NOLF
|
||||
, (level * 4)
|
||||
, " "
|
||||
, tlv->tag
|
||||
|
||||
+39
-21
@@ -105,8 +105,13 @@ void ProxGuiQT::_HideGraphWindow(void) {
|
||||
|
||||
// picture viewer
|
||||
void ProxGuiQT::_ShowPictureWindow(char *fn) {
|
||||
|
||||
if (!plotapp)
|
||||
return;
|
||||
|
||||
if (fn == NULL)
|
||||
return;
|
||||
|
||||
size_t slen = strlen(fn);
|
||||
if (slen == 0)
|
||||
return;
|
||||
@@ -117,16 +122,13 @@ void ProxGuiQT::_ShowPictureWindow(char *fn) {
|
||||
|
||||
memcpy(myfn, fn, slen);
|
||||
|
||||
if (!plotapp)
|
||||
return;
|
||||
|
||||
if (!pictureWidget) {
|
||||
|
||||
#if defined(__MACH__) && defined(__APPLE__)
|
||||
makeFocusable();
|
||||
#endif
|
||||
|
||||
pictureWidget = new QWidget();
|
||||
pictureWidget = new PictureWidget();
|
||||
}
|
||||
|
||||
QPixmap pm;
|
||||
@@ -169,14 +171,6 @@ void ProxGuiQT::_Exit(void) {
|
||||
delete this;
|
||||
}
|
||||
|
||||
void ProxGuiQT::closeEvent(QCloseEvent *event) {
|
||||
event->ignore();
|
||||
pictureWidget->hide();
|
||||
}
|
||||
void ProxGuiQT::hideEvent(QHideEvent *event) {
|
||||
pictureWidget->hide();
|
||||
}
|
||||
|
||||
void ProxGuiQT::_StartProxmarkThread(void) {
|
||||
if (!proxmarkThread)
|
||||
return;
|
||||
@@ -190,11 +184,19 @@ void ProxGuiQT::_StartProxmarkThread(void) {
|
||||
|
||||
void ProxGuiQT::MainLoop() {
|
||||
plotapp = new QApplication(argc, argv);
|
||||
|
||||
|
||||
// Setup the picture widget
|
||||
pictureWidget = new QWidget();
|
||||
pictureWidget = new PictureWidget();
|
||||
pictureController = new Ui::PictureForm();
|
||||
pictureController->setupUi(pictureWidget);
|
||||
// pictureWidget->setAttribute(Qt::WA_DeleteOnClose,true);
|
||||
|
||||
// Set picture widget position if no settings.
|
||||
if (session.preferences_loaded == false) {
|
||||
// Move controller widget below plot
|
||||
//pictureController->move(x(), y() + frameSize().height());
|
||||
//pictureController->resize(size().width(), 200);
|
||||
}
|
||||
|
||||
connect(this, SIGNAL(ShowGraphWindowSignal()), this, SLOT(_ShowGraphWindow()));
|
||||
connect(this, SIGNAL(RepaintGraphWindowSignal()), this, SLOT(_RepaintGraphWindow()));
|
||||
@@ -207,7 +209,6 @@ void ProxGuiQT::MainLoop() {
|
||||
connect(this, SIGNAL(RepaintPictureWindowSignal()), this, SLOT(_RepaintPictureWindow()));
|
||||
connect(this, SIGNAL(HidePictureWindowSignal()), this, SLOT(_HidePictureWindow()));
|
||||
|
||||
|
||||
//start proxmark thread after starting event loop
|
||||
QTimer::singleShot(200, this, SLOT(_StartProxmarkThread()));
|
||||
|
||||
@@ -216,12 +217,12 @@ void ProxGuiQT::MainLoop() {
|
||||
makeUnfocusable();
|
||||
#endif
|
||||
|
||||
|
||||
plotapp->exec();
|
||||
}
|
||||
|
||||
ProxGuiQT::ProxGuiQT(int argc, char **argv, WorkerThread *wthread) : plotapp(NULL), plotwidget(NULL),
|
||||
argc(argc), argv(argv), proxmarkThread(wthread) {
|
||||
ProxGuiQT::ProxGuiQT(int argc, char **argv, WorkerThread *wthread) :
|
||||
plotapp(NULL), plotwidget(NULL), pictureController(NULL), pictureWidget(NULL), argc(argc), argv(argv), proxmarkThread(wthread) {
|
||||
|
||||
}
|
||||
|
||||
ProxGuiQT::~ProxGuiQT(void) {
|
||||
@@ -243,6 +244,24 @@ ProxGuiQT::~ProxGuiQT(void) {
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------
|
||||
// Slider Widget form based on a class to enable
|
||||
// Event override functions
|
||||
// -------------------------------------------------
|
||||
PictureWidget::PictureWidget() {
|
||||
// Set the initail postion and size from settings
|
||||
// if (session.preferences_loaded)
|
||||
// setGeometry(session.pw.x, session.pw.y, session.pw.w, session.pw.h);
|
||||
// else
|
||||
resize(400, 400);
|
||||
}
|
||||
|
||||
void PictureWidget::closeEvent(QCloseEvent *event) {
|
||||
this->hide();
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------
|
||||
// Slider Widget form based on a class to enable
|
||||
// Event override functions
|
||||
@@ -318,8 +337,7 @@ ProxWidget::ProxWidget(QWidget *parent, ProxGuiQT *master) : QWidget(parent) {
|
||||
resize(800, 400);
|
||||
|
||||
// Setup the controller widget
|
||||
controlWidget = new SliderWidget(); //new QWidget();
|
||||
|
||||
controlWidget = new SliderWidget();
|
||||
opsController = new Ui::Form();
|
||||
opsController->setupUi(controlWidget);
|
||||
//Due to quirks in QT Designer, we need to fiddle a bit
|
||||
@@ -355,7 +373,7 @@ ProxWidget::ProxWidget(QWidget *parent, ProxGuiQT *master) : QWidget(parent) {
|
||||
show();
|
||||
|
||||
// Set Slider/Overlay position if no settings.
|
||||
if (!session.preferences_loaded) {
|
||||
if (session.preferences_loaded == false) {
|
||||
// Move controller widget below plot
|
||||
controlWidget->move(x(), y() + frameSize().height());
|
||||
controlWidget->resize(size().width(), 200);
|
||||
|
||||
+10
-7
@@ -71,6 +71,14 @@ class SliderWidget : public QWidget {
|
||||
SliderWidget();
|
||||
};
|
||||
|
||||
// Added class for SliderWidget to allow move/resize event override
|
||||
class PictureWidget : public QWidget {
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
public:
|
||||
PictureWidget();
|
||||
};
|
||||
|
||||
/**
|
||||
* The window with plot and controls
|
||||
*/
|
||||
@@ -126,10 +134,9 @@ class ProxGuiQT : public QObject {
|
||||
private:
|
||||
QApplication *plotapp;
|
||||
ProxWidget *plotwidget;
|
||||
|
||||
Ui::PictureForm *pictureController;
|
||||
QWidget *pictureWidget;
|
||||
|
||||
PictureWidget *pictureWidget;
|
||||
|
||||
int argc;
|
||||
char **argv;
|
||||
//void (*main_func)(void);
|
||||
@@ -150,10 +157,6 @@ class ProxGuiQT : public QObject {
|
||||
void MainLoop(void);
|
||||
void Exit(void);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void hideEvent(QHideEvent *event);
|
||||
|
||||
private slots:
|
||||
void _ShowGraphWindow(void);
|
||||
void _RepaintGraphWindow(void);
|
||||
|
||||
Reference in new issue
Block a user