From: Kay Sievers Date: Tue, 21 Apr 2009 01:27:14 +0000 (+0200) Subject: cdrom_id: add and use ID_CDROM_MEDIA to decide if we run vol_id X-Git-Tag: 174~1087 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f907449eee3f58fafafee0658e80578b1dbb2722;p=systemd cdrom_id: add and use ID_CDROM_MEDIA to decide if we run vol_id Some broken mobile phones offer a faked cdrom drive with a media without any tracks. --- diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index c578f129..371d6a2d 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -76,6 +76,7 @@ static unsigned int cd_mrw; static unsigned int cd_mrw_w; /* media info */ +static unsigned int cd_media; static unsigned int cd_media_cd_rom; static unsigned int cd_media_cd_r; static unsigned int cd_media_cd_rw; @@ -325,6 +326,8 @@ static int cd_profiles(struct udev *udev, int fd) return -1; } + cd_media = 1; + switch (cur_profile) { case 0x03: case 0x04: @@ -625,6 +628,8 @@ print: if (cd_mrw_w) printf("ID_CDROM_MRW_W=1\n"); + if (cd_media) + printf("ID_CDROM_MEDIA=1\n"); if (cd_media_mo) printf("ID_CDROM_MEDIA_MO=1\n"); if (cd_media_mrw) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 23c21f8c..40954889 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -55,7 +55,7 @@ ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PA ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end" # probe filesystem metadata of optical drives which have a media inserted -KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT}=="?*", IMPORT{program}="vol_id --export --skip-raid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" +KERNEL=="sr*", ENV{ID_CDROM_MEDIA}=="?*", IMPORT{program}="vol_id --export --skip-raid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" # probe filesystem metadata of disks KERNEL!="sr*", IMPORT{program}="vol_id --export $tempnode"