cdrom.txt 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966
  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, CDROMEJECT, 0);
  177. inputs: none
  178. outputs: none
  179. error returns:
  180. ENOSYS cd drive not capable of ejecting
  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 on return
  217. CDROMREADRAW read data in raw mode (2352 Bytes)
  218. (struct cdrom_read)
  219. usage:
  220. union {
  221. struct cdrom_msf msf; /* input */
  222. char buffer[CD_FRAMESIZE_RAW]; /* return */
  223. } arg;
  224. ioctl(fd, CDROMREADRAW, &arg);
  225. inputs:
  226. cdrom_msf structure indicating an address to read.
  227. Only the start values are significant.
  228. outputs:
  229. Data written to address provided by user.
  230. error return:
  231. EINVAL address less than 0, or msf less than 0:2:0
  232. ENOMEM out of memory
  233. notes:
  234. As of 2.6.8.1, comments in <linux/cdrom.h> indicate that this
  235. ioctl accepts a cdrom_read structure, but actual source code
  236. reads a cdrom_msf structure and writes a buffer of data to
  237. the same address.
  238. MSF values are converted to LBA values via this formula:
  239. lba = (((m * CD_SECS) + s) * CD_FRAMES + f) - CD_MSF_OFFSET;
  240. CDROMREADMODE1 Read CDROM mode 1 data (2048 Bytes)
  241. (struct cdrom_read)
  242. notes:
  243. Identical to CDROMREADRAW except that block size is
  244. CD_FRAMESIZE (2048) bytes
  245. CDROMREADMODE2 Read CDROM mode 2 data (2336 Bytes)
  246. (struct cdrom_read)
  247. notes:
  248. Identical to CDROMREADRAW except that block size is
  249. CD_FRAMESIZE_RAW0 (2336) bytes
  250. CDROMREADAUDIO (struct cdrom_read_audio)
  251. usage:
  252. struct cdrom_read_audio ra;
  253. ioctl(fd, CDROMREADAUDIO, &ra);
  254. inputs:
  255. cdrom_read_audio structure containing read start
  256. point and length
  257. outputs:
  258. audio data, returned to buffer indicated by ra
  259. error return:
  260. EINVAL format not CDROM_MSF or CDROM_LBA
  261. EINVAL nframes not in range [1 75]
  262. ENXIO drive has no queue (probably means invalid fd)
  263. ENOMEM out of memory
  264. CDROMEJECT_SW enable(1)/disable(0) auto-ejecting
  265. usage:
  266. int val;
  267. ioctl(fd, CDROMEJECT_SW, val);
  268. inputs:
  269. Flag specifying auto-eject flag.
  270. outputs: none
  271. error return:
  272. ENOSYS Drive is not capable of ejecting.
  273. EBUSY Door is locked
  274. CDROMMULTISESSION Obtain the start-of-last-session
  275. address of multi session disks
  276. (struct cdrom_multisession)
  277. usage:
  278. struct cdrom_multisession ms_info;
  279. ioctl(fd, CDROMMULTISESSION, &ms_info);
  280. inputs:
  281. cdrom_multisession structure containing desired
  282. format.
  283. outputs:
  284. cdrom_multisession structure is filled with last_session
  285. information.
  286. error return:
  287. EINVAL format not CDROM_MSF or CDROM_LBA
  288. CDROM_GET_MCN Obtain the "Universal Product Code"
  289. if available (struct cdrom_mcn)
  290. usage:
  291. struct cdrom_mcn mcn;
  292. ioctl(fd, CDROM_GET_MCN, &mcn);
  293. inputs: none
  294. outputs:
  295. Universal Product Code
  296. error return:
  297. ENOSYS Drive is not capable of reading MCN data.
  298. notes:
  299. Source code comments state:
  300. The following function is implemented, although very few
  301. audio discs give Universal Product Code information, which
  302. should just be the Medium Catalog Number on the box. Note,
  303. that the way the code is written on the CD is /not/ uniform
  304. across all discs!
  305. CDROM_GET_UPC CDROM_GET_MCN (deprecated)
  306. Not implemented, as of 2.6.8.1
  307. CDROMRESET hard-reset the drive
  308. usage:
  309. ioctl(fd, CDROMRESET, 0);
  310. inputs: none
  311. outputs: none
  312. error return:
  313. EACCES Access denied: requires CAP_SYS_ADMIN
  314. ENOSYS Drive is not capable of resetting.
  315. CDROMREADCOOKED read data in cooked mode
  316. usage:
  317. u8 buffer[CD_FRAMESIZE]
  318. ioctl(fd, CDROMREADCOOKED, buffer);
  319. inputs: none
  320. outputs:
  321. 2048 bytes of data, "cooked" mode.
  322. notes:
  323. Not implemented on all drives.
  324. CDROMREADALL read all 2646 bytes
  325. Same as CDROMREADCOOKED, but reads 2646 bytes.
  326. CDROMSEEK seek msf address
  327. usage:
  328. struct cdrom_msf msf;
  329. ioctl(fd, CDROMSEEK, &msf);
  330. inputs:
  331. MSF address to seek to.
  332. outputs: none
  333. CDROMPLAYBLK scsi-cd only, (struct cdrom_blk)
  334. usage:
  335. struct cdrom_blk blk;
  336. ioctl(fd, CDROMPLAYBLK, &blk);
  337. inputs:
  338. Region to play
  339. outputs: none
  340. CDROMGETSPINDOWN
  341. usage:
  342. char spindown;
  343. ioctl(fd, CDROMGETSPINDOWN, &spindown);
  344. inputs: none
  345. outputs:
  346. The value of the current 4-bit spindown value.
  347. CDROMSETSPINDOWN
  348. usage:
  349. char spindown
  350. ioctl(fd, CDROMSETSPINDOWN, &spindown);
  351. inputs:
  352. 4-bit value used to control spindown (TODO: more detail here)
  353. outputs: none
  354. CDROM_SET_OPTIONS Set behavior options
  355. usage:
  356. int options;
  357. ioctl(fd, CDROM_SET_OPTIONS, options);
  358. inputs:
  359. New values for drive options. The logical 'or' of:
  360. CDO_AUTO_CLOSE close tray on first open(2)
  361. CDO_AUTO_EJECT open tray on last release
  362. CDO_USE_FFLAGS use O_NONBLOCK information on open
  363. CDO_LOCK lock tray on open files
  364. CDO_CHECK_TYPE check type on open for data
  365. outputs:
  366. Returns the resulting options settings in the
  367. ioctl return value. Returns -1 on error.
  368. error return:
  369. ENOSYS selected option(s) not supported by drive.
  370. CDROM_CLEAR_OPTIONS Clear behavior options
  371. Same as CDROM_SET_OPTIONS, except that selected options are
  372. turned off.
  373. CDROM_SELECT_SPEED Set the CD-ROM speed
  374. usage:
  375. int speed;
  376. ioctl(fd, CDROM_SELECT_SPEED, speed);
  377. inputs:
  378. New drive speed.
  379. outputs: none
  380. error return:
  381. ENOSYS speed selection not supported by drive.
  382. CDROM_SELECT_DISC Select disc (for juke-boxes)
  383. usage:
  384. int disk;
  385. ioctl(fd, CDROM_SELECT_DISC, disk);
  386. inputs:
  387. Disk to load into drive.
  388. outputs: none
  389. error return:
  390. EINVAL Disk number beyond capacity of drive
  391. CDROM_MEDIA_CHANGED Check is media changed
  392. usage:
  393. int slot;
  394. ioctl(fd, CDROM_MEDIA_CHANGED, slot);
  395. inputs:
  396. Slot number to be tested, always zero except for jukeboxes.
  397. May also be special values CDSL_NONE or CDSL_CURRENT
  398. outputs:
  399. Ioctl return value is 0 or 1 depending on whether the media
  400. has been changed, or -1 on error.
  401. error returns:
  402. ENOSYS Drive can't detect media change
  403. EINVAL Slot number beyond capacity of drive
  404. ENOMEM Out of memory
  405. CDROM_DRIVE_STATUS Get tray position, etc.
  406. usage:
  407. int slot;
  408. ioctl(fd, CDROM_DRIVE_STATUS, slot);
  409. inputs:
  410. Slot number to be tested, always zero except for jukeboxes.
  411. May also be special values CDSL_NONE or CDSL_CURRENT
  412. outputs:
  413. Ioctl return value will be one of the following values
  414. from <linux/cdrom.h>:
  415. CDS_NO_INFO Information not available.
  416. CDS_NO_DISC
  417. CDS_TRAY_OPEN
  418. CDS_DRIVE_NOT_READY
  419. CDS_DISC_OK
  420. -1 error
  421. error returns:
  422. ENOSYS Drive can't detect drive status
  423. EINVAL Slot number beyond capacity of drive
  424. ENOMEM Out of memory
  425. CDROM_DISC_STATUS Get disc type, etc.
  426. usage:
  427. ioctl(fd, CDROM_DISC_STATUS, 0);
  428. inputs: none
  429. outputs:
  430. Ioctl return value will be one of the following values
  431. from <linux/cdrom.h>:
  432. CDS_NO_INFO
  433. CDS_AUDIO
  434. CDS_MIXED
  435. CDS_XA_2_2
  436. CDS_XA_2_1
  437. CDS_DATA_1
  438. error returns: none at present
  439. notes:
  440. Source code comments state:
  441. Ok, this is where problems start. The current interface for
  442. the CDROM_DISC_STATUS ioctl is flawed. It makes the false
  443. assumption that CDs are all CDS_DATA_1 or all CDS_AUDIO, etc.
  444. Unfortunately, while this is often the case, it is also
  445. very common for CDs to have some tracks with data, and some
  446. tracks with audio. Just because I feel like it, I declare
  447. the following to be the best way to cope. If the CD has
  448. ANY data tracks on it, it will be returned as a data CD.
  449. If it has any XA tracks, I will return it as that. Now I
  450. could simplify this interface by combining these returns with
  451. the above, but this more clearly demonstrates the problem
  452. with the current interface. Too bad this wasn't designed
  453. to use bitmasks... -Erik
  454. Well, now we have the option CDS_MIXED: a mixed-type CD.
  455. User level programmers might feel the ioctl is not very
  456. useful.
  457. ---david
  458. CDROM_CHANGER_NSLOTS Get number of slots
  459. usage:
  460. ioctl(fd, CDROM_CHANGER_NSLOTS, 0);
  461. inputs: none
  462. outputs:
  463. The ioctl return value will be the number of slots in a
  464. CD changer. Typically 1 for non-multi-disk devices.
  465. error returns: none
  466. CDROM_LOCKDOOR lock or unlock door
  467. usage:
  468. int lock;
  469. ioctl(fd, CDROM_LOCKDOOR, lock);
  470. inputs:
  471. Door lock flag, 1=lock, 0=unlock
  472. outputs: none
  473. error returns:
  474. EDRIVE_CANT_DO_THIS Door lock function not supported.
  475. EBUSY Attempt to unlock when multiple users
  476. have the drive open and not CAP_SYS_ADMIN
  477. notes:
  478. As of 2.6.8.1, the lock flag is a global lock, meaning that
  479. all CD drives will be locked or unlocked together. This is
  480. probably a bug.
  481. The EDRIVE_CANT_DO_THIS value is defined in <linux/cdrom.h>
  482. and is currently (2.6.8.1) the same as EOPNOTSUPP
  483. CDROM_DEBUG Turn debug messages on/off
  484. usage:
  485. int debug;
  486. ioctl(fd, CDROM_DEBUG, debug);
  487. inputs:
  488. Cdrom debug flag, 0=disable, 1=enable
  489. outputs:
  490. The ioctl return value will be the new debug flag.
  491. error return:
  492. EACCES Access denied: requires CAP_SYS_ADMIN
  493. CDROM_GET_CAPABILITY get capabilities
  494. usage:
  495. ioctl(fd, CDROM_GET_CAPABILITY, 0);
  496. inputs: none
  497. outputs:
  498. The ioctl return value is the current device capability
  499. flags. See CDC_CLOSE_TRAY, CDC_OPEN_TRAY, etc.
  500. CDROMAUDIOBUFSIZ set the audio buffer size
  501. usage:
  502. int arg;
  503. ioctl(fd, CDROMAUDIOBUFSIZ, val);
  504. inputs:
  505. New audio buffer size
  506. outputs:
  507. The ioctl return value is the new audio buffer size, or -1
  508. on error.
  509. error return:
  510. ENOSYS Not supported by this driver.
  511. notes:
  512. Not supported by all drivers.
  513. DVD_READ_STRUCT Read structure
  514. usage:
  515. dvd_struct s;
  516. ioctl(fd, DVD_READ_STRUCT, &s);
  517. inputs:
  518. dvd_struct structure, containing:
  519. type specifies the information desired, one of
  520. DVD_STRUCT_PHYSICAL, DVD_STRUCT_COPYRIGHT,
  521. DVD_STRUCT_DISCKEY, DVD_STRUCT_BCA,
  522. DVD_STRUCT_MANUFACT
  523. physical.layer_num desired layer, indexed from 0
  524. copyright.layer_num desired layer, indexed from 0
  525. disckey.agid
  526. outputs:
  527. dvd_struct structure, containing:
  528. physical for type == DVD_STRUCT_PHYSICAL
  529. copyright for type == DVD_STRUCT_COPYRIGHT
  530. disckey.value for type == DVD_STRUCT_DISCKEY
  531. bca.{len,value} for type == DVD_STRUCT_BCA
  532. manufact.{len,valu} for type == DVD_STRUCT_MANUFACT
  533. error returns:
  534. EINVAL physical.layer_num exceeds number of layers
  535. EIO Received invalid response from drive
  536. DVD_WRITE_STRUCT Write structure
  537. Not implemented, as of 2.6.8.1
  538. DVD_AUTH Authentication
  539. usage:
  540. dvd_authinfo ai;
  541. ioctl(fd, DVD_AUTH, &ai);
  542. inputs:
  543. dvd_authinfo structure. See <linux/cdrom.h>
  544. outputs:
  545. dvd_authinfo structure.
  546. error return:
  547. ENOTTY ai.type not recognized.
  548. CDROM_SEND_PACKET send a packet to the drive
  549. usage:
  550. struct cdrom_generic_command cgc;
  551. ioctl(fd, CDROM_SEND_PACKET, &cgc);
  552. inputs:
  553. cdrom_generic_command structure containing the packet to send.
  554. outputs: none
  555. cdrom_generic_command structure containing results.
  556. error return:
  557. EIO command failed.
  558. EPERM Operation not permitted, either because a
  559. write command was attempted on a drive which
  560. is opened read-only, or because the command
  561. requires CAP_SYS_RAWIO
  562. EINVAL cgc.data_direction not set
  563. CDROM_NEXT_WRITABLE get next writable block
  564. usage:
  565. long next;
  566. ioctl(fd, CDROM_NEXT_WRITABLE, &next);
  567. inputs: none
  568. outputs:
  569. The next writable block.
  570. notes:
  571. If the device does not support this ioctl directly, the
  572. ioctl will return CDROM_LAST_WRITTEN + 7.
  573. CDROM_LAST_WRITTEN get last block written on disc
  574. usage:
  575. long last;
  576. ioctl(fd, CDROM_LAST_WRITTEN, &last);
  577. inputs: none
  578. outputs:
  579. The last block written on disc
  580. notes:
  581. If the device does not support this ioctl directly, the
  582. result is derived from the disc's table of contents. If the
  583. table of contents can't be read, this ioctl returns an
  584. error.