📄 cdrom.txt
字号:
CDROM_GET_UPC CDROM_GET_MCN (deprecated) Not implemented, as of 2.6.8.1CDROMRESET hard-reset the drive usage: ioctl(fd, CDROMRESET, 0); inputs: none outputs: none error return: EACCES Access denied: requires CAP_SYS_ADMIN ENOSYS Drive is not capable of resetting.CDROMREADCOOKED read data in cooked mode usage: u8 buffer[CD_FRAMESIZE] ioctl(fd, CDROMREADCOOKED, buffer); inputs: none outputs: 2048 bytes of data, "cooked" mode. notes: Not implemented on all drives.CDROMREADALL read all 2646 bytes Same as CDROMREADCOOKED, but reads 2646 bytes.CDROMSEEK seek msf address usage: struct cdrom_msf msf; ioctl(fd, CDROMSEEK, &msf); inputs: MSF address to seek to. outputs: noneCDROMPLAYBLK scsi-cd only, (struct cdrom_blk) usage: struct cdrom_blk blk; ioctl(fd, CDROMPLAYBLK, &blk); inputs: Region to play outputs: noneCDROMGETSPINDOWN usage: char spindown; ioctl(fd, CDROMGETSPINDOWN, &spindown); inputs: none outputs: The value of the current 4-bit spindown value.CDROMSETSPINDOWN usage: char spindown ioctl(fd, CDROMSETSPINDOWN, &spindown); inputs: 4-bit value used to control spindown (TODO: more detail here) outputs: noneCDROM_SET_OPTIONS Set behavior options usage: int options; ioctl(fd, CDROM_SET_OPTIONS, options); inputs: New values for drive options. The logical 'or' of: CDO_AUTO_CLOSE close tray on first open(2) CDO_AUTO_EJECT open tray on last release CDO_USE_FFLAGS use O_NONBLOCK information on open CDO_LOCK lock tray on open files CDO_CHECK_TYPE check type on open for data outputs: Returns the resulting options settings in the ioctl return value. Returns -1 on error. error return: ENOSYS selected option(s) not supported by drive.CDROM_CLEAR_OPTIONS Clear behavior options Same as CDROM_SET_OPTIONS, except that selected options are turned off.CDROM_SELECT_SPEED Set the CD-ROM speed usage: int speed; ioctl(fd, CDROM_SELECT_SPEED, speed); inputs: New drive speed. outputs: none error return: ENOSYS speed selection not supported by drive.CDROM_SELECT_DISC Select disc (for juke-boxes) usage: int disk; ioctl(fd, CDROM_SELECT_DISC, disk); inputs: Disk to load into drive. outputs: none error return: EINVAL Disk number beyond capacity of driveCDROM_MEDIA_CHANGED Check is media changed usage: int slot; ioctl(fd, CDROM_MEDIA_CHANGED, slot); inputs: Slot number to be tested, always zero except for jukeboxes. May also be special values CDSL_NONE or CDSL_CURRENT outputs: Ioctl return value is 0 or 1 depending on whether the media has been changed, or -1 on error. error returns: ENOSYS Drive can't detect media change EINVAL Slot number beyond capacity of drive ENOMEM Out of memoryCDROM_DRIVE_STATUS Get tray position, etc. usage: int slot; ioctl(fd, CDROM_DRIVE_STATUS, slot); inputs: Slot number to be tested, always zero except for jukeboxes. May also be special values CDSL_NONE or CDSL_CURRENT outputs: Ioctl return value will be one of the following values from <linux/cdrom.h>: CDS_NO_INFO Information not available. CDS_NO_DISC CDS_TRAY_OPEN CDS_DRIVE_NOT_READY CDS_DISC_OK -1 error error returns: ENOSYS Drive can't detect drive status EINVAL Slot number beyond capacity of drive ENOMEM Out of memoryCDROM_DISC_STATUS Get disc type, etc. usage: ioctl(fd, CDROM_DISC_STATUS, 0); inputs: none outputs: Ioctl return value will be one of the following values from <linux/cdrom.h>: CDS_NO_INFO CDS_AUDIO CDS_MIXED CDS_XA_2_2 CDS_XA_2_1 CDS_DATA_1 error returns: none at present notes: Source code comments state: Ok, this is where problems start. The current interface for the CDROM_DISC_STATUS ioctl is flawed. It makes the false assumption that CDs are all CDS_DATA_1 or all CDS_AUDIO, etc. Unfortunately, while this is often the case, it is also very common for CDs to have some tracks with data, and some tracks with audio. Just because I feel like it, I declare the following to be the best way to cope. If the CD has ANY data tracks on it, it will be returned as a data CD. If it has any XA tracks, I will return it as that. Now I could simplify this interface by combining these returns with the above, but this more clearly demonstrates the problem with the current interface. Too bad this wasn't designed to use bitmasks... -Erik Well, now we have the option CDS_MIXED: a mixed-type CD. User level programmers might feel the ioctl is not very useful. ---davidCDROM_CHANGER_NSLOTS Get number of slots usage: ioctl(fd, CDROM_CHANGER_NSLOTS, 0); inputs: none outputs: The ioctl return value will be the number of slots in a CD changer. Typically 1 for non-multi-disk devices. error returns: noneCDROM_LOCKDOOR lock or unlock door usage: int lock; ioctl(fd, CDROM_LOCKDOOR, lock); inputs: Door lock flag, 1=lock, 0=unlock outputs: none error returns: EDRIVE_CANT_DO_THIS Door lock function not supported. EBUSY Attempt to unlock when multiple users have the drive open and not CAP_SYS_ADMIN notes: As of 2.6.8.1, the lock flag is a global lock, meaning that all CD drives will be locked or unlocked together. This is probably a bug. The EDRIVE_CANT_DO_THIS value is defined in <linux/cdrom.h> and is currently (2.6.8.1) the same as EOPNOTSUPPCDROM_DEBUG Turn debug messages on/off usage: int debug; ioctl(fd, CDROM_DEBUG, debug); inputs: Cdrom debug flag, 0=disable, 1=enable outputs: The ioctl return value will be the new debug flag. error return: EACCES Access denied: requires CAP_SYS_ADMINCDROM_GET_CAPABILITY get capabilities usage: ioctl(fd, CDROM_GET_CAPABILITY, 0); inputs: none outputs: The ioctl return value is the current device capability flags. See CDC_CLOSE_TRAY, CDC_OPEN_TRAY, etc.CDROMAUDIOBUFSIZ set the audio buffer size usage: int arg; ioctl(fd, CDROMAUDIOBUFSIZ, val); inputs: New audio buffer size outputs: The ioctl return value is the new audio buffer size, or -1 on error. error return: ENOSYS Not supported by this driver. notes: Not supported by all drivers.DVD_READ_STRUCT Read structure usage: dvd_struct s; ioctl(fd, DVD_READ_STRUCT, &s); inputs: dvd_struct structure, containing: type specifies the information desired, one of DVD_STRUCT_PHYSICAL, DVD_STRUCT_COPYRIGHT, DVD_STRUCT_DISCKEY, DVD_STRUCT_BCA, DVD_STRUCT_MANUFACT physical.layer_num desired layer, indexed from 0 copyright.layer_num desired layer, indexed from 0 disckey.agid outputs: dvd_struct structure, containing: physical for type == DVD_STRUCT_PHYSICAL copyright for type == DVD_STRUCT_COPYRIGHT disckey.value for type == DVD_STRUCT_DISCKEY bca.{len,value} for type == DVD_STRUCT_BCA manufact.{len,valu} for type == DVD_STRUCT_MANUFACT error returns: EINVAL physical.layer_num exceeds number of layers EIO Received invalid response from driveDVD_WRITE_STRUCT Write structure Not implemented, as of 2.6.8.1DVD_AUTH Authentication usage: dvd_authinfo ai; ioctl(fd, DVD_AUTH, &ai); inputs: dvd_authinfo structure. See <linux/cdrom.h> outputs: dvd_authinfo structure. error return: ENOTTY ai.type not recognized.CDROM_SEND_PACKET send a packet to the drive usage: struct cdrom_generic_command cgc; ioctl(fd, CDROM_SEND_PACKET, &cgc); inputs: cdrom_generic_command structure containing the packet to send. outputs: none cdrom_generic_command structure containing results. error return: EIO command failed. EPERM Operation not permitted, either because a write command was attempted on a drive which is opened read-only, or because the command requires CAP_SYS_RAWIO EINVAL cgc.data_direction not setCDROM_NEXT_WRITABLE get next writable block usage: long next; ioctl(fd, CDROM_NEXT_WRITABLE, &next); inputs: none outputs: The next writable block. notes: If the device does not support this ioctl directly, the ioctl will return CDROM_LAST_WRITTEN + 7.CDROM_LAST_WRITTEN get last block written on disc usage: long last; ioctl(fd, CDROM_LAST_WRITTEN, &last); inputs: none outputs: The last block written on disc notes: If the device does not support this ioctl directly, the result is derived from the disc's table of contents. If the table of contents can't be read, this ioctl returns an error.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -