{{tag>howto suse tumbleweed apple superdrive cdrom eject sg3utils}}
====== Using an Apple SuperDrive with openSUSE Tumbleweed ======
__**Sources:**__
* https://cmos.blog/use-apples-usb-superdrive-with-linux/
* https://askubuntu.com/questions/226638/how-to-eject-a-cd-dvd-from-the-command-line
* https://www.reactivated.net/writing_udev_rules.html
* https://wiki.archlinux.org/title/udev
Make sure the [[https://github.com/doug-gilbert/sg3_utils | sg3_utils]] package is installed.
zypper in sg3_utils
To find out the required information execute the following command after connecting the drive to USB.
udevadm info --no-pager /dev/sr?
P: /devices/pci0000:00/0000:00:1c.4/0000:04:00.0/0000:05:01.0/0000:07:00.0/0000:08:02.0/0000:09:00.0/usb3/3-1/3-1.3/3-1.3.2/3-1.3.2.1/3-1.3.2.1:1.0/host4/target4:0:0/4:0:0:0/block/sr0
M: sr0
R: 0
U: block
T: disk
D: b 11:0
N: sr0
L: -100
S: cdrom
S: disk/by-diskseq/29
S: disk/by-id/usb-Apple_SuperDrive_KZAZ6BJ4314-0:0
S: disk/by-path/pci-0000:09:00.0-usb-0:1.3.2.1:1.0-scsi-0:0:0:0
Q: 29
E: DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:04:00.0/0000:05:01.0/0000:07:00.0/0000:08:02.0/0000:09:00.0/usb3/3-1/3-1.3/3-1.3.2/3-1.3.2.1/3-1.3.2.1:1.0/host4/target4:0:0/4:0:0:0/block/sr0
E: DEVNAME=/dev/sr0
E: DEVTYPE=disk
E: DISKSEQ=29
E: MAJOR=11
E: MINOR=0
E: SUBSYSTEM=block
E: USEC_INITIALIZED=228329076935
E: ID_BUS=usb
E: ID_MODEL=SuperDrive
E: ID_MODEL_ENC=SuperDrive\x20\x20\x20\x20\x20\x20
E: ID_MODEL_ID=1500
E: ID_SERIAL=Apple_SuperDrive_KZAZ6BJ4314-0:0
E: ID_SERIAL_SHORT=KZAZ6BJ4314
E: ID_VENDOR=Apple
E: ID_VENDOR_ENC=Apple\x20\x20\x20
E: ID_VENDOR_ID=05ac
E: ID_REVISION=2.03
E: ID_TYPE=cd
E: ID_INSTANCE=0:0
E: ID_USB_MODEL=SuperDrive
E: ID_USB_MODEL_ENC=SuperDrive\x20\x20\x20\x20\x20\x20
E: ID_USB_MODEL_ID=1500
E: ID_USB_SERIAL=Apple_SuperDrive_KZAZ6BJ4314-0:0
E: ID_USB_SERIAL_SHORT=KZAZ6BJ4314
E: ID_USB_VENDOR=Apple
E: ID_USB_VENDOR_ENC=Apple\x20\x20\x20
E: ID_USB_VENDOR_ID=05ac
E: ID_USB_REVISION=2.03
E: ID_USB_TYPE=cd
E: ID_USB_INSTANCE=0:0
E: ID_USB_INTERFACES=:080650:
E: ID_USB_INTERFACE_NUM=00
E: ID_USB_DRIVER=usb-storage
E: ID_PATH=pci-0000:09:00.0-usb-0:1.3.2.1:1.0-scsi-0:0:0:0
E: ID_PATH_TAG=pci-0000_09_00_0-usb-0_1_3_2_1_1_0-scsi-0_0_0_0
E: SCSI_TPGS=0
E: SCSI_TYPE=cd/dvd
E: SCSI_VENDOR=Apple
E: SCSI_VENDOR_ENC=Apple\x20\x20\x20
E: SCSI_MODEL=SuperDrive
E: SCSI_MODEL_ENC=SuperDrive\x20\x20\x20\x20\x20\x20
E: SCSI_REVISION=2.03
E: ID_SCSI=1
E: ID_SCSI_INQUIRY=1
E: ID_CDROM=1
E: SYSTEMD_MOUNT_DEVICE_BOUND=1
E: ID_CDROM_CD_R=1
E: ID_CDROM_CD_RW=1
E: ID_CDROM_DVD=1
E: ID_CDROM_DVD_R=1
E: ID_CDROM_MRW=1
E: ID_CDROM_MRW_W=1
E: ID_CDROM_DVD_R_DL_SEQ=1
E: ID_CDROM_DVD_R_DL_JR=1
E: ID_CDROM_DVD_PLUS_R_DL=1
E: ID_CDROM_DVD_PLUS_R=1
E: ID_CDROM_DVD_PLUS_RW=1
E: ID_CDROM_DVD_RW_SEQ=1
E: ID_CDROM_DVD_RW_RO=1
E: ID_CDROM_CD=1
E: ID_CDROM_RW_REMOVABLE=1
E: ID_CDROM_DVD_RW=1
E: ID_CDROM_DVD_R_DL=1
E: SYSTEMD_READY=0
E: NVME_HOST_IFACE=none
E: ID_FOR_SEAT=block-pci-0000_09_00_0-usb-0_1_3_2_1_1_0-scsi-0_0_0_0
E: DEVLINKS=/dev/cdrom /dev/disk/by-diskseq/29 /dev/disk/by-id/usb-Apple_SuperDrive_KZAZ6BJ4314-0:0 /dev/disk/by-path/pci-0000:09:00.0-usb-0:1.3.2.1:1.0-scsi-0:0:0:0
E: TAGS=:uaccess:systemd:seat:
E: CURRENT_TAGS=:uaccess:systemd:seat:
We will need the values of "ID_VENDOR_ID" and "ID_MODEL_ID".
Then we use udev to automatically send the activation command. This way, the device will get activated automatically when it gets plugged in.
install -vbD --owner=root --group=root --mode=0644 -T <(cat << 'EOF'
# 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"
EOF
) /etc/udev/rules.d/96-applesuperdrive.rules
If you don't want to use udev, this is how to do it manually:
# find the device
ls /dev/sr*
# send the magic string to activate the device
sg_raw /dev/sr1 EA 00 00 00 00 00 01
# to eject the media from command line
eject /dev/sr1
----
~~DISCUSSION~~
----
~~DISCUSSION~~