Find the answer to your Linux question:
Results 1 to 4 of 4
Hello all, I'm trying to add cdrom capabilities to my Synology nas. I've successfully compiled modules cdrom, sr_mod, sg. The all load fine and the cdrom is properly detected according ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2013
    Posts
    2

    cdrom detected according to dmesg but not responding


    Hello all,

    I'm trying to add cdrom capabilities to my Synology nas. I've successfully compiled modules cdrom, sr_mod, sg. The all load fine and the cdrom is properly detected according to dmesg:

    Code:
    [1414949.380000] usb 1-1.3: new high speed USB device using orion-ehci and address 3
    [1414949.540000] usb 1-1.3: configuration #1 chosen from 1 choice
    [1414949.560000] scsi2 : SCSI emulation for USB Mass Storage devices
    [1414949.590000] usb-storage: device found at 3
    [1414949.590000] usb-storage: waiting for device to settle before scanning
    [1414954.690000] scsi 2:0:0:0: CD-ROM            LITE-ON  DVDRW SH-16A7S   WS04 PQ: 0 ANSI: 0
    [1414956.550000] sr0: scsi3-mmc drive: 48x/48x writer dvd-ram cd/rw xa/form2 cdda tray
    [1414956.560000] Uniform CD-ROM driver Revision: 3.20
    [1414956.610000] sr 2:0:0:0: Attached scsi CD-ROM sr0
    [1414956.620000] sr 2:0:0:0: Attached scsi generic sg1 type 5
    [1414956.630000] usb-storage: device scan complete
    I don't have udev up and working so I won't find a /dev/cdrom. So after a bit of searching I found /sys/block/sr0. This works fine on other systems. However, here I get an error:
    Code:
    if ((cdrom = open("/sys/block/sr0",O_RDONLY | O_NONBLOCK)) < 0) {
                perror("open");
                exit(1);
        }
    
        if((error = ioctl(cdrom, CDROMEJECT)) < 0) {
            perror("eject ioctl error");
    This returns:
    eject ioctl error: Inappropriate ioctl for device

    Does anyone have any clue on what's going on here and what might fix it?

    Kind regards, Maarten

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    hello and welcome!

    the file /sys/block/sr0 is not the same as /dev/sr0 (which is linked to /dev/cdrom often). The files in /dev are kernel "block" devices and are what are used by the kernel to access the device. The files in /sys are more like dynamic settings of devices (and other things) in the kernel. So try making the required block device:

    Code:
    mknod /dev/sr0 b 11 0
    and use /dev/sr0 in your code.

  3. #3
    Just Joined!
    Join Date
    May 2013
    Posts
    2
    Many thanks, that works like a charm. I can't say I understand what I just did... I guess I've got some reading to do..

    Thanks again

  4. $spacer_open
    $spacer_close
  5. #4
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    cheers! glad it's sorted. I'll mark this thread as Solved for you. Note that you can do this yourself at any time by using the Thread Tools link at the top of the page.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •