[systemd-bugs] [Bug 52474] cdrom_id probing and USB Flash Drive CDROMs
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Thu Jul 26 18:10:24 PDT 2012
https://bugs.freedesktop.org/show_bug.cgi?id=52474
--- Comment #20 from David Zeuthen <zeuthen at gmail.com> 2012-07-26 18:10:24 PDT ---
(In reply to comment #19)
> + if (len == 0)
> + {
> + log_debug("GET CONFIGURATION: returned ZERO length feature buffer:
> trying to work around the problem\n");
> + ret = cd_profiles_old_mmc(udev, fd);
> + goto out;
> + }
> what do you think, is that patch OK?
I would suggest
- opening brace should be on same line as if (always a good idea to follow
existing code formatting conventions)
- "trying to work around the problem" is a bit vague - suggest to be more
specific
See [1] for the output from my Sandisk Cruzer which suggest that the hardware
is still lying.
I think the best thing (to be as closely compatible with Windows as possible)
is to just run blkid(8) on the device without regard to what the device says
the disc looks like (looks to me like this is what Windows is doing). In patch
form it's this simple:
--- 60-persistent-storage.rules.orig 2012-07-26 13:50:45.997199462 -0400
+++ 60-persistent-storage.rules 2012-07-26 13:51:59.408832982 -0400
@@ -65,7 +65,7 @@
KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*",
ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*",
ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", \
IMPORT{builtin}="blkid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}"
# single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET
-KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*",
ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*",
ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", \
+KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*",
ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", \
IMPORT{builtin}="blkid --noraid"
Yes, this makes the sr driver spew error messages or audio or blank CDs but I'd
argue we just need to fix the sr driver for that. Kay, what do you think?
[1] :
$ ./cdrom_id --debug /dev/sr1
probing: '/dev/sr1'
INQUIRY: [SanDisk ][Cruzer ][4.05]
no current profile, assuming no media
GET CONFIGURATION: size of features buffer 0x0000
GET CONFIGURATION: returned ZERO length feature buffer: trying to work around
the problem
profile 0x09 media_cd_r
READ TOC failed with SK=5h/ASC=26h/ACQ=02h
disk type 00
hardware reported media status: blank
ID_CDROM=1
ID_CDROM_CD_R=1
ID_CDROM_MRW=1
ID_CDROM_MRW_W=1
ID_CDROM_MEDIA=1
ID_CDROM_MEDIA_CD_R=1
ID_CDROM_MEDIA_STATE=blank
--
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.
You are the assignee for the bug.
More information about the systemd-bugs
mailing list