mirror of
https://github.com/genodelabs/genode.git
synced 2025-03-14 00:06:40 +00:00
libusb: warn once and freeze when device vanishs
Instead of repeatedly printing error messages when a device is not available anymore, print an error once and then sleep forever. There is no dynamic behaviour with respect to device availability implemented in the libusb yet. Instead, you can manage libusb components externally. Ref genodelabs/genode#5401
This commit is contained in:
parent
ebb159d32d
commit
d3002b26ac
@ -17,6 +17,7 @@
|
||||
#include <base/allocator_avl.h>
|
||||
#include <base/signal.h>
|
||||
#include <base/tslab.h>
|
||||
#include <base/sleep.h>
|
||||
#include <usb_session/device.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
@ -168,6 +169,11 @@ void Usb_device::Interface::handle_events()
|
||||
/* complete USB request */
|
||||
[this] (Urb &urb, Usb::Tagged_packet::Return_value v)
|
||||
{
|
||||
if (v == Usb::Tagged_packet::NO_DEVICE) {
|
||||
error("USB device has vanished, will freeze!");
|
||||
sleep_forever();
|
||||
}
|
||||
|
||||
if (v != Usb::Tagged_packet::OK)
|
||||
error("transfer failed, return value ", (int)v);
|
||||
|
||||
@ -218,6 +224,11 @@ void Usb_device::handle_events()
|
||||
/* complete USB request */
|
||||
[this] (Urb &urb, Usb::Tagged_packet::Return_value v)
|
||||
{
|
||||
if (v == Usb::Tagged_packet::NO_DEVICE) {
|
||||
error("USB device has vanished, will freeze!");
|
||||
sleep_forever();
|
||||
}
|
||||
|
||||
if (v != Usb::Tagged_packet::OK)
|
||||
error("control transfer failed, return value ", (int)v);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user