1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:57:44 +00:00

Kernel/Userland: Expose usb device address and use it in lsusb

We now expose the `USBDevice`'s address in the SysFS object. This means
that device addresses are no longer determined by the name of the file
in the `/bus/usb/` directory. This was an incorrect way of determining
device address, as a standard PC can have multiple USB controllers
(and hence multiple buses) that can have overlapping device IDs.
This commit is contained in:
Jesse Buhagiar 2021-08-29 16:24:55 +10:00 committed by Andreas Kling
parent 32b4470ea3
commit 59eab8148d
2 changed files with 4 additions and 3 deletions

View file

@ -29,6 +29,7 @@ KResultOr<size_t> SysFSUSBDeviceInformation::read_bytes(off_t offset, size_t cou
JsonArraySerializer array { builder };
auto obj = array.add_object();
obj.add("device_address", m_device->address());
obj.add("usb_spec_compliance_bcd", m_device->device_descriptor().usb_spec_compliance_bcd);
obj.add("device_class", m_device->device_descriptor().device_class);
obj.add("device_sub_class", m_device->device_descriptor().device_sub_class);