Capturing bytes sent for `eject /dev/sr0`?

11/09/2013 - 05:49 von no.top.post | Report spam
`eject /dev/sr0` suffices to switch the G3dongle from CDROM to modem mode.

I'm confident that only a few bytes are sent to the device,
and perhaps not even a handshake/dialog.

But the 'apps' that eject-the-CDROM wrap the sent-bytes in elaborate
code & data-structures. Like todays emails of 10 words come with a picture
and a 50-line envelope!!

How would you snif-the-byte-stream?
Perhaps by `tee'-ing it off to a file, for later inspection?

==TIA.
ipNews.Send *
 

Lesen sie die antworten

#1 Joe Beanfish
11/09/2013 - 15:16 | Warnen spam
On Wed, 11 Sep 2013 03:49:37 +0000, no.top.post wrote:

`eject /dev/sr0` suffices to switch the G3dongle from CDROM to modem mode.

I'm confident that only a few bytes are sent to the device,
and perhaps not even a handshake/dialog.

But the 'apps' that eject-the-CDROM wrap the sent-bytes in elaborate
code & data-structures. Like todays emails of 10 words come with a picture
and a 50-line envelope!!

How would you snif-the-byte-stream?
Perhaps by `tee'-ing it off to a file, for later inspection?

==TIA.
ipNews.Send *



Not sure what you intend to do with the supposed byte stream, but the
eject command is an ioctl to the device driver which then sends commands
down the USB wire. Not something you can simulate with echo or such.
Sending commands over USB is non-trivial, unlike dumping bytes down
a serial port.

# strace eject /dev/sr2
...
open("/dev/sr2", O_RDWR|O_NONBLOCK) = 3
ioctl(3, CDROMEJECT, 0x9) = -1 EIO (Input/output error)
ioctl(3, SG_GET_VERSION_NUM, 0xbfc4f94c) = 0
ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[1e, 00, 00, 00, 00, 00], mx_sb_len2, iovec_count=0, dxfer_len=0, timeout000, flags=0, status, masked_status, sb[0]=[], host_status=0, driver_status=0, resid=0, duration=6, info=0}) = 0
ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[1b, 00, 00, 00, 01, 00], mx_sb_len2, iovec_count=0, dxfer_len=0, timeout000, flags=0, status, masked_status, sb[0]=[], host_status=0, driver_status=0, resid=0, duration=5, info=0}) = 0
ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[1b, 00, 00, 00, 02, 00], mx_sb_len2, iovec_count=0, dxfer_len=0, timeout000, flags=0, status, masked_status, sb[0]=[], host_status=0, driver_status=0, resid=0, duration=7, info=0}) = 0
ioctl(3, BLKRRPART, 0xbfc4f968) = -1 EINVAL (Invalid argument)
close(3) = 0

Ähnliche fragen