[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: what binds to port



Hi,

Brian wrote:
> Isn't /dev/sg0 the block device?

/dev/sgX are character devices.

  https://tldp.org/HOWTO/SCSI-Generic-HOWTO/intro.html
says
  "The driver's purpose is to allow SCSI commands to be sent directly to
   SCSI devices. [...] Various specialized applications for writing
   CD-Rs and document scanning use the sg driver."

This is still the case for optical drives (sr) and hard discs (sd) which get
an sg device file additionaly to their block device file. But it seems that
the statement about "document scanning" could need an update.


The main call for sg devices is ioclt(SG_IO) which performs a single SCSI
command transaction.
Since about 15 years it is possible to use it directly with a /dev/srX
device file. But a bug introduced in a late version of kernel 2.6 prevented
concurrent use of SG_IO on multiple sr devices. This ended with
  https://github.com/torvalds/linux/commit/51a8588
which i assume went into kernel version 5.6.
So with the currently released Debian versions, /dev/sgX is still of use
if there is more than one sr device.


Have a nice day :)

Thomas


Reply to: