diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2009-05-26 00:50:45 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2009-05-26 00:50:45 +0200 |
commit | d3c8231e738dd286591c1becc2f327ed55ed89d1 (patch) | |
tree | 6240c376a535f6f00ace2af6080e05c16cd1de8a /extras/cdrom_id/cdrom_id.c | |
parent | bec7e07acc8ca2288e780d11b4d1e1387c3513dc (diff) |
cdrom_id: suppress ID_CDROM_MEDIA_STATE=blank for plain non-writable CDROM media
Some broken fake cdrom drives return ID_CDROM_MEDIA_STATE=blank.
$ /lib/udev/cdrom_id -d /dev/sr1
main: probing: '/dev/sr1'
cd_inquiry: INQUIRY: [Nokia ][S60 ][1.0 ]
cd_profiles: GET CONFIGURATION: number of profiles 76
cd_profiles: current profile 0x08
cd_media_toc: READ TOC: len: 12
cd_media_toc: last track 1 starts at block 0
cd_media_info: disk type 00
ID_CDROM=1
ID_CDROM_MRW=1
ID_CDROM_MRW_W=1
ID_CDROM_MEDIA=1
ID_CDROM_MEDIA_CD=1
ID_CDROM_MEDIA_STATE=blank
Others work fine, but ID_CDROM_MEDIA_STATE is not needed for non-writable CDROM media:
$ /lib/udev/cdrom_id -d /dev/sr1
main: probing: '/dev/sr1'
cd_inquiry: INQUIRY: [SanDisk ][U3 Cruzer Micro ][8.02]
cd_profiles: GET CONFIGURATION: number of profiles 72
cd_profiles: current profile 0x08
cd_media_toc: READ TOC: len: 20
cd_media_toc: track=1 info=0x4(data) start_block=0
cd_media_toc: last track 1 starts at block 0
cd_media_info: disk type 00
ID_CDROM=1
ID_CDROM_MRW=1
ID_CDROM_MRW_W=1
ID_CDROM_MEDIA=1
ID_CDROM_MEDIA_CD=1
ID_CDROM_MEDIA_STATE=complete
ID_CDROM_MEDIA_SESSION_COUNT=1
ID_CDROM_MEDIA_TRACK_COUNT=1
ID_CDROM_MEDIA_TRACK_COUNT_DATA=1
Diffstat (limited to 'extras/cdrom_id/cdrom_id.c')
-rw-r--r-- | extras/cdrom_id/cdrom_id.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 0d873ae8e5..921e5346c9 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -426,8 +426,10 @@ static int cd_media_info(struct udev *udev, int fd) info(udev, "disk type %02x\n", header[8]); - if ((header[2] & 3) < 4) + /* exclude plain CDROM, some fake cdroms return 0 for "blank" media here */ + if (!cd_media_cd_rom && (header[2] & 3) < 4) cd_media_state = media_status[header[2] & 3]; + if ((header[2] & 3) != 2) cd_media_session_next = header[10] << 8 | header[5]; cd_media_session_count = header[9] << 8 | header[4]; |