Fix compile errors on Linux

half-duplex
M0VSE 2021-06-05 01:10:31 +01:00
rodzic fbf28be5db
commit 4159e535fc
3 zmienionych plików z 11 dodań i 13 usunięć

Wyświetl plik

@ -3,7 +3,7 @@
shuttle::shuttle() shuttle::shuttle()
{ {
qInfo() << "Starting USB device detection";
} }
shuttle::~shuttle() shuttle::~shuttle()
@ -75,7 +75,7 @@ void shuttle::run()
wchar_t product[MAX_STR]; wchar_t product[MAX_STR];
res = hid_get_manufacturer_string(handle, manufacturer, MAX_STR); res = hid_get_manufacturer_string(handle, manufacturer, MAX_STR);
res = hid_get_product_string(handle, product, MAX_STR); res = hid_get_product_string(handle, product, MAX_STR);
qDebug() << QString("Found Device: %0 from %1").arg(QString::fromWCharArray(product)).arg(QString::fromWCharArray(manufacturer)); qInfo() << QString("Found Device: %0 from %1").arg(QString::fromWCharArray(product)).arg(QString::fromWCharArray(manufacturer));
hid_set_nonblocking(handle, 1); hid_set_nonblocking(handle, 1);
QTimer::singleShot(0, this, SLOT(runTimer())); QTimer::singleShot(0, this, SLOT(runTimer()));
} }
@ -90,7 +90,7 @@ void shuttle::runTimer()
;//printf("waiting...\n"); ;//printf("waiting...\n");
else if (res < 0) else if (res < 0)
{ {
qDebug() << "USB Device disconnected?"; qInfo() << "USB Device disconnected?";
hid_close(handle); hid_close(handle);
QTimer::singleShot(1000, this, SLOT(run())); QTimer::singleShot(1000, this, SLOT(run()));
return; return;
@ -104,7 +104,7 @@ void shuttle::runTimer()
<< hex << (unsigned char)data[3] << ":" << hex << (unsigned char)data[3] << ":"
<< hex << (unsigned char)data[4]; << hex << (unsigned char)data[4];
unsigned int tempButtons = unsigned int((unsigned char)data[3] | (unsigned char)data[4] << 8); unsigned int tempButtons = (unsigned int)((unsigned char)data[3] | (unsigned char)data[4] << 8);
unsigned char tempJogpos = (unsigned char)data[1]; unsigned char tempJogpos = (unsigned char)data[1];
unsigned char tempShutpos = (unsigned char)data[0]; unsigned char tempShutpos = (unsigned char)data[0];
@ -161,7 +161,7 @@ void shuttle::runTimer()
emit button7(true); emit button7(true);
} }
buttons = unsigned int((unsigned char)data[3] | (unsigned char)data[4] << 8); buttons = (unsigned int)((unsigned char)data[3] | (unsigned char)data[4] << 8);
jogpos = (unsigned char)data[1]; jogpos = (unsigned char)data[1];
shutpos = (unsigned char)data[0]; shutpos = (unsigned char)data[0];

Wyświetl plik

@ -2,10 +2,10 @@
#define SHUTTLE_H #define SHUTTLE_H
#include <iostream> #include <iostream>
#include <qthread > #include <QThread>
#include <QCoreApplication> #include <QCoreApplication>
#include <QTimer> #include <QTimer>
#include "hidapi.h" #include "hidapi/hidapi.h"
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
//Headers needed for sleeping. //Headers needed for sleeping.
@ -65,4 +65,4 @@ protected:
}; };
#endif #endif

Wyświetl plik

@ -6,8 +6,6 @@
QT += core gui serialport network multimedia QT += core gui serialport network multimedia
QT += usb
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = wfview TARGET = wfview
@ -92,7 +90,7 @@ CONFIG(debug, release|debug) {
} }
#linux:LIBS += -L./ -l$$QCPLIB -lpulse -lpulse-simple -lpthread #linux:LIBS += -L./ -l$$QCPLIB -lpulse -lpulse-simple -lpthread
linux:LIBS += -L./ -l$$QCPLIB -lhidapi linux:LIBS += -L./ -l$$QCPLIB -lhidapi-libusb
macx:LIBS += -framework CoreAudio -framework CoreFoundation -lpthread macx:LIBS += -framework CoreAudio -framework CoreFoundation -lpthread
win32:LIBS += -L../hidapi/windows/release -lhidapi win32:LIBS += -L../hidapi/windows/release -lhidapi
@ -129,7 +127,7 @@ SOURCES += main.cpp\
repeatersetup.cpp \ repeatersetup.cpp \
rigctld.cpp \ rigctld.cpp \
ring/ring.cpp \ ring/ring.cpp \
shuttle.cpp shuttle.cpp
HEADERS += wfmain.h \ HEADERS += wfmain.h \
commhandler.h \ commhandler.h \
@ -155,7 +153,7 @@ HEADERS += wfmain.h \
rigctld.h \ rigctld.h \
ulaw.h \ ulaw.h \
ring/ring.h \ ring/ring.h \
shuttle.h shuttle.h
FORMS += wfmain.ui \ FORMS += wfmain.ui \