Commit Graph

15 Commits

Author SHA1 Message Date
Hendiadyoin1
92e2e309d3 Kernel/USB: Add and use a shared function to set a device's interface 2024-10-30 18:47:50 -04:00
Hendiadyoin1
66cfe47ed8 Kernel/USBMS: Add a basic UAS driver
For now we only support USB <3.0 devices, as we don't support streams.
We also don't leverage the benefits of UAS, as we pretend to have a
queue depth of 1, ie are single threaded.

To test this driver, you can use the following command:
```
SERENITY_BOOT_DRIVE=usb-uas Meta/serenity.sh run x86_64 Clang
```
2024-10-30 18:47:50 -04:00
Hendiadyoin1
435d78c575 Kernel/USBMS: Move the BOT/BBB driver to its own directory 2024-10-30 18:47:50 -04:00
Sönke Holz
fe27198994 Kernel/USBMS: Print the USB VID:PID in a nicer format 2024-09-25 14:41:23 -04:00
Sönke Holz
54709af2f5 Kernel/USBMS: Perform a Reset Recovery when CSW transport fails twice
This requires storing a const reference to the interface, as the
Bulk-Only Mass Storage Reset request takes the interface number as an
argument.
2024-09-25 14:41:23 -04:00
Sönke Holz
7173a02728 Kernel/USBMS: Move device initialization to BulkSCSIInterface 2024-09-25 14:41:23 -04:00
Sönke Holz
c5f4469b32 Kernel/USBMS: Move StorageDevice functions into a separate class
This will allow us to make send_scsi_command a member function. This is
necessary because we need to execute some SCSI commands
(with send_scsi_command) to get all arguments necessary for the
StorageDevice constructor.

This change should will likely also be necessary to support USB mass
storage devices with multiple LUNs.
2024-09-25 14:41:23 -04:00
Sönke Holz
e2919f92ff Kernel/USBMS: Accept SCSI version 0
Some devices seem to have this field set to 0.
0 means "The device does not claim conformance to any standard."
2024-09-25 14:41:23 -04:00
Sönke Holz
7e3dc5b721 Kernel/USB: Rename endpoint_address to endpoint_number where appropriate
"Endpoint Address" refers to "[t]he combination of an endpoint number
and an endpoint direction on a USB device."
(USB 2.0 Specification, Chapter 2)

The USB::Pipe m_endpoint_address member doesn't have the direction part,
so rename it and all variables/functions associated with it
appropriately.
2024-09-25 14:41:23 -04:00
Hendiadyoin1
0d2e8ec96f Kernel/USBMS: Inquire and wait for the storage device to become ready
This is apparently what bootloaders do before using a USB storage device
so we should likely do so as well, especially when no BIOS is present,
like on riscv.

Co-Authored-By: Sönke Holz <sholz8530@gmail.com>
2024-08-20 22:06:51 -04:00
Hendiadyoin1
e3567969d4 Kernel/USBMS: Add and use a send_scsi_command helper
This makes sending commands less repetitive
2024-08-20 22:06:51 -04:00
Sönke Holz
d82148aae1 Kernel/USB: Don't truncate the max packet size in the MassStorage driver 2024-08-07 18:30:06 -04:00
Idan Horowitz
c35446b232 Kernel: Give USB::Pipe a reference to its owning USB::Device
Previously USB::Pipe would just try to poorly maintain copies of some
of the relevant properties of USB::Device. (address & speed)
Now it just holds a reference to it's owning device and can query them
when needed.
2024-07-26 14:25:49 -04:00
Andrew Kaster
91816c15f8 Kernel: Don't register USB devices if USBManagement is not initialized 2023-10-17 11:02:25 -06:00
Hendiadyoin1
29292bbdbf Kernel/USB: Add a crude USB MassStorage driver :^) 2023-09-29 16:14:47 -06:00