Skip to content

Commit

Permalink
Fixed some non OS X bugs with missing defines. Also remove some extra…
Browse files Browse the repository at this point in the history
… unused code in the USB fronted.
  • Loading branch information
Christian Weber authored and Christian Weber committed Aug 10, 2014
1 parent a7c1d9f commit 73cf8f6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/usb/backend/native_usb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,14 @@ int native_usb::write_usb(QByteArray packet)
QByteArray correct_packet;
int actual_length;

#if defined(Q_OS_MAC)
if(usb == -1)
return -1;
#endif
#if defined(Q_OS_LINUX) || defined(Q_OS_WIN)
if(usb == NULL)
return -1;
#endif

if(packet.length() > 64)
return -1;
Expand Down
9 changes: 2 additions & 7 deletions src/usb/v800usb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ QList<QString> V800usb::get_v800_data(QString request, bool debug)
{
if(!request.contains(tr(".")))
{
data = extract_dir_and_files(full, debug);
data = extract_dir_and_files(full);

qDebug("Directory request finished!");
}
Expand Down Expand Up @@ -292,10 +292,9 @@ QList<QString> V800usb::get_v800_data(QString request, bool debug)
return data;
}

QList<QString> V800usb::extract_dir_and_files(QByteArray full, bool debug)
QList<QString> V800usb::extract_dir_and_files(QByteArray full)
{
QList<QString> dir_and_files;
char unknown_byte;
int full_state = 0, size = 0, loc = 0;

while(loc < full.length())
Expand All @@ -309,7 +308,6 @@ QList<QString> V800usb::extract_dir_and_files(QByteArray full, bool debug)
full_state = 1;
}

unknown_byte = (char)full[loc];
loc++;
break;
case 1: /* is this the second 0x0A? */
Expand All @@ -329,9 +327,6 @@ QList<QString> V800usb::extract_dir_and_files(QByteArray full, bool debug)
case 3: /* now get the full string */
QString name(tr(QByteArray(full.constData()+loc, size)));

if(debug)
name.prepend(QString(tr("%1")).arg(unknown_byte));

dir_and_files.append(name);

full_state = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/usb/v800usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public slots:
void get_file(QString path, QString save_dir);

private:
QList<QString> extract_dir_and_files(QByteArray full, bool debug=false);
QList<QString> extract_dir_and_files(QByteArray full);
QByteArray generate_request(QString request);
QByteArray generate_ack(unsigned char packet_num);
int is_end(QByteArray packet);
Expand Down

0 comments on commit 73cf8f6

Please sign in to comment.