When I am ripping WAV files from audio CDs, I’ve found that Haiku (hrev 59378 Walter (x86_64)) recognises an internal optical drive but not an optical drive connected to my PC via USB cable. Is there some way to set up Haiku to recognise USB optical drives?
There are open tickets about this, I think. The short version is that the USB disk driver currently does not have logic for detecting when USB disk drives with removable media have media changes like this.
IIRC, if you have a disc already in the drive when you plug it in, then Haiku might detect it and let it work normally.
I tried booting Haiku with a USB optical drive with a compact disc already loaded but it seems Haiku can see the drive (at least it shows up in DriveSetup) but not the compact disc itself. I have an internal drive that I can slot in to the Thinkpad’s Ultrabase so this isn’t a major inconvenience.However, it would be great if Haiku could allow USB optical disc drives to be connected in the future.
The main problem here is attempting to read an audio CD (not a CDRom) using an USB CDRom drive. I’m not sure if that’s even possible at all, but if it is, it will have to be done with specific SCSI commands (or possibly ATAPI), which our USB driver definitely doesn’t implement.
There has been the idea of refactoring the USB driver to use the generic SCSI implementation floating around for years, it would make this possible, but the SCSI generic implementation uses commands that USB devices may not support in general. And we can’t just try some of these commands and see if they work, because that will crash some USB devices.
When I connect this particular optical drive to a Windows 10 or a FerenOS (Ubuntu-based Linux distro), they seem to have USB drivers which can read the drive, as I am able to play back the music CD using VLC. On the other hand, Haiku and GhostBSD (based on FreeBSD) are unable to read the files on the music CD contained in the USB optical disc drive. So I guess it’s down to what the USB drivers are designed to do in each OS.
Thanks for the background link. Here below is the output of my listusb -v. It doesn’t say anything about UASP but it does say that the protocol is a SCSI, Bulk-Only Mass Storage, so perhaps it falls within this class of USB peripherals which are not yet supported in Haiku (or the BSDs)?
==
[Device /dev/bus/usb/0/2/3]
Class … 0x00 (Defined at Interface level) ()
Subclass … 0x00 (Defined at Interface level) ()
Protocol … 0x00 (Defined at Interface level) ()
Max Endpoint 0 Packet .. 64
USB Version … 2.16
Vendor ID … 0x0789 (Logitec Corp.)
Product ID … 0x0276
Product Version … 0x0100
Manufacturer String … “Logitec”
Product String … “LDR USB Device”
Serial Number … “2001080276A000D1”
[Configuration 0]
Configuration String . “”
[Interface 0]
[Alternate 0 active]
Class … 0x08 Mass Storage ()
Subclass … 0x06 Mass Storage (SCSI, Control/Bulk/Interrupt)
Protocol … 0x50 Mass Storage (SCSI, Bulk-Only)
Interface String … “”
[Endpoint 0]
MaxPacketSize … 1x 512 bytes
Interval … 0
Type … Bulk
Direction … Input
[Endpoint 1]
MaxPacketSize … 1x 512 bytes
Interval … 0
Type … Bulk
Direction … Output
[Device /dev/bus/usb/0/2/hub]
Class … 0x09 Hub (Unused, Full speed (or root) hub)
Subclass … 0x00 Hub (Unused, Full speed (or root) hub)
Protocol … 0x02 Hub (Unused, TT per port)
Max Endpoint 0 Packet .. 64
USB Version … 2.0
Vendor ID … 0x0424 (Microchip Technology, Inc. (formerly SMSC))
Product ID … 0x2514 (USB 2.0 Hub)
Product Version … 0x0000
Manufacturer String … “”
Product String … “”
Serial Number … “”
[Configuration 0]
Configuration String . “”
[Interface 0]
[Alternate 0 active]
Class … 0x09 Hub (Unused, Full speed (or root) hub)
Subclass … 0x00 Hub (Unused, Full speed (or root) hub)
Protocol … 0x01 Hub (Unused, Single TT)
Interface String … “”
[Endpoint 0]
MaxPacketSize … 1x 1 bytes
Interval … 12
Type … Interrupt
Direction … Input
[Alternate 1]
Class … 0x09 Hub (Unused, Full speed (or root) hub)
Subclass … 0x00 Hub (Unused, Full speed (or root) hub)
Protocol … 0x02 Hub (Unused, TT per port)
Interface String … “”
[Endpoint 0]
MaxPacketSize … 1x 1 bytes
Interval … 12
Type … Interrupt
Direction … Input
Hub ports count … 4
Hub Controller Current . 1mA
Port 1 status … 0100.0000 Power
Port 2 status … 0100.0000 Power
Port 3 status … 0100.0000 Power
Port 4 status … 0503.0000 Connect Enable Power
[Device /dev/bus/usb/0/hub]
Class … 0x09 Hub (Unused, Full speed (or root) hub)
Subclass … 0x00 Hub (Unused, Full speed (or root) hub)
Protocol … 0x03 Hub (Unused, TT per port)
Max Endpoint 0 Packet .. 9
USB Version … 3.0
Vendor ID … 0x0000
Product ID … 0x0000
Product Version … 0x0300
Manufacturer String … “HAIKU Inc.”
Product String … “XHCI RootHub”
Serial Number … “”
[Configuration 0]
Configuration String . “”
[Interface 0]
[Alternate 0 active]
Class … 0x09 Hub (Unused, Full speed (or root) hub)
Subclass … 0x00 Hub (Unused, Full speed (or root) hub)
Protocol … 0x00 Hub (Unused, Full speed (or root) hub)
Interface String … “”
[Endpoint 0]
MaxPacketSize … 1x 2 bytes
Interval … 255
Type … Interrupt
Direction … Input
[Descriptor 0]
Type … 0x30 Endpoint SuperSpeed Companion
MaxBurst … 0x00
Attributes … 0x00
Bytes per Interval 0x00
[Descriptor 1]
Length … 0x09
Type … 0x29
Data … 08 00 00 0a 00 00 ff
Hub ports count … 8
Hub Controller Current . 0mA
Port 1 status … 0100.0000 Power
Port 2 status … 0100.0000 Power
Port 3 status … 0503.0000 Connect Enable Power
Port 4 status … 0100.0000 Power
Port 5 status … 02a0.0000
Port 6 status … 02a0.0000
Port 7 status … 02a0.0000
Port 8 status … 02a0.0000
[Device /dev/bus/usb/1/0/2]
Class … 0x00 (Defined at Interface level) ()
Subclass … 0x00 (Defined at Interface level) ()
Protocol … 0x00 (Defined at Interface level) ()
Max Endpoint 0 Packet .. 8
USB Version … 1.16
Vendor ID … 0x147e (Upek)
Product ID … 0x2020 (TouchChip Fingerprint Coprocessor (WBF advanced mode))
Product Version … 0x0001
Manufacturer String … “Auth”
Product String … “Biometric Coprocessor”
Serial Number … “”
[Configuration 0]
Configuration String . “”
[Interface 0]
[Alternate 0 active]
Class … 0xff Vendor Specific Class ()
Subclass … 0x00 Vendor Specific Class ()
Protocol … 0x00 Vendor Specific Class ()
Interface String … “”
[Endpoint 0]
MaxPacketSize … 1x 64 bytes
Interval … 0
Type … Bulk
Direction … Input
[Endpoint 1]
MaxPacketSize … 1x 64 bytes
Interval … 0
Type … Bulk
Direction … Output
[Endpoint 2]
MaxPacketSize … 1x 4 bytes
Interval … 20
Type … Interrupt
Direction … Input
[Device /dev/bus/usb/1/0/3]
Class … 0xff Vendor Specific Class ()
Subclass … 0x01 (Unknown) (255:1:0)
Protocol … 0x01 (Unknown) (255:1:1)
Max Endpoint 0 Packet .. 64
USB Version … 2.0
Vendor ID … 0x0a5c (Broadcom Corp.)
Product ID … 0x21e6 (BCM20702 Bluetooth 4.0 [ThinkPad])
Product Version … 0x0112
Manufacturer String … “Broadcom Corp”
Product String … “BCM20702A0”
Serial Number … “C01885DB9DFC”
[Configuration 0]
Configuration String . “”
[Interface 0]
[Alternate 0 active]
Class … 0xff Vendor Specific Class ()
Subclass … 0x01 (Unknown) (255:1:0)
Protocol … 0x01 (Unknown) (255:1:1)
Interface String … “”
[Endpoint 0]
MaxPacketSize … 1x 16 bytes
Interval … 1
Type … Interrupt
Direction … Input
[Endpoint 1]
MaxPacketSize … 1x 64 bytes
Interval … 1
Type … Bulk
Direction … Input
[Endpoint 2]
MaxPacketSize … 1x 64 bytes
Interval … 1
Type … Bulk
Direction … Output
[Interface 1]
[Alternate 0 active]
Class … 0xff Vendor Specific Class ()
Subclass … 0x01 (Unknown) (255:1:0)
Protocol … 0x01 (Unknown) (255:1:1)
Interface String … “”
[Endpoint 0]
MaxPacketSize … 1x 0 bytes
Interval … 1
Type … Isochronous
Direction … Input
[Endpoint 1]
MaxPacketSize … 1x 0 bytes
Interval … 1
Type … Isochronous
Direction … Output
[Alternate 1]
Class … 0xff Vendor Specific Class ()
Subclass … 0x01 (Unknown) (255:1:0)
Protocol … 0x01 (Unknown) (255:1:1)
Interface String … “”
[Endpoint 0]
MaxPacketSize … 1x 9 bytes
Interval … 1
Type … Isochronous
Direction … Input
[Endpoint 1]
MaxPacketSize … 1x 9 bytes
Interval … 1
Type … Isochronous
Direction … Output
[Alternate 2]
Class … 0xff Vendor Specific Class ()
Subclass … 0x01 (Unknown) (255:1:0)
Protocol … 0x01 (Unknown) (255:1:1)
Interface String … “”
[Endpoint 0]
MaxPacketSize … 1x 17 bytes
Interval … 1
Type … Isochronous
Direction … Input
[Endpoint 1]
MaxPacketSize … 1x 17 bytes
Interval … 1
Type … Isochronous
Direction … Output
[Alternate 3]
Class … 0xff Vendor Specific Class ()
Subclass … 0x01 (Unknown) (255:1:0)
Protocol … 0x01 (Unknown) (255:1:1)
Interface String … “”
[Endpoint 0]
MaxPacketSize … 1x 25 bytes
Interval … 1
Type … Isochronous
Direction … Input
[Endpoint 1]
MaxPacketSize … 1x 25 bytes
Interval … 1
Type … Isochronous
Direction … Output
[Alternate 4]
Class … 0xff Vendor Specific Class ()
Subclass … 0x01 (Unknown) (255:1:0)
Protocol … 0x01 (Unknown) (255:1:1)
Interface String … “”
[Endpoint 0]
MaxPacketSize … 1x 33 bytes
Interval … 1
Type … Isochronous
Direction … Input
[Endpoint 1]
MaxPacketSize … 1x 33 bytes
Interval … 1
Type … Isochronous
Direction … Output
[Alternate 5]
Class … 0xff Vendor Specific Class ()
Subclass … 0x01 (Unknown) (255:1:0)
Protocol … 0x01 (Unknown) (255:1:1)
Interface String … “”
[Endpoint 0]
MaxPacketSize … 1x 49 bytes
Interval … 1
Type … Isochronous
Direction … Input
[Endpoint 1]
MaxPacketSize … 1x 49 bytes
Interval … 1
Type … Isochronous
Direction … Output
[Interface 2]
[Alternate 0 active]
Class … 0xff Vendor Specific Class ()
Subclass … 0xff Vendor Specific Class (Vendor Specific Subclass)
Protocol … 0xff Vendor Specific Class (Vendor Specific Subclass, Vendor Specific Protocol)
Interface String … “”
[Endpoint 0]
MaxPacketSize … 1x 32 bytes
Interval … 1
Type … Bulk
Direction … Input
[Endpoint 1]
MaxPacketSize … 1x 32 bytes
Interval … 1
Type … Bulk
Direction … Output
[Interface 3]
[Alternate 0 active]
Class … 0xfe Application Specific Interface ()
Subclass … 0x01 Application Specific Interface (Device Firmware Update)
Protocol … 0x01 Application Specific Interface (Device Firmware Update)
Interface String … “”
[Descriptor 0]
Length … 0x09
Type … 0x21
Data … 05 88 13 40 00 10 01
[Device /dev/bus/usb/1/0/hub]
Class … 0x09 Hub (Unused, Full speed (or root) hub)
Subclass … 0x00 Hub (Unused, Full speed (or root) hub)
Protocol … 0x01 Hub (Unused, Single TT)
Max Endpoint 0 Packet .. 64
USB Version … 2.0
Vendor ID … 0x8087 (Intel Corp.)
Product ID … 0x0024 (Integrated Rate Matching Hub)
Product Version … 0x0000
Manufacturer String … “”
Product String … “”
Serial Number … “”
[Configuration 0]
Configuration String . “”
[Interface 0]
[Alternate 0 active]
Class … 0x09 Hub (Unused, Full speed (or root) hub)
Subclass … 0x00 Hub (Unused, Full speed (or root) hub)
Protocol … 0x00 Hub (Unused, Full speed (or root) hub)
Interface String … “”
[Endpoint 0]
MaxPacketSize … 1x 1 bytes
Interval … 12
Type … Interrupt
Direction … Input
Hub ports count … 6
Hub Controller Current . 0mA
Port 1 status … 0100.0000 Power
Port 2 status … 0100.0000 Power
Port 3 status … 0103.0000 Connect Enable Power
Port 4 status … 0103.0000 Connect Enable Power
Port 5 status … 0100.0000 Power
Port 6 status … 0100.0000 Power
[Device /dev/bus/usb/1/hub]
Class … 0x09 Hub (Unused, Full speed (or root) hub)
Subclass … 0x00 Hub (Unused, Full speed (or root) hub)
Protocol … 0x00 Hub (Unused, Full speed (or root) hub)
Max Endpoint 0 Packet .. 64
USB Version … 2.0
Vendor ID … 0x0000
Product ID … 0x0000
Product Version … 0x0200
Manufacturer String … “HAIKU Inc.”
Product String … “EHCI RootHub”
Serial Number … “”
[Configuration 0]
Configuration String . “”
[Interface 0]
[Alternate 0 active]
Class … 0x09 Hub (Unused, Full speed (or root) hub)
Subclass … 0x00 Hub (Unused, Full speed (or root) hub)
Protocol … 0x00 Hub (Unused, Full speed (or root) hub)
Interface String … “”
[Endpoint 0]
MaxPacketSize … 1x 8 bytes
Interval … 255
Type … Interrupt
Direction … Input
[Descriptor 0]
Length … 0x09
Type … 0x29
Data … 03 00 00 00 00 00 ff
Hub ports count … 3
Hub Controller Current . 0mA
Port 1 status … 0503.0000 Connect Enable Power
Port 2 status … 0100.0000 Power
Port 3 status … 0100.0000 Power
[Device /dev/bus/usb/2/0/hub]
Class … 0x09 Hub (Unused, Full speed (or root) hub)
Subclass … 0x00 Hub (Unused, Full speed (or root) hub)
Protocol … 0x01 Hub (Unused, Single TT)
Max Endpoint 0 Packet .. 64
USB Version … 2.0
Vendor ID … 0x8087 (Intel Corp.)
Product ID … 0x0024 (Integrated Rate Matching Hub)
Product Version … 0x0000
Manufacturer String … “”
Product String … “”
Serial Number … “”
[Configuration 0]
Configuration String . “”
[Interface 0]
[Alternate 0 active]
Class … 0x09 Hub (Unused, Full speed (or root) hub)
Subclass … 0x00 Hub (Unused, Full speed (or root) hub)
Protocol … 0x00 Hub (Unused, Full speed (or root) hub)
Interface String … “”
[Endpoint 0]
MaxPacketSize … 1x 2 bytes
Interval … 12
Type … Interrupt
Direction … Input
Hub ports count … 8
Hub Controller Current . 0mA
Port 1 status … 0100.0000 Power
Port 2 status … 0100.0000 Power
Port 3 status … 0100.0000 Power
Port 4 status … 0100.0000 Power
Port 5 status … 0100.0000 Power
Port 6 status … 0100.0000 Power
Port 7 status … 0100.0000 Power
Port 8 status … 0100.0000 Power
[Device /dev/bus/usb/2/hub]
Class … 0x09 Hub (Unused, Full speed (or root) hub)
Subclass … 0x00 Hub (Unused, Full speed (or root) hub)
Protocol … 0x00 Hub (Unused, Full speed (or root) hub)
Max Endpoint 0 Packet .. 64
USB Version … 2.0
Vendor ID … 0x0000
Product ID … 0x0000
Product Version … 0x0200
Manufacturer String … “HAIKU Inc.”
Product String … “EHCI RootHub”
Serial Number … “”
[Configuration 0]
Configuration String . “”
[Interface 0]
[Alternate 0 active]
Class … 0x09 Hub (Unused, Full speed (or root) hub)
Subclass … 0x00 Hub (Unused, Full speed (or root) hub)
Protocol … 0x00 Hub (Unused, Full speed (or root) hub)
Interface String … “”
[Endpoint 0]
MaxPacketSize … 1x 8 bytes
Interval … 255
Type … Interrupt
Direction … Input
[Descriptor 0]
Length … 0x09
Type … 0x29
Data … 03 00 00 00 00 00 ff
Hub ports count … 3
Hub Controller Current . 0mA
Port 1 status … 0503.0000 Connect Enable Power
Port 2 status … 0100.0000 Power
Port 3 status … 0100.0000 Power
[Alternate 0 active]
Class … 0x08 Mass Storage ()
Subclass … 0x06 Mass Storage (SCSI, Control/Bulk/Interrupt)
Protocol … 0x50 Mass Storage (SCSI, Bulk-Only)
This is indeed an UASP device.
The more slower, sequential Bulk Only Transport of SCSI commands and replies over USB mass storage device are reported as 0x08 / 0x06 / 0x00 (for BOT protocol).
Most USB3 optical drives are UASP only these days.
And so far Haiku doesn’t support it.
Haiku current kernel SCSI implementation already supports per-devices quirks (and it is already used for ATA for example). It should be possible to use the same mechanism for USB Mass Storage.
If we do it device by device it will be a quite long list, and a lot of new quirks to implement. Yes, it is possible, of course. Just needs a developer to do it and deal with all the bugreports from people hitting problems with their usb sticks, phones, mp3 player, development board, whatever they may plug to an usb port that only expects the exact subset of scsi commands that Windows uses, and crashes on anything else.
I suppose most people stream music and movies these days and take backups in the cloud even so going forward compatibility with USB attached DVD-RW drives, MP3 players and so on is probably not of interest to the majority of users.
As for me it is inconvenient that my Logitech DVD-RW drives would not work, but I still have the SAS drive in my Thinkpad Ultrabase to use when ripping CDs so I’m good.
Then it won’t help for reading audio CDs, as that needs specific commands that other devices (which are not CD drives) won’t understand.
I suspect the intersection of people who use Haiku and people who use CD players, MP3 players and the like may be larger than expected. I would say most of them have IDE, SATA or SCSI drives and not USB ones and that’s why this missing driver was not written yet?
CD/DVD drive is still generic thing that do not require per vendor/manufacturer handling. Haiku already handle this for PATA hard drives and CD/DVD drives.
You ask “are you a CD drive?” or something like “is there media present and is it removable?”
The device crashes because it doesn’t know that command
Similarly, SCSI has various READ and WRITE commands. Over the years they introduced new ones to handle larger capacity disks. But you can’t just use the latest/largest capacity one all the time, because some USB drives will not allow it. So you have to use a command that is large enough to hold all possible sector offsets, after you have read the device size.
You want to send a command to sync the disk and flush buffers? Our generic SCSI layer does that on unmount or when you call the sync system call, but some USB devices will crash when they receive that command. So it needs to be blocked, at least for some devices.
Also, device specific quirks are a bit unpractical to do because you can’t expect the generic SCSI layer to recognize the quirks based on an USB device and vendor ID (it shouldn’t need to care about that). So there needs to be a well-defined interface between the USB driver and the SCSI layer, that allows to communicate which commands are allowed. Then the USB driver can inform the SCSI layer about device specific quirks (there are already some we implement) as well as more general “USB stack” quirks that should always be enabled for all USB devices.
Again, yes, none of this is impossible, not even any hard technical problems. Just a lot of code and a lot of testing. And there’s a risk of breaking support for some devices that work well in the current situation. And no clear gain except for cleaning up the code. So the risk/effort/benefit balance made it so that no one did it so far. It just needs one developer to change that
Another problem is that “USB device crashes” is not fatal and common OSes (Windows, Linux) are able to recover from this situation.
Also note that “stall” reply from USB device is not a crash, but a way to indicate unsupported command. Device will operate as usual after sending stall.
It’s not fatal, but when my MP3 player reboots every time the USB mass storage driver tries to re-access it, there is not much to recover from.
I have written a few USB drivers and also implemented USB on a few devices. I think I have a reasonably good understanding of how it works. I wrote crash and not stall.
It looks like hardware bug. I don’t think Haiku team have enough resources to handle all existing buggy USB Mass Storage devices.
USB Mass Storage Bulk-Only Transfer spec is quite clear about list of supported SCSI commands for each device type (HDD, optical drive, FDD). Haiku should refer spec first.
You can use internal CD/DVD/BD trays/units. The USB driver(s) are W-I-P when it comes to certain printers and USB devices (like USB connected CD/DVD/Blu-ray units and certain optical formats when used within those USB drives)..
You “can” do some audio CD work (i.e. rip/playback/etc) using internal drives…