Skip to content

Errors during get_configuration_descriptors get silently eaten #58

@lkolbly

Description

@lkolbly

https://github.com/mvirkkunen/usb-device/blob/258ad5b9e44b6ef9b0b7fa55254b12db0a53fc3f/src/device.rs#L413-L417

If get_configuration_descriptors throws an error (e.g. because of a buffer overflow), the error will exit the .accept() call and then get dropped by the .ok() (which will convert errors to None and drop the error). This makes it somewhat more difficult to debug when the configuration descriptors are too long (for example).

I'm not entirely sure what the correct behaviour should be. One option would be to unwrap() and panic (which is probably reasonable here, since it'll always panic essentially when the device boots, so it's easy to detect). The other option would be to make get_descriptor (and therefore control_in) return Result, which is probably the much more invasive solution (it'd be difficult to integrate with various class drivers).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions