Use Apple’s USB SuperDrive with Linux
I’m really surprised and disappointed that Apple prevents us from using their USB SuperDrive with non Apple devices.
How to outsmart Apple’s firmware
Fortunately, with a little hack, we can awake the drive from its deep slumber. It’s required to send a “magic” byte sequence after the drive was connected. I got this byte sequence from a source I no longer can find on the web. So, I don’t take full credits for this.
You have several options for making this work. In this post I’d like to unveil two of them.
Unlock with SCSI Generic (sg) driver
For communicating with the SCSI device directly we need the Linux SCSI Generic (sg) driver packages.
# Debian sudo apt-get install sg3-utils
Lookup the device, it should be sr0 or sr1 by default depending on how many USB disc drives are currently attached. Check the output of following command to get a list off all device paths:
ls /dev
After you’ve the SuperDrive identified, we’ll send the magic sequence to the device.
# Do magic... sg_raw /dev/sr0 EA 00 00 00 00 00 01
Try to insert a disc, the drive should be awake now and start initialising the disc. For now the last step is necessary each time the drive is unplugged, so let’s automate it!
Custom udev rule
We’ll make us of the udev device manager. It runs as a deamon and receives events each time a device is initialised or removed. Furthermore, it features an extensible rule set for easy customising. Please check out this very good guide for further instructions.
Let’s write such a custom rule.
# Debian sudo nano /etc/udev/rules.d/99-local.rules
Add following rule definition.
# Initialise Apple SuperDrive ACTION=="add", ATTRS{idProduct}=="1500", ATTRS{idVendor}=="05ac", DRIVERS=="usb", RUN+="/usr/bin/sg_raw /dev/$kernel EA 00 00 00 00 00 01"
This will do the “magic” each time a SuperDrive device is connected. To test the rule, disconnect the drive and connect it again, the drive should be unlocked, already.
Unlock with Superdrive-Enabler
Superdrive-Enabler is a little app that sends the magic byte sequence to a device.
Superdrive-Enabler for Raspberry Pi
I precompiled a binary for the Raspberry Pi in cases where you can’t or don’t want to install “sg3-utils”. Make sure that SuperDrive is connected via an active USB hub to the Pi. Copy the executable binary to your Raspberry with SMB or WGET.
# download binary wget https://github.com/onmomo/superdrive-enabler/raw/master/dist/rpi/superdriveEnabler_rpi # make binary executable chmod +x superdriveEnabler_rpi
Other distributions
Easily compile the superdrive-enabler source.
# Download the source from my github repository wget https://raw.githubusercontent.com/onmomo/superdrive-enabler/master/src/superdriveEnabler.c # compile it gcc -o superdriveEnabler superdriveEnabler.c # Make it executable chmod +x superdriveEnabler
Custom udev rule
Let’s write a custom rule in a new *.rules file or separated by a line break in an existing rules file.
# Debian sudo nano /etc/udev/rules.d/99-local.rules
Add following rule definition.
# Initialise Apple SuperDrive with superdrive-enabler # Make sure that you adjust the path to the superdriveEnabler on your system ACTION=="add", ATTRS{idProduct}=="1500", ATTRS{idVendor}=="05ac", DRIVERS=="usb", RUN+="/home/pi/superdrive-enabler/superdriveEnabler /dev/$kernel"
This will trigger the “superdriveEnabler” app with the device path as parameter (e.g /dev/sr0) each time a SuperDrive device is connected. Reconnect the drive again and enjoy your CD/DVD collection with XBMC or any other media player!
Many thanks for this. It works brilliantly.
Holy crap, thank you so much!!!! Works perfectly
👌✌️
[…] /dev/sr1 um die CD auszuwerfen (das Laufwerk verfügt über keinen physischen Auswurfs-Knopf) (Quelle im Kommentar von Korhan […]
Thanks a ton, works great!
2022 on ubuntu 21.10 : this is the way
Wonderful. I’ve been setting up a Linux computer (Ubuntu 20.04) to replace my 8 year old iMac, which is getting rather decrepit. This saved me the price of a new DVD drive. Just watched a movie on VLC, and also verified that the rule automatically connects the drive.
Now if I can just get my scanner to work, I’ll be all set. 🙂
Glad it works, happy tinkering! 🙂
Just one more comment to testify it just saved my life too even in 2022.
I’ve been trying to read FS2020 faulty disks with three different drives without success. The package has been returned once but the new one doesn’t give better results. Half of the disks are OK, the others one are hanging pretty much at the same place each time (2,4 go over 8).
I started trying to compose full ISO images using “dd” under Linux using two distincts DVD sets, but was never able to make it to the end.
I’ve been lent an old Apple Superdrive, plugged it onto the front USB plug of my old PC, then waked it up as you have shown us above. It was perfectly able to read all of my ten disks ! Victory !
We were struggling for this since last Christmas, now it will be finally able to be installed and run.
Real thanks.
Great!! 🙌✌️🤘
Thanks. Works great with Ubuntu 20.
Thank you very much! today my raspberry pi became a CD player.
Glad it still works, happy tinkering!
THANK YOU.
I’m not “surprised and disappointed that Apple prevents us from using their USB SuperDrive with non Apple devices.” Unsurprised and outraged is closer to the mark. Sadly, Apple is not the company that it was in 1989 when I started in IT.
Many thanks. Works well on Ubuntu 20.04.
awesome. thank you.
Thank you.
Excellent and easy to follow advice.
It works perfectly.
Worked great on unraid sg3 utils is installed by default.
Thanks a bundle. This would have taken me a hot minute, but your solution and explanation are excellent.
thank you so much! working for me too
ubuntu
Works peachy keen with Debian 10 (Buster).
Thanks a lot for this information. Worked like a charm.
Thank you very much for your easy to do and follow tutorial, much appreciated. Praise, Praise, Praise!
Sorry forgot to add what my system is, Linux Mint 19.2
Thanks very much! worked like a charm on Linux Mint 19. Thumbs way up.
Used this on Ubuntu 19 circa 07-14-2019 – really easy and worked perfectly!