Solved umass(4) and cd(4): my apologize for this out-of-mind question.

From the Handbook:

"The USB mass storage devices driver, umass(4), provides the support for USB storage devices ...... The umass(4) driver uses the SCSI subsystem to access to the USB storage devices, your USB device will be seen as a SCSI device by the system. "

Can you help me to understand this assertion ?

Is it possible change umass(4) with cd(4) so that cd(4) provides the support for USB storage devices ... and the USB device can be seen as a CD-R device by the system ?

Bho ?
 
Why? The functionality of using a CD reader or writer over USB already works. I just plug it in and use it. What are you trying to accomplish?
 
Hi ralph,

probably my idea is stupid ... I was thinking to use a lie, that is a native read-only driver, so that a usb/sata device could be seen like a CD-ROM.

The man cd(4) says: "The cd driver provides support fora SCSI CD-ROM (Compact Disc-Read Only Memory) drive ..... In general the interfaces are similar to those described by ada(4) and da(4)."

If this was true, plugging-in a usb/sata memory device (stick / Hard disk) should be the same that insert a CD-ROM and automatically (???) be considered a read-only support (like CD-ROM).

Is the cd(4) driver a native read-only protocol ? I don't know. My apologize for my limits !
More: probably it only read a ISO9690 filesystem (the same of the CD-ROM). And probably this is also a stupid thinking.

mha !!

See you.
 
Hello vince66,

if you haven't meddled with default devfs() rules, then usb/sata storage media is only write-accessible for root. It's read-only for the 'operator' group and no-access for everybody else.

I don't believe there is a way to fake a CD-ROM media the way you suggest, but even if it were, you would very likely hit some serious unforeseen issues (the cd(4) driver certainly isn't compatible with USB storage media, it's like if you wanted to use an ethernet driver to access your audio card and manupulate it to send data over network - it would never work).

Rather than that, I suggest you set devfs() rules in devfs.conf and devfs.rules.
 
I see a lot of confusion here.

I was thinking to use a lie, so that a usb/sata device could be seen like a CD-ROM.
When you say a "usb/sata" advice, you probably mean a USB-to-SATA adapter: On one side, they are a USB device (which you connect to a computer), and on the other side they have a SATA initiator port, which you connect to a disk drive. When they see a disk drive on the SATA side, they start speaking the USB "mass storage" protocol over USB. Now, there are some of those that you can plug a SATA CD-ROM in, and then on the USB side they will speak the "USB CD-ROM" protocol. I don't know how common that functionality is, but it seems to exist (quick check at Amazon finds that they sell this). Is that what you want? I don't think so.

I think what you really want is: Turn a disk drive into a CD-ROM: You write data onto the disk drive, then connect it to a mythical gadget that turns a SATA disk into a USB CD, and want to pretend it to be a CD-ROM drive.

... that is a native read-only driver,
And what does read-only have to do with it? I admit that CD-ROMs are read-only. But disks can also be read-only: many disks still have a jumper to make them read-only. And USB memory sticks can be read-only (SD cards, for example, have a little switch that makes them read-only). A storage device doesn't become a CD-ROM by being read-only.

You need to understand a little more about how real hardware devices communicate with computers. I'll give you the example from the SCSI world (because I'm more familiar with it): An initiator (in most cases a computer) sends an "Inquiry" command to an arbitrary SCSI device (like a disk or such). All SCSI devices are absolutely required to implement the Inquiry command. The response to Inquiry shall be at least 36 bytes of data. The very first byte has the "device type" in its lowest 5 bits: 0=disk, 1=tape, 5=CD, 2=printer, 13=disk enclosure, 8=media changer (jukebox or tape robot), and a lot of even weirder device types that don't happen in the real world any longer. If you want to turn a disk into a CD, you'd need to teach the disk to lie about it's disk-ness, and instead return "I am a CD". In practice, this would be prohibitively difficult: you'd have to modify the Seagate firmware. Or you could modify the firmware of you USB-to-SATA adapter.

If you really really want to do this (meaning: if you are crazy), the right way to do it would be to go into the device discovery code in FreeBSD, and hack it up. I don't think this is a config file, but source code, somewhere buried in the SCSI driver and the USB driver and the SATA driver (it could be that they use a common piece of code). I don't think this is a sane approach, unless you have a lot of experience and time.

More: probably it only read a ISO9690 filesystem (the same of the CD-ROM).
And what does iso9660 have to do with it? That's just the file system.

You are now confusing multiple layers. Above you confused the read-only aspect of a device with its real device type. Now you are confusing which file system is on the device with the device type. It is perfectly possible to create the binary image of an iso9660 file system, and write it onto a real spinning hard disk, and then mount it. I don't think I've done that with a whole disk, but I've done that many times with an iso9660 file system that's stored in a file (and then you use loop mount to get to the file). You could also create a binary image of a FreeBSD UFS file system, or a Linux ext2 file system, and burn it onto a CD-ROM, and mount that too (I think it would work; I don't know how file these file systems would handle the fact that the hardware is read-only, you might get error messages, in particular if you don't use read-only mounting). So the fact that it is iso9660 is not tied to it being a CD-ROM hardware.

And this may actually be the solution to your real problem. I don't think you really want a disk to pretend to be a CD-ROM. I think what you really want is to have a device that contains an iso9660 file system (the data from a CD), but is faster and more efficient. This should work really easily: Find the iso9660 binary image, copy it to the disk (for example with the dd command), and then mount the resulting disk with the iso9660 file system.
 
yes yes yes super-guys !!!


I'm agree with everything you wrote As you can see I've specified: my question is out-of-mind .. this is not the right way to make a fake !

It was just a my outburst !

However, I've already solved my exercise with FreeBSD and I'm glad for the results.

Thanks also for your kindly assistance and continuos help.
 
Back
Top