Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dvd_drive_status [2014/03/13 17:56] – beandog | dvd_drive_status [2021/10/17 23:50] (current) – beandog | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== dvd_drive_status ====== | ====== dvd_drive_status ====== | ||
- | * [[https:// | + | |
+ | * [[https:// | ||
+ | | ||
- | * [[https://raw2.github.com/ | + | This program is a successor to the small program |
- | This program is a successor | + | It has support on and off for *BSD systems. I like to work on it, and then I don' |
- | To build, just download | + | A man page is included with the '' |
- | + | ||
- | < | + | |
- | $ wget https:// | + | |
- | $ gcc -o dvd_drive_status | + | |
- | </ | + | |
=== Context === | === Context === | ||
- | The reason this program was written, was because I was having problems having programs access the DVD drive before it is ready. | + | The reason this program was written, was because I was having problems having programs access the DVD drive before it is ready. Duplication is simple. |
* Open your DVD tray | * Open your DVD tray | ||
Line 25: | Line 22: | ||
* get frustrated and have to re-run your program once the drive is ready | * get frustrated and have to re-run your program once the drive is ready | ||
- | The problem here is that the OS will close the tray, and pass off control of the device back to the user, while the device is still in a non-ready status. | + | The problem here is that the OS will close the tray, and pass off control of the device back to the user, while the device is still in a non-ready status. So, using the above example, even closing it with '' |
< | < | ||
Line 32: | Line 29: | ||
</ | </ | ||
- | To fix this, we need to properly check if a drive is ready to be accessed or not. Just being " | + | To fix this, we need to properly check if a drive is ready to be accessed or not. Just being " |
=== Drive and Tray States === | === Drive and Tray States === | ||
Line 45: | Line 42: | ||
In every state, the DVD drive is ready to send commands to it, and not have your program puke, **except** for if it is opening or closing. | In every state, the DVD drive is ready to send commands to it, and not have your program puke, **except** for if it is opening or closing. | ||
- | I should clarify. | + | I should clarify. When I say " |
It's that state where the drive is //not ready// to be accessed. | It's that state where the drive is //not ready// to be accessed. | ||
Line 51: | Line 48: | ||
=== Checking Drive / Tray Status === | === Checking Drive / Tray Status === | ||
- | Anyway, inspired by [[trayopen]] and having a desire to learn C myself, I came up with this little program, '' | + | Anyway, inspired by [[trayopen]] and having a desire to learn C myself, I came up with this little program, '' |
- | A nice bonus from the CD driver is that it lets you see if there is media in the tray or not, while the tray is closed. | + | A nice bonus from the CD driver is that it lets you see if there is media in the tray or not, while the tray is closed. So again, this is very helpful for scripts that want to automate querying the status of your DVD drive. |
=== Scripting === | === Scripting === |