Created
December 23, 2015 15:55
-
-
Save geekman/016890c6c046908eb4bd to your computer and use it in GitHub Desktop.
ejects the DVD-ROM drive (using Python)
This file contains 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
#!/usr/bin/env python | |
# | |
# ejects the cdrom drive | |
# | |
# kernel references: | |
# - Documentation/ioctl/cdrom.txt | |
# - include/uapi/linux/cdrom.h | |
# | |
from fcntl import ioctl | |
import sys, os | |
CDROMEJECT = 0x5309 | |
fd = os.open(sys.argv[1], os.O_RDONLY | os.O_NONBLOCK) | |
ioctl(fd, CDROMEJECT, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment