From 695c34aa66b4c4fd48965f0babdf6586a69e741f Mon Sep 17 00:00:00 2001 From: Michele Baldessari Date: Fri, 21 Aug 2026 21:54:55 +0200 Subject: [PATCH] USB: storage: send unlock CDB to Apple SuperDrive on bind The Apple USB SuperDrive (A1379, 05ac:1500) enumerates as a normal Bulk-Only SCSI CD-ROM, but it leaves the slot-loading motor locked until it receives a vendor-specific 7-byte CDB [1] [2]: EA 00 00 00 00 00 01 Without that command the drive refuses to accept media. Send it from the unusual_devs init hook on bind so the manual udev/sg_raw workaround is not required. Do not fail probe if the command errors; still bind the device. The drive survives suspend/resume without needing the unlock command to be re-sent. T: Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=05ac ProdID=1500 Rev= 2.00 S: Manufacturer=Apple Inc. S: Product=MacBook Air SuperDrive C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms Link: https://www.cmos.blog/use-apples-usb-superdrive-with-linux/ [1] Link: https://gist.github.com/AnnoyingTechnology/dbaae864822cf08372f0aafe64a63477 [2] Signed-off-by: Michele Baldessari --- drivers/usb/storage/initializers.c | 33 ++++++++++++++++++++++++++++++ drivers/usb/storage/initializers.h | 3 +++ drivers/usb/storage/unusual_devs.h | 10 +++++++++ 3 files changed, 46 insertions(+) diff --git a/drivers/usb/storage/initializers.c b/drivers/usb/storage/initializers.c index b243bd5521a6..29234543a1d7 100644 --- a/drivers/usb/storage/initializers.c +++ b/drivers/usb/storage/initializers.c @@ -92,3 +92,36 @@ int usb_stor_huawei_e220_init(struct us_data *us) usb_stor_dbg(us, "Huawei mode set result is %d\n", result); return 0; } + +/* Unlock the Apple USB SuperDrive slot-loading motor */ +int usb_stor_apple_superdrive_init(struct us_data *us) +{ + struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *)us->iobuf; + struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap *)us->iobuf; + static const u8 cdb[] = { 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }; + unsigned int partial; + int res; + + usb_stor_dbg(us, "Attempting to unlock SuperDrive slot-loader...\n"); + + bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); + bcb->Tag = 0; + bcb->DataTransferLength = cpu_to_le32(0); + bcb->Flags = bcb->Lun = 0; + bcb->Length = sizeof(cdb); + memset(bcb->CDB, 0, sizeof(bcb->CDB)); + memcpy(bcb->CDB, cdb, sizeof(cdb)); + + res = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, bcb, + US_BULK_CB_WRAP_LEN, &partial); + if (res) { + usb_stor_dbg(us, "SuperDrive CBW failed: %d\n", res); + return 0; /* still bind */ + } + + res = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, bcs, + US_BULK_CS_WRAP_LEN, &partial); + if (res) + usb_stor_dbg(us, "SuperDrive CSW failed: %d\n", res); + return 0; +} diff --git a/drivers/usb/storage/initializers.h b/drivers/usb/storage/initializers.h index dcd7b7e5eda8..ffc6ed479471 100644 --- a/drivers/usb/storage/initializers.h +++ b/drivers/usb/storage/initializers.h @@ -37,3 +37,6 @@ int usb_stor_ucr61s2b_init(struct us_data *us); /* This places the HUAWEI E220 devices in multi-port mode */ int usb_stor_huawei_e220_init(struct us_data *us); + +/* Unlock the Apple USB SuperDrive slot-loading motor */ +int usb_stor_apple_superdrive_init(struct us_data *us); diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index ac22fa318734..c9b766e8f22a 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h @@ -890,6 +890,16 @@ UNUSUAL_DEV( 0x05ac, 0x120a, 0x0000, 0x9999, USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_FIX_CAPACITY ), +/* + * Reported by Michele Baldessari + * Apple USB SuperDrive (A1379): vendor CDB to unlock the slot-load motor + */ +UNUSUAL_DEV( 0x05ac, 0x1500, 0x0000, 0x9999, + "Apple", + "SuperDrive", + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_apple_superdrive_init, + 0 ), + /* * Reported by Dan Williams * Option N.V. mobile broadband modems -- 2.55.0