summaryrefslogtreecommitdiff
path: root/extras/cdrom_id
AgeCommit message (Collapse)Author
2011-03-15cdrom_id: Don't ignore profiles when there is no media availableDavid Zeuthen
Just because the GET CONFIGURATION MMC-2 command returns the current profile as 0 does not mean that we can ignore the profiles describing the capabilities of the drive - it only means that there currently is no recognized media in the drive. Therefore, do process the returned profiles even when cur_profile is 0. This fixes a bug where only ID_CDROM=1 ID_CDROM_CD_R=1 ID_CDROM_CD_RW=1 ID_CDROM_DVD=1 ID_CDROM_DVD_R=1 ID_CDROM_DVD_RAM=1 was returned when there is no media in the drive instead of ID_CDROM=1 ID_CDROM_CD=1 ID_CDROM_CD_R=1 ID_CDROM_CD_RW=1 ID_CDROM_DVD=1 ID_CDROM_DVD_R=1 ID_CDROM_DVD_RW=1 ID_CDROM_DVD_RAM=1 ID_CDROM_DVD_PLUS_R=1 ID_CDROM_DVD_PLUS_RW=1 ID_CDROM_DVD_PLUS_R_DL=1 ID_CDROM_BD=1 ID_CDROM_BD_R=1 ID_CDROM_BD_RE=1 ID_CDROM_HDDVD=1 as is returned now. Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-02-24cdrom_id: cd_media_toc() extend toc size to 65536Harald Hoyer
Seems like an iDRAC reports a lot of toc entries. "For cd_media_toc() will have to be modified to handle larger tables right now it has an "unsigned char toc[2048]" but the toc can be up to 65536 bytes long . I got a TOC length of 4610 bytes, causing cd_media_toc() to fail." https://bugzilla.redhat.com/show_bug.cgi?id=660367 Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
2010-10-26cdrom_id: Fix media state for unreadable DVDsJan Drzewiecki
If the disc is unreadable and reading of the first 32 blocks fails set the cd_media status to 0 (not present). This will prevent udev from executing blkid next that tries to determine fs on the disc and which in this case may seem to hang forever locking the drive. Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
2010-10-07cdrom_id: request the drive profile features with a dynamic lengthHarald Hoyer
Some drives don't like huge feature buffers, so we query twice. First run for the current profile and to get the length. Second time we query the whole profile feature set.
2010-10-05cdrom_id: Don't read beyond "last track" in TOCMartin Pitt
Read the first and last track from the TOC header, and do not go beyond that stated number of tracks when reading the TOC. Otherwise we interpret random data which leads to bogus tracks. (Reported on an IronKey, which reported 1 data track, and 4 audio tracks which weren't actually present.)
2010-10-05cdrom_id: Fall back to CDROM_DRIVE_STATUS if all MMC commands failMartin Pitt
Reportedly, some "when I'm grown up I want to be a CD drive" fake USB CD sticks like the IronKey neither support the SCSI "GET CONFIGURATION" nor the older (pre-MMC2) "READ DISC INFORMATION" command. In that case, check if cd_media_compat() detected that there is a disc present, and assume that we have a CD-ROM medium.
2010-10-05Revert "cdrom_id: Try reading the medium if all MMC commands fail"Martin Pitt
Turns out we can do this much simpler by assuming that cd_media_compat() works, which seems to be the case for the IronKey. This reverts commit ea88774a922c734afd751a59d8102bfa4806a1a6.
2010-10-05cdrom_id: Try reading the medium if all MMC commands failMartin Pitt
Reportedly, some "when I'm grown up I want to be a CD drive" fake USB CD sticks like the IronKey neither support the SCSI "GET CONFIGURATION" nor the older (pre-MMC2) "READ DISC INFORMATION" command. In that case, check if we can read data from the drive, and assume that we have a CD-ROM medium if it succeeds.
2010-08-31cdrom_id: Fix DVD blank detection for sloppy firmwareJan Drzewiecki
Reportedly, many CD drive firmwares will only consider the MSB in a READ command, thus if we request 17 blocks to be read, we'll actually only get 16 in many cases, and thus miss out the interesting sector #17. This would lead to falsely considering nonempty DVDs as blank. Fetch 32 blocks now, which should work everywhere. Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
2010-08-30cdrom_id: Fix DVD-RW media detectionMartin Pitt
Commit cf2205a19 applied the "restricted overwrite" vs. "sequential" DVD-RW test to feature_profiles() (which reads the drive capabilities), which caused every DVD medium to be detected as ID_CDROM_MEDIA_DVD_RW. Now apply it to cd_profiles() instead, to just check the current profile.
2010-08-13cdrom_id: Drop MEDIA_SESSION_NEXT for DVD-RW-ROJan Drzewiecki
Commit cf2205a fixed the media status for fresh DVD-RW in restricted overwrite mode, but missed a detail: We should not report the ID_CDROM_MEDIA_SESSION_NEXT property either, since in that mode you can never append tracks/sessions; this just works in sequential mode. Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
2010-08-12cdrom_id: Add media status debuggingMartin Pitt
Show which media status the hardware originally reports, since we mangle it in some cases.
2010-08-11cdrom_id: do not bail out when we can not read the TOC like for empty CDRWKay Sievers
2010-08-11cdrom_id: READ TOC before READ DISC INFORMATION fixes qemuHarald Hoyer
2010-08-11cdrom_id: whitespace fixKay Sievers
2010-08-10cdrom_id: Fix state for fresh DVD-RWJan Drzewiecki
Fresh DVD-RW in restricted overwite mode reports itself as "appendable"; change it to "blank" to make it consistent with what gets reported after blanking, and what userspace expects. For the exotic case where some uses multi-track recording on a DVD-RW in sequential mode, we need to tell apart sequential and restricted overwrite modes, so keep separate states for them internally. Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
2010-08-08cdrom_id: No "next session" for "other" media stateJan Drzewiecki
"other" is known to apply to DVD-RAMs, where sessions can't be appended. Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
2010-08-08cdrom_id: Also apply format check to DVD-RWJan Drzewiecki
Extend the DVD+RW/DVD-RAM check in commit 1ef6c9e to also cover DVD-RW, since in "restricted overwrite" mode they behave similar to DVD+RW. Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
2010-08-08cdrom_id: Handle pre-MMC2 drivesJan Drzewiecki
Those do not yet support the 0x46 "GET CONFIGURATION" support. If we have those, fall back to the 0x51 "READ DISC INFORMATION" call. This can only differentiate between CD-RW and CD-R, but first that's better than a complete detection failure, and second, those old drives likely don't support more modern media in the first place. https://launchpad.net/bugs/502143 Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
2010-08-08cdrom_id: Fix detection of reblanked DVD+RW and DVD-RAMJan Drzewiecki
Once formatted, DVD+RW and DVD-RAM discs are always reported "complete" by the drive. Check the if the Volume Descriptor or Volume Descriptor Anchor sectors are empty, and if so, set the status to blank. If the disc is unformatted the blank status is maintained and no reads are issued. If the disc is formatted and read command fails, the status remains set to complete to avoid accidental blanking. Bug-Ubuntu: https://launchpad.net/bugs/581925 Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
2010-05-25cdrom_id: do not export ID_CDROM_MEDIA_SESSION_LAST_OFFSET= for single ↵Kay Sievers
session media
2010-05-04cdrom_id: only mark sr[0-9]* as ID_CDROMHarald Hoyer
we cannot be sure for xvd*
2010-04-17cdrom_id: set ID_CDROM_MEDIA=1 only for known mediaKay Sievers
On Sat, Apr 17, 2010 at 18:26, Mike Brudevold <mike@brudevold.com> wrote: > My CD-RW drive experiences a problem in that it automatically closes > after opening if there is media in the drive. This only happens if > there was media in the drive when it was last closed (an empty drive > stays open). ... > cd_profiles: current profile 0x02 > cd_profiles: profile 0x02 <ignored> ... Do not pretend to have a media, when we receive a profile like 0x02, which just means "Removable disk". Thanks to Mike Brudevold for the initial patch.
2010-04-16cdrom_id: add missing profiles to feature_profilesMike Brudevold
Signed-off-by: Mike Brudevold <mike@brudevold.com>
2010-04-15cdrom_id: Swap media state and TOC info probingMartin Pitt
Blank CDs do not have a TOC, thus will fail cd_media_toc() (at least with the "Do not ignore errors from scsi_cmd_run()" fix). Thus probe the media state first, so that we can properly detect blank media.
2010-04-15cdrom_id: Do not ignore errors from scsi_cmd_run()Martin Pitt
scsi_cmd_run() can return positive error messages if we have CHECK_CONDITION set and get the error code from the SCSI command result. So check the result for non-zero, not for being negative. This should fix another cause for "phantom" media in empty CD-ROM drives. Thanks to Mike Brudevold <mike@brudevold.com> for spotting this! https://launchpad.net/bugs/562978
2010-04-15cdrom_id: debug - print feature values in hexKay Sievers
2010-04-15cdrom_id: debug - print feature values in hexKay Sievers
2010-04-15cdrom_id: print more debug messagesKay Sievers
2010-04-15cdrom_id: rework feature/profiles buffer parsingKay Sievers
2010-04-14update NEWSKay Sievers
2010-04-13cdrom_id: Fix uninitialized buffersMartin Pitt
Commit 5c6954f is actually a no-op, since static variables are already zero'ed by default anyway (but we keep it for clarity). The real difference was that a build with -O0 wor while a build with -O2 didn't. Turns out that some ioctls do not actually touch the result buffer in some cases, so we need to zero the result buffers to avoid interpreting random da as CD properties. https://launchpad.net/bugs/559723 https://launchpad.net/bugs/561585
2010-04-13cdrom_id: Fix uninitialized variablesMartin Pitt
In cases where cdrom_id does not go through the entire code path and one of the probing functions returns -1 or exits early, the remaining variables were never initialized. This caused effects like "phantom" audio CDs on empty drives, or bogus data like ID_CDROM_MEDIA_TRACK_COUNT=22528. Initialize the variables right away to avoid that. Bug-Ubuntu: https://launchpad.net/bugs/559723
2010-04-12replace "add|change" with "!remove"Kay Sievers
2010-04-12cdrom_id: always set ID_CDROM regardless if we can run cdrom_idKay Sievers
2010-04-07cdrom_id: check mount state in retry loopKay Sievers
Based on a patch from Harald Hoyer.
2010-04-07cdrom_id: retry to open the device, if EBUSYKay Sievers
We might fight about the device with polling processes, or other users who probe the device. Retry a few times if the other one goes away in the meantime. Based on a patch from Harald Hoyer.
2010-04-07cdrom_id: remove debugging codeHarald Hoyer
2010-03-18cdrom_id: open non-mounted optical media with O_EXCLKay Sievers
This should prevent confusing drives during CD burning sessions. Based on a patch from Harald Hoyer.
2009-12-15cdrom_id: remove deprecated device matchesKay Sievers
2009-11-10cdrom_id: Still check profiles even if there is no mediaDavid Zeuthen
Even when there is no medium in the drive, we should still check the profiles supported by the drive. Otherwise we fail to detect things like Blu-ray drives. See https://bugzilla.gnome.org/show_bug.cgi?id=600273 for more information. Signed-off-by: David Zeuthen <davidz@redhat.com>
2009-08-08fix spellingAlan Jenkins
Fix spelling in docbook comments, code comments, and a local variable name. Thanks to "ispell -h" for docbook HTML and "scspell" for source code. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-08-07Merge libudev, udev, and the unconditional extras in a single Makefile.am.Diego Elio 'Flameeyes' Pettenò
Instead of using multiple recursive Makefile.am files, use a single Makefile.am that sets and builds all the basic suite of libraries and binaries for udev. This reduces the number of files in the source tree, and also reduces drastically the build time when using parallel-make. With this setup, all the compile steps will be executed in parallel, and just the linking stage will be (partially) serialised on the libraries creation.
2009-07-25make: build internal tools against libudev-private.laKay Sievers
2009-06-17extras: delete man pages for private udev toolsKay Sievers
These are mostly dummy man pages, without real content, some even outdated. None of these tools are part of any offered public interface, and they should not pretend to be by offering a man page.
2009-06-17cleanup ./configure installation directory optionsKay Sievers
2009-06-09move syslog wrapper to libudevKay Sievers
2009-06-08libudev: move to top-level directoryKay Sievers
2009-05-29cdrom_id: add error message if open() failsKay Sievers
2009-05-26cdrom_id: suppress ID_CDROM_MEDIA_STATE=blank for plain non-writable CDROM mediaKay Sievers
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