Skip to content

Commit

Permalink
Fix libusb context null problem
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Mar 28, 2022
1 parent 2b80421 commit 474d40b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/libusb.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define COMMON_H

#include <libusb.h>
static libusb_context *context = nullptr;
extern libusb_context *context;

#endif

3 changes: 3 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
#include "mainwindow.h"
#include <QApplication>

libusb_context *context = nullptr;

int main(int argc, char *argv[]) {
auto rc = libusb_init(&context);
Q_ASSERT(rc >= 0);
Q_ASSERT(context != nullptr);

QCoreApplication::setOrganizationName("TUNA");
QCoreApplication::setOrganizationDomain("tuna.tsinghua.edu.cn");
Expand Down

0 comments on commit 474d40b

Please sign in to comment.