mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2024-12-28 20:43:36 +01:00
usb: prevent double opening
This could happen in gintctl's USB tracer and obviously cause all sorts of problems.
This commit is contained in:
parent
53c67af52d
commit
c0671649df
2 changed files with 5 additions and 0 deletions
|
@ -39,6 +39,8 @@ enum {
|
||||||
USB_OPEN_MISSING_DATA,
|
USB_OPEN_MISSING_DATA,
|
||||||
/* Invalid parameters: bad endpoint numbers, bad buffer sizes... */
|
/* Invalid parameters: bad endpoint numbers, bad buffer sizes... */
|
||||||
USB_OPEN_INVALID_PARAMS,
|
USB_OPEN_INVALID_PARAMS,
|
||||||
|
/* USB interfaces are already opened */
|
||||||
|
USB_OPEN_ALREADY_OPEN,
|
||||||
|
|
||||||
/* This pipe is busy (returned by usb_write_async()) */
|
/* This pipe is busy (returned by usb_write_async()) */
|
||||||
USB_WRITE_BUSY,
|
USB_WRITE_BUSY,
|
||||||
|
|
|
@ -121,6 +121,9 @@ static void hpoweroff(void)
|
||||||
|
|
||||||
int usb_open(usb_interface_t const **interfaces, gint_call_t callback)
|
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) */
|
/* TODO: Check whether the calculator can host devices (probably no) */
|
||||||
bool host = false;
|
bool host = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue