summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorJesse Buhagiar <jooster669@gmail.com>2021-08-29 16:24:55 +1000
committerAndreas Kling <kling@serenityos.org>2021-08-31 16:38:49 +0200
commit59eab8148d8442929dff0a348d5d7b3450685522 (patch)
treed5341ba81d89079203d53ef0b34acc61a420f209 /Kernel
parent32b4470ea37f1e27b32947788a914a8161818ad3 (diff)
downloadserenity-59eab8148d8442929dff0a348d5d7b3450685522.zip
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.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Bus/USB/SysFSUSB.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/Kernel/Bus/USB/SysFSUSB.cpp b/Kernel/Bus/USB/SysFSUSB.cpp
index 482ddd8262..6c629194af 100644
--- a/Kernel/Bus/USB/SysFSUSB.cpp
+++ b/Kernel/Bus/USB/SysFSUSB.cpp
@@ -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);