Jump to content
XPEnology Community

physical CD-ROM / DVD tactics (auto mount)


nadiva

Recommended Posts

goal: have CD-ROM / DVD reader working, ready to server files asap without going to terminal, auto mount

hardware: for example Microserver Gen10 with internal USB port and cute thin CD slot, it'd be a shame to leave it empty

software: find cdrom.ko and sr_mod.ko from someone nice who can build

 

initial setup

 

Quote

insmod /lib/modules/cdrom.ko # lock and load the driver
insmod /lib/modules/sr_mod.ko # --""--
lsmod | grep cdrom # result: cdrom xxxx 1 sr_mod
mknod /dev/sr0 b 11 0 # create scsi device

mknod /dev/cdrom b 11 0 # let's set up this "default" as a working duplicate, to satisfy eject command i.e. not type parameters each time
mkdir /volume1/yourshare/DVD # a subfolder in a share for easy access

 

here the work can end, if you like to operate it via CLI.

Automount is crippled like on other appliances, we can hook up to udev, e.g. monitor actions here:

 

Quote

udevadm --debug monitor

 

normally udev would do the job, but here events are limited if not delayed, there's just change action, that's what i put a respective command to /etc/udev/rules.d/99-local.rules:

 

Quote

KERNEL=="sr0", SUBSYSTEMS=="usb", ACTION=="change", RUN+="/bin/sh -c /root/cdrom.sh"

 

load the rules:

Quote

udevadm control --reload-rules

 

then process its events to make sure actions are captured, provide automount (sometimes delayed) and optionally make sound when CD is inserted or ejected via AudioStation (just grab mp3 fast on https://ttsmp3.com/), cdrom.sh:

 

Quote

if [[ $(df -t iso9660) ]]; then
    if [[ $(blkid /dev/sr0) ]]; then            #active and mounted -> eject
        eject /dev/cdrom
    else                                        #inactive but mounted -> unmount
        umount /dev/cdrom
    fi
    ###OPTIONAL SOUND nohup /volume1/@appstore/AudioStation/bin/mplayer /root/cdejected.mp3 2> /dev/null &
else
    if [[ $(blkid /dev/sr0) ]]; then            #active and unmounted -> mount
        mount /dev/cdrom && eject /dev/cdrom -i off ###OPTIONAL SOUND  && nohup /volume1/@appstore/AudioStation/bin/mplayer /root/cdinserted.mp3 2> /dev/null &
    else                                        #inactive and unmounted -> nothing
        sleep 0; #no action, chance of double event ("change") is here
    fi
fi

 

however it's even more crippled, the triggers are fired often too late (or only when un/mounting on CLI) and never when doing manual button oepration, so we best periodically launch blkid or eject -a on /dev/cdrom via scheduler. I choose to fire the latter to save some cpu cycles as it's faster and i launch it each 30 seconds. In the end, this way we avoid CLI completely, it gets un/mounted automatically with little delay (~15sec, loading CD alone is 10sec so i think it doesn't matter).

 

> Some devices prevent manual buttons once mounted but users love them instead of CLI -> this is fixed during mount.

> CD will be inserted with physical tray push

> CD will be ejected with physical eject button OR if you love CLI: umount /dev/cdrom OR eject (no parameters)

 

Link to comment
Share on other sites

yeah :D  so you install transcode in ikpgui an set it up in the script above:


 

Quote

 

transcode -i /dev/cdrom/ -y ffmpeg -o /volume1/fastrips/$(blkid -o value -s LABEL /dev/cdrom).ext

file -s /dev/cdrom >> /volume1/fastrips/ripped.log

eject

 

 

then insert another one...wait... another one...wait... just an example

Link to comment
Share on other sites

  • 1 year later...

I'm looking into using Automatic Ripping Machine (The A.R.M)

https://github.com/automatic-ripping-machine/automatic-ripping-machine

 

perhaps using https://github.com/rix1337/docker-ripper

 

Now to find out how to build or obtain cdrom.ko and sr_mod.ko 

 

Tips appreciated!

 

 

Edited by gingerbeardman
Link to comment
Share on other sites

On 6/12/2020 at 2:30 AM, IG-88 said:

we could add the cd/dvd drivers permanently to the extended extra.lzma, loading them would not hurt any other functionality i guess

due to popular demand, we could really add those tiny files by default:)

On 1/10/2022 at 12:16 PM, gingerbeardman said:

Now to find out how to build or obtain cdrom.ko and sr_mod.ko

i've sent you

  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

My system won't boot with this replacement extra.lzma. I did a simple swap of the file and made no other changes. It does not even show up as broadcasting its hostname. Interestingly my USB keyboard lights come on. 

 

I can get it to boot again by going back to the original extra.lzma.

 

to summarise...

original extra.lzma = boot

drivers page extra.lzma = boot

drivers page extra.lzma + sr_mod + cdrom = no boot

 

Any way I can give more detailed and useful debug data?

 

Thanks

Edited by gingerbeardman
Link to comment
Share on other sites

5 hours ago, gingerbeardman said:

Any way I can give more detailed and useful debug data?

the best way ist to have a serial port on the dsm system and use a null-modem cable and a console like putty on the other side (can be any serial port there even usb2serial will usually work), most people dont have that stuff around or (when younger) never even seen serial port/cable

if it a general problem i guess it should also happen when in install a 3617 on a test hardware (but that most like not happening before the weekend), i have serial port on my test systems so i can see whats going on while booting

  • Like 1
Link to comment
Share on other sites

1 hour ago, gingerbeardman said:

i would have to buy usb2serial for my N54L.

just in case, a usb2serial is not working for dsm, that needs a "real" serial port, usb2serial adpter is just for the system receiving the serial output from a dsm system if that receiving system does not have a serial port (most notebooks don't have one nowadays)

Link to comment
Share on other sites

  • 2 weeks later...
On 1/25/2022 at 3:57 PM, gingerbeardman said:

to summarise...

original extra.lzma = boot

drivers page extra.lzma = boot

drivers page extra.lzma + sr_mod + cdrom = no boot

 

Any way I can give more detailed and useful debug data?

 

look for the new 11.6 for 3617, tested it with a fresh install of 3617 (6.2.3!), cdrom.ko needed to loaded before sr_mod.ko, it loads on the test system but i had no cdrom/dvd around to test with a ahci or mpt2sas connected sata drive

https://xpenology.com/forum/topic/28321-driver-extension-jun-103b104b-for-dsm623-for-918-3615xs-3617xs/

 

Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...
17 hours ago, gingerbeardman said:

 

iso9660,udf,hfsplus are all OK. but hfs is missing?

looks like it, hfs seems to be a different kernel module then hfsplus (kernel source under file systems, there is hfsplus and hfs) and only hfsplus.ko is part of dsm's default set of kernel modules so it would need to be compiled and added/loaded

try the attached file (its for 3617), copy it to the system and load it with insmod, then try again

 

hfs.ko

Edited by IG-88
Link to comment
Share on other sites

That seems to work, but my knowledge is limited.

 

Here is me trying to mount a CD.

Then I rip the CD to a file using dd.

Then I inspect the file using hfsutils from a docker container.

 

Please do shout out if I am mounting it wrong or have wrong expectations.

 

I will continue to stumble on.

 

bash-4.3# insmod /volume1/docker/hfs.ko
bash-4.3# cat /proc/filesystems | grep hfs
hfsplus
hfs
bash-4.3# mount -t hfs -r /dev/sr0 /volume1/cdrom
mount: wrong fs type, bad option, bad superblock on /dev/sr0,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
bash-4.3# dmesg | tail
[  124.852658] docker0: port 4(dockerd9d01ec) entered forwarding state
[  125.920036] docker0: port 2(docker43c79cc) entered forwarding state
[  128.864066] docker0: port 3(dockera573ef4) entered forwarding state
[  129.946919] IPv6: ADDRCONF(NETDEV_CHANGE): dockerea8593c: link becomes ready
[  129.946949] docker0: port 5(dockerea8593c) entered forwarding state
[  129.946963] docker0: port 5(dockerea8593c) entered forwarding state
[  139.872066] docker0: port 4(dockerd9d01ec) entered forwarding state
[  144.992050] docker0: port 5(dockerea8593c) entered forwarding state
[  196.617857] hfs: unable to set blocksize to 512
[  196.618040] hfs: can\'t find a HFS filesystem on dev sr0
bash-4.3# fdisk -l /dev/sr0
Disk /dev/sr0: 645.3 MiB, 676653056 bytes, 330397 sectors
Units: sectors of 1 * 2048 = 2048 bytes
Sector size (logical/physical): 2048 bytes / 2048 bytes
I/O size (minimum/optimal): 2048 bytes / 2048 bytes
bash-4.3# dd if=/dev/sr0 of=/volume1/iso/macpeople-1999-special.iso bs=1M status=progress
674234368 bytes (674 MB) copied, 148.288695 s, 4.5 MB/s
645+1 records in
645+1 records out
676653056 bytes (677 MB) copied, 148.796 s, 4.5 MB/s

root@hfsutils:/iso# hmount macpeople-1999-special.iso                                              
/iso/macpeople-1999-special.iso: contains 1 HFS partition                                          
Volume name is "MacPeopleՎ CD-ROM"                                                                
Volume was created on Mon Aug  9 17:03:21 1999                                                     
Volume was last modified on Wed Aug 11 22:45:33 1999                                               
Volume has 1139712 bytes free                                                                      
root@hfsutils:/iso# hvol                                                                           
Current volume is mounted from partition 1 of:                                                     
  /iso/macpeople-1999-special.iso                                                                  
                                                                                                   
Volume name is "MacPeopleՎ CD-ROM"                                                                
Volume was created on Mon Aug  9 17:03:21 1999                                                     
Volume was last modified on Wed Aug 11 22:45:33 1999                                               
Volume has 1139712 bytes free                                                                      

 

Edited by gingerbeardman
Link to comment
Share on other sites

udev rules are highly unreliable here. the only event is "change" and it's unreliable, also giving you no indication whether CD was inserted or removed. i've digged as much info as i could but it's really in horrible state. so the only way to kinda make it work is to keep shooting eject -a to it just to keep the lausy event coming, and be creative in a handler script, as written in the first post and evolved since (tho never reaching 100% success).

  • Thanks 1
Link to comment
Share on other sites

Thanks! I forgot about the first post.
 

ARM (automatic ripping machine) areas has the scripts but it relies on udev which asyiu as is not working well here. 

 

Anyway I had to name each ISO by hand (old Macintos HFS format cannot be mounted right now) so I just did it all manually. Dumped 75 CDs in 3 hours. 

 

Maybe I can get it ready for next time!?

Edited by gingerbeardman
Link to comment
Share on other sites

  • 3 weeks later...

Just a note to say that I am using a Plextor IDE CD-ROM drive connected to the motherboard SATA with an adapter—all is well!


It did not work with an old IDE to SATA adapter model "ST-101L" I had in my spares box.

This one showed up the drive in BIOS with a little delay, and nothing in Linux.

http://www.lycom.com.tw/ST101L.htm

 

So I am using IDE to SATA bidirectional adapter "IDE & SATA Bridge 20110426"

This was basically the cheapest adapter I could buy on Prime 
This one showed up the drive in BIOS very quickly, and is visible in Linux.
https://www.amazon.co.uk/gp/product/B098K4MTNC/

Edited by gingerbeardman
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...