diff --git a/libusb/driver.c b/libusb/driver.c index ae40e4f..fe92268 100644 --- a/libusb/driver.c +++ b/libusb/driver.c @@ -86,7 +86,7 @@ int usb_open(usb_devinfo_t *dev, usb_transfer_type_t type, usb_dir_t dir) if ((ret = msgSend(usbdrv_common.port, &msg)) != 0) return ret; - return *(int *)msg.o.raw; + return msg.o.err; } @@ -194,7 +194,7 @@ int usb_urbAlloc(unsigned pipe, void *data, usb_dir_t dir, size_t size, int type return ret; /* URB id */ - return *(int *)msg.o.raw; + return msg.o.err; } diff --git a/usb/usb.c b/usb/usb.c index c7ce959..0d84a2e 100644 --- a/usb/usb.c +++ b/usb/usb.c @@ -182,9 +182,7 @@ static int usb_handleOpen(usb_open_t *o, msg_t *msg) if ((pipe = usb_drvPipeOpen(drv, hcd, o->locationID, o->iface, o->dir, o->type)) < 0) return -EINVAL; - *(int *)msg->o.raw = pipe; - - return 0; + return pipe; } @@ -274,8 +272,7 @@ static void usb_msgthr(void *arg) msg.o.err = usb_handleConnect(&msg, &umsg->connect); break; case usb_msg_open: - if (usb_handleOpen(&umsg->open, &msg) != 0) - msg.o.err = -1; + msg.o.err = usb_handleOpen(&umsg->open, &msg); break; case usb_msg_urb: ret = usb_handleUrb(&msg, port, rid);