Created
February 11, 2018 04:28
-
-
Save MurphyMc/e4d01fe077bc4d3504645c12794f513f to your computer and use it in GitHub Desktop.
Enables Apple USB SuperDrive on 64 bit Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Enables Apple USB SuperDrive on 64 bit Linux | |
| .. when you have no C compiler or Internet connection | |
| """ | |
| from ctypes import * | |
| from fcntl import * | |
| from os import * | |
| import sys | |
| m = (c_ubyte * 7)() | |
| m[0] = 234 | |
| m[6] = 1 | |
| p = addressof(m) | |
| d = [83,0,0,0,254,255,255,255,7] + [0]*31 + [232,3] + [0]*46 | |
| b = (c_ubyte * 88)(*d) | |
| for i in range(8): | |
| b[i+24] = p & 0xff | |
| p >>= 8 | |
| f = open(sys.argv[1], O_RDWR|O_NONBLOCK) | |
| ioctl(f, 8837, bytes(bytearray(b))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment