diff --git a/include/gint/usb.h b/include/gint/usb.h index 66e4a63..0ccc08f 100644 --- a/include/gint/usb.h +++ b/include/gint/usb.h @@ -39,6 +39,8 @@ enum { USB_OPEN_MISSING_DATA, /* Invalid parameters: bad endpoint numbers, bad buffer sizes... */ USB_OPEN_INVALID_PARAMS, + /* USB interfaces are already opened */ + USB_OPEN_ALREADY_OPEN, /* This pipe is busy (returned by usb_write_async()) */ USB_WRITE_BUSY, diff --git a/src/usb/usb.c b/src/usb/usb.c index 8e25a10..c0e7228 100644 --- a/src/usb/usb.c +++ b/src/usb/usb.c @@ -121,6 +121,9 @@ static void hpoweroff(void) int usb_open(usb_interface_t const **interfaces, gint_call_t callback) { + if(usb_open_status) + return USB_OPEN_ALREADY_OPEN; + /* TODO: Check whether the calculator can host devices (probably no) */ bool host = false;