cdrom.txt 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968
  1. Summary of CDROM ioctl calls.
  2. ============================
  3. Edward A. Falk <efalk@google.com>
  4. November, 2004
  5. This document attempts to describe the ioctl(2) calls supported by
  6. the CDROM layer. These are by-and-large implemented (as of Linux 2.6)
  7. in drivers/cdrom/cdrom.c and drivers/block/scsi_ioctl.c
  8. ioctl values are listed in <linux/cdrom.h>. As of this writing, they
  9. are as follows:
  10. CDROMPAUSE Pause Audio Operation
  11. CDROMRESUME Resume paused Audio Operation
  12. CDROMPLAYMSF Play Audio MSF (struct cdrom_msf)
  13. CDROMPLAYTRKIND Play Audio Track/index (struct cdrom_ti)
  14. CDROMREADTOCHDR Read TOC header (struct cdrom_tochdr)
  15. CDROMREADTOCENTRY Read TOC entry (struct cdrom_tocentry)
  16. CDROMSTOP Stop the cdrom drive
  17. CDROMSTART Start the cdrom drive
  18. CDROMEJECT Ejects the cdrom media
  19. CDROMVOLCTRL Control output volume (struct cdrom_volctrl)
  20. CDROMSUBCHNL Read subchannel data (struct cdrom_subchnl)
  21. CDROMREADMODE2 Read CDROM mode 2 data (2336 Bytes)
  22. (struct cdrom_read)
  23. CDROMREADMODE1 Read CDROM mode 1 data (2048 Bytes)
  24. (struct cdrom_read)
  25. CDROMREADAUDIO (struct cdrom_read_audio)
  26. CDROMEJECT_SW enable(1)/disable(0) auto-ejecting
  27. CDROMMULTISESSION Obtain the start-of-last-session
  28. address of multi session disks
  29. (struct cdrom_multisession)
  30. CDROM_GET_MCN Obtain the "Universal Product Code"
  31. if available (struct cdrom_mcn)
  32. CDROM_GET_UPC Deprecated, use CDROM_GET_MCN instead.
  33. CDROMRESET hard-reset the drive
  34. CDROMVOLREAD Get the drive's volume setting
  35. (struct cdrom_volctrl)
  36. CDROMREADRAW read data in raw mode (2352 Bytes)
  37. (struct cdrom_read)
  38. CDROMREADCOOKED read data in cooked mode
  39. CDROMSEEK seek msf address
  40. CDROMPLAYBLK scsi-cd only, (struct cdrom_blk)
  41. CDROMREADALL read all 2646 bytes
  42. CDROMGETSPINDOWN return 4-bit spindown value
  43. CDROMSETSPINDOWN set 4-bit spindown value
  44. CDROMCLOSETRAY pendant of CDROMEJECT
  45. CDROM_SET_OPTIONS Set behavior options
  46. CDROM_CLEAR_OPTIONS Clear behavior options
  47. CDROM_SELECT_SPEED Set the CD-ROM speed
  48. CDROM_SELECT_DISC Select disc (for juke-boxes)
  49. CDROM_MEDIA_CHANGED Check is media changed
  50. CDROM_DRIVE_STATUS Get tray position, etc.
  51. CDROM_DISC_STATUS Get disc type, etc.
  52. CDROM_CHANGER_NSLOTS Get number of slots
  53. CDROM_LOCKDOOR lock or unlock door
  54. CDROM_DEBUG Turn debug messages on/off
  55. CDROM_GET_CAPABILITY get capabilities
  56. CDROMAUDIOBUFSIZ set the audio buffer size
  57. DVD_READ_STRUCT Read structure
  58. DVD_WRITE_STRUCT Write structure
  59. DVD_AUTH Authentication
  60. CDROM_SEND_PACKET send a packet to the drive
  61. CDROM_NEXT_WRITABLE get next writable block
  62. CDROM_LAST_WRITTEN get last block written on disc
  63. The information that follows was determined from reading kernel source
  64. code. It is likely that some corrections will be made over time.
  65. General:
  66. Unless otherwise specified, all ioctl calls return 0 on success
  67. and -1 with errno set to an appropriate value on error. (Some
  68. ioctls return non-negative data values.)
  69. Unless otherwise specified, all ioctl calls return -1 and set
  70. errno to EFAULT on a failed attempt to copy data to or from user
  71. address space.
  72. Individual drivers may return error codes not listed here.
  73. Unless otherwise specified, all data structures and constants
  74. are defined in <linux/cdrom.h>
  75. CDROMPAUSE Pause Audio Operation
  76. usage:
  77. ioctl(fd, CDROMPAUSE, 0);
  78. inputs: none
  79. outputs: none
  80. error return:
  81. ENOSYS cd drive not audio-capable.
  82. CDROMRESUME Resume paused Audio Operation
  83. usage:
  84. ioctl(fd, CDROMRESUME, 0);
  85. inputs: none
  86. outputs: none
  87. error return:
  88. ENOSYS cd drive not audio-capable.
  89. CDROMPLAYMSF Play Audio MSF (struct cdrom_msf)
  90. usage:
  91. struct cdrom_msf msf;
  92. ioctl(fd, CDROMPLAYMSF, &msf);
  93. inputs:
  94. cdrom_msf structure, describing a segment of music to play
  95. outputs: none
  96. error return:
  97. ENOSYS cd drive not audio-capable.
  98. notes:
  99. MSF stands for minutes-seconds-frames
  100. LBA stands for logical block address
  101. Segment is described as start and end times, where each time
  102. is described as minutes:seconds:frames. A frame is 1/75 of
  103. a second.
  104. CDROMPLAYTRKIND Play Audio Track/index (struct cdrom_ti)
  105. usage:
  106. struct cdrom_ti ti;
  107. ioctl(fd, CDROMPLAYTRKIND, &ti);
  108. inputs:
  109. cdrom_ti structure, describing a segment of music to play
  110. outputs: none
  111. error return:
  112. ENOSYS cd drive not audio-capable.
  113. notes:
  114. Segment is described as start and end times, where each time
  115. is described as a track and an index.
  116. CDROMREADTOCHDR Read TOC header (struct cdrom_tochdr)
  117. usage:
  118. cdrom_tochdr header;
  119. ioctl(fd, CDROMREADTOCHDR, &header);
  120. inputs:
  121. cdrom_tochdr structure
  122. outputs:
  123. cdrom_tochdr structure
  124. error return:
  125. ENOSYS cd drive not audio-capable.
  126. CDROMREADTOCENTRY Read TOC entry (struct cdrom_tocentry)
  127. usage:
  128. struct cdrom_tocentry entry;
  129. ioctl(fd, CDROMREADTOCENTRY, &entry);
  130. inputs:
  131. cdrom_tocentry structure
  132. outputs:
  133. cdrom_tocentry structure
  134. error return:
  135. ENOSYS cd drive not audio-capable.
  136. EINVAL entry.cdte_format not CDROM_MSF or CDROM_LBA
  137. EINVAL requested track out of bounds
  138. EIO I/O error reading TOC
  139. notes:
  140. TOC stands for Table Of Contents
  141. MSF stands for minutes-seconds-frames
  142. LBA stands for logical block address
  143. CDROMSTOP Stop the cdrom drive
  144. usage:
  145. ioctl(fd, CDROMSTOP, 0);
  146. inputs: none
  147. outputs: none
  148. error return:
  149. ENOSYS cd drive not audio-capable.
  150. notes:
  151. Exact interpretation of this ioctl depends on the device,
  152. but most seem to spin the drive down.
  153. CDROMSTART Start the cdrom drive
  154. usage:
  155. ioctl(fd, CDROMSTART, 0);
  156. inputs: none
  157. outputs: none
  158. error return:
  159. ENOSYS cd drive not audio-capable.
  160. notes:
  161. Exact interpretation of this ioctl depends on the device,
  162. but most seem to spin the drive up and/or close the tray.
  163. Other devices ignore the ioctl completely.
  164. CDROMEJECT Ejects the cdrom media
  165. usage:
  166. ioctl(fd, CDROMEJECT, 0);
  167. inputs: none
  168. outputs: none
  169. error returns:
  170. ENOSYS cd drive not capable of ejecting
  171. EBUSY other processes are accessing drive, or door is locked
  172. notes:
  173. See CDROM_LOCKDOOR, below.
  174. CDROMCLOSETRAY pendant of CDROMEJECT
  175. usage:
  176. ioctl(fd, CDROMCLOSETRAY, 0);
  177. inputs: none
  178. outputs: none
  179. error returns:
  180. ENOSYS cd drive not capable of closing the tray
  181. EBUSY other processes are accessing drive, or door is locked
  182. notes:
  183. See CDROM_LOCKDOOR, below.
  184. CDROMVOLCTRL Control output volume (struct cdrom_volctrl)
  185. usage:
  186. struct cdrom_volctrl volume;
  187. ioctl(fd, CDROMVOLCTRL, &volume);
  188. inputs:
  189. cdrom_volctrl structure containing volumes for up to 4
  190. channels.
  191. outputs: none
  192. error return:
  193. ENOSYS cd drive not audio-capable.
  194. CDROMVOLREAD Get the drive's volume setting
  195. (struct cdrom_volctrl)
  196. usage:
  197. struct cdrom_volctrl volume;
  198. ioctl(fd, CDROMVOLREAD, &volume);
  199. inputs: none
  200. outputs:
  201. The current volume settings.
  202. error return:
  203. ENOSYS cd drive not audio-capable.
  204. CDROMSUBCHNL Read subchannel data (struct cdrom_subchnl)
  205. usage:
  206. struct cdrom_subchnl q;
  207. ioctl(fd, CDROMSUBCHNL, &q);
  208. inputs:
  209. cdrom_subchnl structure
  210. outputs:
  211. cdrom_subchnl structure
  212. error return:
  213. ENOSYS cd drive not audio-capable.
  214. EINVAL format not CDROM_MSF or CDROM_LBA
  215. notes:
  216. Format is converted to CDROM_MSF or CDROM_LBA
  217. as per user request on return
  218. CDROMREADRAW read data in raw mode (2352 Bytes)
  219. (struct cdrom_read)
  220. usage:
  221. union {
  222. struct cdrom_msf msf; /* input */
  223. char buffer[CD_FRAMESIZE_RAW]; /* return */
  224. } arg;
  225. ioctl(fd, CDROMREADRAW, &arg);
  226. inputs:
  227. cdrom_msf structure indicating an address to read.
  228. Only the start values are significant.
  229. outputs:
  230. Data written to address provided by user.
  231. error return:
  232. EINVAL address less than 0, or msf less than 0:2:0
  233. ENOMEM out of memory
  234. notes:
  235. As of 2.6.8.1, comments in <linux/cdrom.h> indicate that this
  236. ioctl accepts a cdrom_read structure, but actual source code
  237. reads a cdrom_msf structure and writes a buffer of data to
  238. the same address.
  239. MSF values are converted to LBA values via this formula:
  240. lba = (((m * CD_SECS) + s) * CD_FRAMES + f) - CD_MSF_OFFSET;
  241. CDROMREADMODE1 Read CDROM mode 1 data (2048 Bytes)
  242. (struct cdrom_read)
  243. notes:
  244. Identical to CDROMREADRAW except that block size is
  245. CD_FRAMESIZE (2048) bytes
  246. CDROMREADMODE2 Read CDROM mode 2 data (2336 Bytes)
  247. (struct cdrom_read)
  248. notes:
  249. Identical to CDROMREADRAW except that block size is
  250. CD_FRAMESIZE_RAW0 (2336) bytes
  251. CDROMREADAUDIO (struct cdrom_read_audio)
  252. usage:
  253. struct cdrom_read_audio ra;
  254. ioctl(fd, CDROMREADAUDIO, &ra);
  255. inputs:
  256. cdrom_read_audio structure containing read start
  257. point and length
  258. outputs:
  259. audio data, returned to buffer indicated by ra
  260. error return:
  261. EINVAL format not CDROM_MSF or CDROM_LBA
  262. EINVAL nframes not in range [1 75]
  263. ENXIO drive has no queue (probably means invalid fd)
  264. ENOMEM out of memory
  265. CDROMEJECT_SW enable(1)/disable(0) auto-ejecting
  266. usage:
  267. int val;
  268. ioctl(fd, CDROMEJECT_SW, val);
  269. inputs:
  270. Flag specifying auto-eject flag.
  271. outputs: none
  272. error return:
  273. ENOSYS Drive is not capable of ejecting.
  274. EBUSY Door is locked
  275. CDROMMULTISESSION Obtain the start-of-last-session
  276. address of multi session disks
  277. (struct cdrom_multisession)
  278. usage:
  279. struct cdrom_multisession ms_info;
  280. ioctl(fd, CDROMMULTISESSION, &ms_info);
  281. inputs:
  282. cdrom_multisession structure containing desired
  283. format.
  284. outputs:
  285. cdrom_multisession structure is filled with last_session
  286. information.
  287. error return:
  288. EINVAL format not CDROM_MSF or CDROM_LBA
  289. CDROM_GET_MCN Obtain the "Universal Product Code"
  290. if available (struct cdrom_mcn)
  291. usage:
  292. struct cdrom_mcn mcn;
  293. ioctl(fd, CDROM_GET_MCN, &mcn);
  294. inputs: none
  295. outputs:
  296. Universal Product Code
  297. error return:
  298. ENOSYS Drive is not capable of reading MCN data.
  299. notes:
  300. Source code comments state:
  301. The following function is implemented, although very few
  302. audio discs give Universal Product Code information, which
  303. should just be the Medium Catalog Number on the box. Note,
  304. that the way the code is written on the CD is /not/ uniform
  305. across all discs!
  306. CDROM_GET_UPC CDROM_GET_MCN (deprecated)
  307. Not implemented, as of 2.6.8.1
  308. CDROMRESET hard-reset the drive
  309. usage:
  310. ioctl(fd, CDROMRESET, 0);
  311. inputs: none
  312. outputs: none
  313. error return:
  314. EACCES Access denied: requires CAP_SYS_ADMIN
  315. ENOSYS Drive is not capable of resetting.
  316. CDROMREADCOOKED read data in cooked mode
  317. usage:
  318. u8 buffer[CD_FRAMESIZE]
  319. ioctl(fd, CDROMREADCOOKED, buffer);
  320. inputs: none
  321. outputs:
  322. 2048 bytes of data, "cooked" mode.
  323. notes:
  324. Not implemented on all drives.
  325. CDROMREADALL read all 2646 bytes
  326. Same as CDROMREADCOOKED, but reads 2646 bytes.
  327. CDROMSEEK seek msf address
  328. usage:
  329. struct cdrom_msf msf;
  330. ioctl(fd, CDROMSEEK, &msf);
  331. inputs:
  332. MSF address to seek to.
  333. outputs: none
  334. CDROMPLAYBLK scsi-cd only, (struct cdrom_blk)
  335. usage:
  336. struct cdrom_blk blk;
  337. ioctl(fd, CDROMPLAYBLK, &blk);
  338. inputs:
  339. Region to play
  340. outputs: none
  341. CDROMGETSPINDOWN
  342. usage:
  343. char spindown;
  344. ioctl(fd, CDROMGETSPINDOWN, &spindown);
  345. inputs: none
  346. outputs:
  347. The value of the current 4-bit spindown value.
  348. CDROMSETSPINDOWN
  349. usage:
  350. char spindown
  351. ioctl(fd, CDROMSETSPINDOWN, &spindown);
  352. inputs:
  353. 4-bit value used to control spindown (TODO: more detail here)
  354. outputs: none
  355. CDROM_SET_OPTIONS Set behavior options
  356. usage:
  357. int options;
  358. ioctl(fd, CDROM_SET_OPTIONS, options);
  359. inputs:
  360. New values for drive options. The logical 'or' of:
  361. CDO_AUTO_CLOSE close tray on first open(2)
  362. CDO_AUTO_EJECT open tray on last release
  363. CDO_USE_FFLAGS use O_NONBLOCK information on open
  364. CDO_LOCK lock tray on open files
  365. CDO_CHECK_TYPE check type on open for data
  366. outputs:
  367. Returns the resulting options settings in the
  368. ioctl return value. Returns -1 on error.
  369. error return:
  370. ENOSYS selected option(s) not supported by drive.
  371. CDROM_CLEAR_OPTIONS Clear behavior options
  372. Same as CDROM_SET_OPTIONS, except that selected options are
  373. turned off.
  374. CDROM_SELECT_SPEED Set the CD-ROM speed
  375. usage:
  376. int speed;
  377. ioctl(fd, CDROM_SELECT_SPEED, speed);
  378. inputs:
  379. New drive speed.
  380. outputs: none
  381. error return:
  382. ENOSYS speed selection not supported by drive.
  383. CDROM_SELECT_DISC Select disc (for juke-boxes)
  384. usage:
  385. int disk;
  386. ioctl(fd, CDROM_SELECT_DISC, disk);
  387. inputs:
  388. Disk to load into drive.
  389. outputs: none
  390. error return:
  391. EINVAL Disk number beyond capacity of drive
  392. CDROM_MEDIA_CHANGED Check is media changed
  393. usage:
  394. int slot;
  395. ioctl(fd, CDROM_MEDIA_CHANGED, slot);
  396. inputs:
  397. Slot number to be tested, always zero except for jukeboxes.
  398. May also be special values CDSL_NONE or CDSL_CURRENT
  399. outputs:
  400. Ioctl return value is 0 or 1 depending on whether the media
  401. has been changed, or -1 on error.
  402. error returns:
  403. ENOSYS Drive can't detect media change
  404. EINVAL Slot number beyond capacity of drive
  405. ENOMEM Out of memory
  406. CDROM_DRIVE_STATUS Get tray position, etc.
  407. usage:
  408. int slot;
  409. ioctl(fd, CDROM_DRIVE_STATUS, slot);
  410. inputs:
  411. Slot number to be tested, always zero except for jukeboxes.
  412. May also be special values CDSL_NONE or CDSL_CURRENT
  413. outputs:
  414. Ioctl return value will be one of the following values
  415. from <linux/cdrom.h>:
  416. CDS_NO_INFO Information not available.
  417. CDS_NO_DISC
  418. CDS_TRAY_OPEN
  419. CDS_DRIVE_NOT_READY
  420. CDS_DISC_OK
  421. -1 error
  422. error returns:
  423. ENOSYS Drive can't detect drive status
  424. EINVAL Slot number beyond capacity of drive
  425. ENOMEM Out of memory
  426. CDROM_DISC_STATUS Get disc type, etc.
  427. usage:
  428. ioctl(fd, CDROM_DISC_STATUS, 0);
  429. inputs: none
  430. outputs:
  431. Ioctl return value will be one of the following values
  432. from <linux/cdrom.h>:
  433. CDS_NO_INFO
  434. CDS_AUDIO
  435. CDS_MIXED
  436. CDS_XA_2_2
  437. CDS_XA_2_1
  438. CDS_DATA_1
  439. error returns: none at present
  440. notes:
  441. Source code comments state:
  442. Ok, this is where problems start. The current interface for
  443. the CDROM_DISC_STATUS ioctl is flawed. It makes the false
  444. assumption that CDs are all CDS_DATA_1 or all CDS_AUDIO, etc.
  445. Unfortunately, while this is often the case, it is also
  446. very common for CDs to have some tracks with data, and some
  447. tracks with audio. Just because I feel like it, I declare
  448. the following to be the best way to cope. If the CD has
  449. ANY data tracks on it, it will be returned as a data CD.
  450. If it has any XA tracks, I will return it as that. Now I
  451. could simplify this interface by combining these returns with
  452. the above, but this more clearly demonstrates the problem
  453. with the current interface. Too bad this wasn't designed
  454. to use bitmasks... -Erik
  455. Well, now we have the option CDS_MIXED: a mixed-type CD.
  456. User level programmers might feel the ioctl is not very
  457. useful.
  458. ---david
  459. CDROM_CHANGER_NSLOTS Get number of slots
  460. usage:
  461. ioctl(fd, CDROM_CHANGER_NSLOTS, 0);
  462. inputs: none
  463. outputs:
  464. The ioctl return value will be the number of slots in a
  465. CD changer. Typically 1 for non-multi-disk devices.
  466. error returns: none
  467. CDROM_LOCKDOOR lock or unlock door
  468. usage:
  469. int lock;
  470. ioctl(fd, CDROM_LOCKDOOR, lock);
  471. inputs:
  472. Door lock flag, 1=lock, 0=unlock
  473. outputs: none
  474. error returns:
  475. EDRIVE_CANT_DO_THIS Door lock function not supported.
  476. EBUSY Attempt to unlock when multiple users
  477. have the drive open and not CAP_SYS_ADMIN
  478. notes:
  479. As of 2.6.8.1, the lock flag is a global lock, meaning that
  480. all CD drives will be locked or unlocked together. This is
  481. probably a bug.
  482. The EDRIVE_CANT_DO_THIS value is defined in <linux/cdrom.h>
  483. and is currently (2.6.8.1) the same as EOPNOTSUPP
  484. CDROM_DEBUG Turn debug messages on/off
  485. usage:
  486. int debug;
  487. ioctl(fd, CDROM_DEBUG, debug);
  488. inputs:
  489. Cdrom debug flag, 0=disable, 1=enable
  490. outputs:
  491. The ioctl return value will be the new debug flag.
  492. error return:
  493. EACCES Access denied: requires CAP_SYS_ADMIN
  494. CDROM_GET_CAPABILITY get capabilities
  495. usage:
  496. ioctl(fd, CDROM_GET_CAPABILITY, 0);
  497. inputs: none
  498. outputs:
  499. The ioctl return value is the current device capability
  500. flags. See CDC_CLOSE_TRAY, CDC_OPEN_TRAY, etc.
  501. CDROMAUDIOBUFSIZ set the audio buffer size
  502. usage:
  503. int arg;
  504. ioctl(fd, CDROMAUDIOBUFSIZ, val);
  505. inputs:
  506. New audio buffer size
  507. outputs:
  508. The ioctl return value is the new audio buffer size, or -1
  509. on error.
  510. error return:
  511. ENOSYS Not supported by this driver.
  512. notes:
  513. Not supported by all drivers.
  514. DVD_READ_STRUCT Read structure
  515. usage:
  516. dvd_struct s;
  517. ioctl(fd, DVD_READ_STRUCT, &s);
  518. inputs:
  519. dvd_struct structure, containing:
  520. type specifies the information desired, one of
  521. DVD_STRUCT_PHYSICAL, DVD_STRUCT_COPYRIGHT,
  522. DVD_STRUCT_DISCKEY, DVD_STRUCT_BCA,
  523. DVD_STRUCT_MANUFACT
  524. physical.layer_num desired layer, indexed from 0
  525. copyright.layer_num desired layer, indexed from 0
  526. disckey.agid
  527. outputs:
  528. dvd_struct structure, containing:
  529. physical for type == DVD_STRUCT_PHYSICAL
  530. copyright for type == DVD_STRUCT_COPYRIGHT
  531. disckey.value for type == DVD_STRUCT_DISCKEY
  532. bca.{len,value} for type == DVD_STRUCT_BCA
  533. manufact.{len,valu} for type == DVD_STRUCT_MANUFACT
  534. error returns:
  535. EINVAL physical.layer_num exceeds number of layers
  536. EIO Received invalid response from drive
  537. DVD_WRITE_STRUCT Write structure
  538. Not implemented, as of 2.6.8.1
  539. DVD_AUTH Authentication
  540. usage:
  541. dvd_authinfo ai;
  542. ioctl(fd, DVD_AUTH, &ai);
  543. inputs:
  544. dvd_authinfo structure. See <linux/cdrom.h>
  545. outputs:
  546. dvd_authinfo structure.
  547. error return:
  548. ENOTTY ai.type not recognized.
  549. CDROM_SEND_PACKET send a packet to the drive
  550. usage:
  551. struct cdrom_generic_command cgc;
  552. ioctl(fd, CDROM_SEND_PACKET, &cgc);
  553. inputs:
  554. cdrom_generic_command structure containing the packet to send.
  555. outputs: none
  556. cdrom_generic_command structure containing results.
  557. error return:
  558. EIO command failed.
  559. EPERM Operation not permitted, either because a
  560. write command was attempted on a drive which
  561. is opened read-only, or because the command
  562. requires CAP_SYS_RAWIO
  563. EINVAL cgc.data_direction not set
  564. CDROM_NEXT_WRITABLE get next writable block
  565. usage:
  566. long next;
  567. ioctl(fd, CDROM_NEXT_WRITABLE, &next);
  568. inputs: none
  569. outputs:
  570. The next writable block.
  571. notes:
  572. If the device does not support this ioctl directly, the
  573. ioctl will return CDROM_LAST_WRITTEN + 7.
  574. CDROM_LAST_WRITTEN get last block written on disc
  575. usage:
  576. long last;
  577. ioctl(fd, CDROM_LAST_WRITTEN, &last);
  578. inputs: none
  579. outputs:
  580. The last block written on disc
  581. notes:
  582. If the device does not support this ioctl directly, the
  583. result is derived from the disc's table of contents. If the
  584. table of contents can't be read, this ioctl returns an
  585. error.