-/* $OpenBSD: if_ure.c,v 1.26 2021/08/13 01:24:22 gnezdo Exp $ */
+/* $OpenBSD: if_ure.c,v 1.27 2021/08/20 01:40:51 kevlo Exp $ */
/*-
* Copyright (c) 2015, 2016, 2019 Kevin Lo <kevlo@openbsd.org>
* Copyright (c) 2020 Jonathon Fletcher <jonathon.fletcher@gmail.com>
usbd_status err;
if (usbd_is_dying(sc->ure_udev))
- return 0;
+ return -1;
if (rw == URE_CTL_WRITE)
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
err = usbd_do_request(sc->ure_udev, &req, buf);
if (err) {
DPRINTF(("ure_ctl: error %d\n", err));
+ if (err == USBD_CANCELLED || err == USBD_TIMEOUT)
+ usbd_deactivate(sc->ure_udev);
return -1;
}