* Re: What variables are important when a cdrom is in or out?
2010-07-20 21:36 What variables are important when a cdrom is in or out? Stef Bon
@ 2010-07-20 22:03 ` Kay Sievers
2010-07-20 22:25 ` Stef Bon
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Kay Sievers @ 2010-07-20 22:03 UTC (permalink / raw)
To: linux-hotplug
On Tue, Jul 20, 2010 at 23:36, Stef Bon <stefbon@gmail.com> wrote:
> I would like to know what variable is THE variable to point a cdrom is
> in the drive or not.
>
> I've made a udev rule to output all the variables set when a media change.
>
> Now look when a drive is ejected. The output:
>
> ID_BUS=scsi
> ID_CDROM=1
> ID_CDROM_CD=1
> ID_CDROM_CD_R=1
> ID_CDROM_CD_RW=1
> ID_CDROM_DVD=1
> ID_CDROM_DVD_PLUS_R=1
> ID_CDROM_DVD_PLUS_RW=1
> ID_CDROM_DVD_PLUS_R_DL=1
> ID_CDROM_DVD_R=1
> ID_CDROM_DVD_RAM=1
> ID_CDROM_DVD_RW=1
> ID_CDROM_MRW=1
> ID_CDROM_MRW_W=1
> ID_MODEL=DVD_RW_AD-7170S
> ID_MODEL_ENC='DVD\x20RW\x20AD-7170S\x20'
> ID_PATH=pci-0000:00:1f.2-scsi-1:0:0:0
> ID_REVISION=1.00
> ID_SCSI=1
> ID_TYPEÍ
> ID_VENDOR=Optiarc
> ID_VENDOR_ENC='Optiarc\x20'
>
> When it's inserted again:
>
>
> ID_BUS=scsi
> ID_CDROM=1
> ID_CDROM_CD=1
> ID_CDROM_CD_R=1
> ID_CDROM_CD_RW=1
> ID_CDROM_DVD=1
> ID_CDROM_DVD_PLUS_R=1
> ID_CDROM_DVD_PLUS_RW=1
> ID_CDROM_DVD_PLUS_R_DL=1
> ID_CDROM_DVD_R=1
> ID_CDROM_DVD_RAM=1
> ID_CDROM_DVD_RW=1
> ID_CDROM_MEDIA=1
> ID_CDROM_MEDIA_CD_R=1
> ID_CDROM_MEDIA_SESSION_COUNT=1
> ID_CDROM_MEDIA_STATE=complete
> ID_CDROM_MEDIA_TRACK_COUNT=1
> ID_CDROM_MEDIA_TRACK_COUNT_DATA=1
> ID_CDROM_MRW=1
> ID_CDROM_MRW_W=1
> ID_FS_LABEL=openSUSE-NET-i586-Build0475..001
> ID_FS_LABEL_ENC=openSUSE-NET-i586-Build0475..001
> ID_FS_TYPE=iso9660
> ID_FS_USAGE=filesystem
> ID_MODEL=DVD_RW_AD-7170S
> ID_MODEL_ENC='DVD\x20RW\x20AD-7170S\x20'
> ID_PATH=pci-0000:00:1f.2-scsi-1:0:0:0
> ID_REVISION=1.00
> ID_SCSI=1
> ID_TYPEÍ
> ID_VENDOR=Optiarc
> ID_VENDOR_ENC='Optiarc\x20'
>
>
> I see the variables ID_FS_*** are set. I can make my scripts look at
> these to determine the cdrom is in or out.
> Is this ok? Or do I have to check the  parameter ID_CDROM_MEDIA=1? Or
> something else?
It's ID_CDROM_MEDIA=1 for any media.
If you want to access the raw disk, you want
ID_CDROM_MEDIA_TRACK_COUNT_DATA=?*, because real CD Audio CDs must not
be accessed like a filesystem, or probed for one.
ID_FS_* might not be set, if there is an unknown data format on it.
Kay
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: What variables are important when a cdrom is in or out?
2010-07-20 21:36 What variables are important when a cdrom is in or out? Stef Bon
2010-07-20 22:03 ` Kay Sievers
@ 2010-07-20 22:25 ` Stef Bon
2010-07-21 6:38 ` Kay Sievers
2010-07-21 21:02 ` Matthew Dharm
3 siblings, 0 replies; 5+ messages in thread
From: Stef Bon @ 2010-07-20 22:25 UTC (permalink / raw)
To: linux-hotplug
2010/7/21 Kay Sievers <kay.sievers@vrfy.org>:
> On Tue, Jul 20, 2010 at 23:36, Stef Bon <stefbon@gmail.com> wrote:
>>
>> I see the variables ID_FS_*** are set. I can make my scripts look at
>> these to determine the cdrom is in or out.
>> Is this ok? Or do I have to check the  parameter ID_CDROM_MEDIA=1? Or
>> something else?
>
> It's ID_CDROM_MEDIA=1 for any media.
>
> If you want to access the raw disk, you want
> ID_CDROM_MEDIA_TRACK_COUNT_DATA=?*, because real CD Audio CDs must not
> be accessed like a filesystem, or probed for one.
>
> ID_FS_* might not be set, if there is an unknown data format on it.
So, it's the parameter ID_CDROM_MEDIA. That's simple. Thanks a lot!
Futher, if there is an filesystem which is reckognized, the ID_FS_*
parameters are set.
I've inserted a audio cd, and indeed I get the
ID_CDROM_MEDIA_TRACK_COUNT equal to 18,
and ID_CDROM_MEDIA_TRACK_COUNT_AUDIO also 18. Does this mean that
there is also an
ID_CDROM_MEDIA_TRACK_COUNT_VIDEO??
And what's the meaning of the ID_CDROM_MEDIA_SESSION_COUNT? Multisession cd's?
Stef
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: What variables are important when a cdrom is in or out?
2010-07-20 21:36 What variables are important when a cdrom is in or out? Stef Bon
2010-07-20 22:03 ` Kay Sievers
2010-07-20 22:25 ` Stef Bon
@ 2010-07-21 6:38 ` Kay Sievers
2010-07-21 21:02 ` Matthew Dharm
3 siblings, 0 replies; 5+ messages in thread
From: Kay Sievers @ 2010-07-21 6:38 UTC (permalink / raw)
To: linux-hotplug
On Wed, Jul 21, 2010 at 00:25, Stef Bon <stefbon@gmail.com> wrote:
> ID_CDROM_MEDIA_TRACK_COUNT equal to 18,
> and ID_CDROM_MEDIA_TRACK_COUNT_AUDIO also 18. Does this mean that
> there is also an
> ID_CDROM_MEDIA_TRACK_COUNT_VIDEO??
Seems, you have 18 tracks, and 18 of them are audio. There seems nothing else.
And video is usually DVD and this would be on a mountable UDF
filesystem. There is no real native video track like audio.
> And what's the meaning of the ID_CDROM_MEDIA_SESSION_COUNT? Multisession cd's?
Yes.
Kay
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: What variables are important when a cdrom is in or out?
2010-07-20 21:36 What variables are important when a cdrom is in or out? Stef Bon
` (2 preceding siblings ...)
2010-07-21 6:38 ` Kay Sievers
@ 2010-07-21 21:02 ` Matthew Dharm
3 siblings, 0 replies; 5+ messages in thread
From: Matthew Dharm @ 2010-07-21 21:02 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 1002 bytes --]
On Wed, Jul 21, 2010 at 08:38:53AM +0200, Kay Sievers wrote:
> On Wed, Jul 21, 2010 at 00:25, Stef Bon <stefbon@gmail.com> wrote:
> > ID_CDROM_MEDIA_TRACK_COUNT equal to 18,
> > and ID_CDROM_MEDIA_TRACK_COUNT_AUDIO also 18. Does this mean that
> > there is also an
> > ID_CDROM_MEDIA_TRACK_COUNT_VIDEO??
>
> Seems, you have 18 tracks, and 18 of them are audio. There seems nothing else.
>
> And video is usually DVD and this would be on a mountable UDF
> filesystem. There is no real native video track like audio.
It is possible, however, to mix audio tracks and data tracks on the same
disc. It's really rare, but it can be done. I would guess that is why you
get a "whole disk" track count and an "audio" track count.
Matt
--
Matthew Dharm Home: mdharm-usb@one-eyed-alien.net
Maintainer, Linux USB Mass Storage Driver
C: They kicked your ass, didn't they?
S: They were cheating!
-- The Chief and Stef
User Friendly, 11/19/1997
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread