nadiva 4 Posted June 11, 2020 Share Posted June 11, 2020 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) Quote Link to post Share on other sites
IG-88 664 Posted June 12, 2020 Share Posted June 12, 2020 nice, thats step one any one adding automatic audio cd, video dvd and bluray ripping? we could add the cd/dvd drivers permanently to the extended extra.lzma, loading them would not hurt any other functionality i guess Quote Link to post Share on other sites
nadiva 4 Posted June 14, 2020 Author Share Posted June 14, 2020 yeah 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 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.