[udev] - add ACLs for harmony remote controls Resolves: rhbz#559412 - fixed CDROM profile handling
Harald Hoyer
harald at fedoraproject.org
Wed Mar 23 12:36:32 UTC 2011
commit 545bd16ca5fdbd22a9e385941b04ca3ba2c93d87
Author: Harald Hoyer <harald at redhat.com>
Date: Wed Mar 23 13:35:43 2011 +0100
- add ACLs for harmony remote controls
Resolves: rhbz#559412
- fixed CDROM profile handling
...-5e199245f2d2fd03c2586a7f1140300b073a4abe.patch | 25 ++
...-98ab6a377285d5943563cfa397e8b350e43878ec.patch | 345 ++++++++++++++++++++
udev.spec | 12 +-
3 files changed, 381 insertions(+), 1 deletions(-)
---
diff --git a/udev-5e199245f2d2fd03c2586a7f1140300b073a4abe.patch b/udev-5e199245f2d2fd03c2586a7f1140300b073a4abe.patch
new file mode 100644
index 0000000..83d2c11
--- /dev/null
+++ b/udev-5e199245f2d2fd03c2586a7f1140300b073a4abe.patch
@@ -0,0 +1,25 @@
+commit 5e199245f2d2fd03c2586a7f1140300b073a4abe
+Author: Harald Hoyer <harald at redhat.com>
+Date: Thu Mar 17 20:36:20 2011 +0100
+
+ udev-acl/70-acl.rules: tag ID_REMOTE_CONTROL with acl
+
+ Used by "concordance" to access Logitech Harmony programmable remote
+ controls.
+
+ http://www.phildev.net/concordance/
+
+diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules
+index dd5a7ab..037349d 100644
+--- a/extras/udev-acl/70-acl.rules
++++ b/extras/udev-acl/70-acl.rules
+@@ -52,6 +52,9 @@ ENV{ID_SMARTCARD_READER}=="*?", TAG+="udev-acl"
+ # PDA devices
+ ENV{ID_PDA}=="*?", TAG+="udev-acl"
+
++# Programmable remote control
++ENV{ID_REMOTE_CONTROL}=="1", TAG+="udev-acl"
++
+ # joysticks
+ SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", TAG+="udev-acl"
+
diff --git a/udev-98ab6a377285d5943563cfa397e8b350e43878ec.patch b/udev-98ab6a377285d5943563cfa397e8b350e43878ec.patch
new file mode 100644
index 0000000..699add5
--- /dev/null
+++ b/udev-98ab6a377285d5943563cfa397e8b350e43878ec.patch
@@ -0,0 +1,345 @@
+commit 98ab6a377285d5943563cfa397e8b350e43878ec
+Author: David Zeuthen <davidz at redhat.com>
+Date: Tue Mar 15 12:05:00 2011 -0400
+
+ cdrom_id: Don't ignore profiles when there is no media available
+
+ 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 at redhat.com>
+
+diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c
+index 4a58a49..b2f897e 100644
+--- a/extras/cdrom_id/cdrom_id.c
++++ b/extras/cdrom_id/cdrom_id.c
+@@ -261,6 +261,115 @@ static int cd_inquiry(struct udev *udev, int fd) {
+ return 0;
+ }
+
++static void feature_profile_media(struct udev *udev, int cur_profile)
++{
++ switch (cur_profile) {
++ case 0x03:
++ case 0x04:
++ case 0x05:
++ info(udev, "profile 0x%02x \n", cur_profile);
++ cd_media = 1;
++ cd_media_mo = 1;
++ break;
++ case 0x08:
++ info(udev, "profile 0x%02x media_cd_rom\n", cur_profile);
++ cd_media = 1;
++ cd_media_cd_rom = 1;
++ break;
++ case 0x09:
++ info(udev, "profile 0x%02x media_cd_r\n", cur_profile);
++ cd_media = 1;
++ cd_media_cd_r = 1;
++ break;
++ case 0x0a:
++ info(udev, "profile 0x%02x media_cd_rw\n", cur_profile);
++ cd_media = 1;
++ cd_media_cd_rw = 1;
++ break;
++ case 0x10:
++ info(udev, "profile 0x%02x media_dvd_ro\n", cur_profile);
++ cd_media = 1;
++ cd_media_dvd_rom = 1;
++ break;
++ case 0x11:
++ info(udev, "profile 0x%02x media_dvd_r\n", cur_profile);
++ cd_media = 1;
++ cd_media_dvd_r = 1;
++ break;
++ case 0x12:
++ info(udev, "profile 0x%02x media_dvd_ram\n", cur_profile);
++ cd_media = 1;
++ cd_media_dvd_ram = 1;
++ break;
++ case 0x13:
++ info(udev, "profile 0x%02x media_dvd_rw_ro\n", cur_profile);
++ cd_media = 1;
++ cd_media_dvd_rw = 1;
++ cd_media_dvd_rw_ro = 1;
++ break;
++ case 0x14:
++ info(udev, "profile 0x%02x media_dvd_rw_seq\n", cur_profile);
++ cd_media = 1;
++ cd_media_dvd_rw = 1;
++ cd_media_dvd_rw_seq = 1;
++ break;
++ case 0x1B:
++ info(udev, "profile 0x%02x media_dvd_plus_r\n", cur_profile);
++ cd_media = 1;
++ cd_media_dvd_plus_r = 1;
++ break;
++ case 0x1A:
++ info(udev, "profile 0x%02x media_dvd_plus_rw\n", cur_profile);
++ cd_media = 1;
++ cd_media_dvd_plus_rw = 1;
++ break;
++ case 0x2A:
++ info(udev, "profile 0x%02x media_dvd_plus_rw_dl\n", cur_profile);
++ cd_media = 1;
++ cd_media_dvd_plus_rw_dl = 1;
++ break;
++ case 0x2B:
++ info(udev, "profile 0x%02x media_dvd_plus_r_dl\n", cur_profile);
++ cd_media = 1;
++ cd_media_dvd_plus_r_dl = 1;
++ break;
++ case 0x40:
++ info(udev, "profile 0x%02x media_bd\n", cur_profile);
++ cd_media = 1;
++ cd_media_bd = 1;
++ break;
++ case 0x41:
++ case 0x42:
++ info(udev, "profile 0x%02x media_bd_r\n", cur_profile);
++ cd_media = 1;
++ cd_media_bd_r = 1;
++ break;
++ case 0x43:
++ info(udev, "profile 0x%02x media_bd_re\n", cur_profile);
++ cd_media = 1;
++ cd_media_bd_re = 1;
++ break;
++ case 0x50:
++ info(udev, "profile 0x%02x media_hddvd\n", cur_profile);
++ cd_media = 1;
++ cd_media_hddvd = 1;
++ break;
++ case 0x51:
++ info(udev, "profile 0x%02x media_hddvd_r\n", cur_profile);
++ cd_media = 1;
++ cd_media_hddvd_r = 1;
++ break;
++ case 0x52:
++ info(udev, "profile 0x%02x media_hddvd_rw\n", cur_profile);
++ cd_media = 1;
++ cd_media_hddvd_rw = 1;
++ break;
++ default:
++ info(udev, "profile 0x%02x <ignored>\n", cur_profile);
++ break;
++ }
++}
++
+ static int feature_profiles(struct udev *udev, const unsigned char *profiles, size_t size)
+ {
+ unsigned int i;
+@@ -350,6 +459,7 @@ static int feature_profiles(struct udev *udev, const unsigned char *profiles, si
+ return 0;
+ }
+
++/* returns 0 if media was detected */
+ static int cd_profiles_old_mmc(struct udev *udev, int fd)
+ {
+ struct scsi_cmd sc;
+@@ -389,6 +499,7 @@ static int cd_profiles_old_mmc(struct udev *udev, int fd)
+ return 0;
+ }
+
++/* returns 0 if media was detected */
+ static int cd_profiles(struct udev *udev, int fd)
+ {
+ struct scsi_cmd sc;
+@@ -397,6 +508,9 @@ static int cd_profiles(struct udev *udev, int fd)
+ unsigned int len;
+ unsigned int i;
+ int err;
++ int ret;
++
++ ret = -1;
+
+ /* First query the current profile */
+ scsi_cmd_init(udev, &sc, features, sizeof(features));
+@@ -410,126 +524,20 @@ static int cd_profiles(struct udev *udev, int fd)
+ if (SK(err) == 0x5 && ASC(err) == 0x20) {
+ info(udev, "drive is pre-MMC2 and does not support 46h get configuration command\n");
+ info(udev, "trying to work around the problem\n");
+- return cd_profiles_old_mmc(udev, fd);
++ ret = cd_profiles_old_mmc(udev, fd);
+ }
+- return -1;
++ goto out;
+ }
+
+ cur_profile = features[6] << 8 | features[7];
+ if (cur_profile > 0) {
+ info(udev, "current profile 0x%02x\n", cur_profile);
++ feature_profile_media (udev, cur_profile);
++ ret = 0; /* we have media */
+ } else {
+ info(udev, "no current profile, assuming no media\n");
+- return -1;
+ }
+
+- switch (cur_profile) {
+- case 0x03:
+- case 0x04:
+- case 0x05:
+- info(udev, "profile 0x%02x \n", cur_profile);
+- cd_media = 1;
+- cd_media_mo = 1;
+- break;
+- case 0x08:
+- info(udev, "profile 0x%02x media_cd_rom\n", cur_profile);
+- cd_media = 1;
+- cd_media_cd_rom = 1;
+- break;
+- case 0x09:
+- info(udev, "profile 0x%02x media_cd_r\n", cur_profile);
+- cd_media = 1;
+- cd_media_cd_r = 1;
+- break;
+- case 0x0a:
+- info(udev, "profile 0x%02x media_cd_rw\n", cur_profile);
+- cd_media = 1;
+- cd_media_cd_rw = 1;
+- break;
+- case 0x10:
+- info(udev, "profile 0x%02x media_dvd_ro\n", cur_profile);
+- cd_media = 1;
+- cd_media_dvd_rom = 1;
+- break;
+- case 0x11:
+- info(udev, "profile 0x%02x media_dvd_r\n", cur_profile);
+- cd_media = 1;
+- cd_media_dvd_r = 1;
+- break;
+- case 0x12:
+- info(udev, "profile 0x%02x media_dvd_ram\n", cur_profile);
+- cd_media = 1;
+- cd_media_dvd_ram = 1;
+- break;
+- case 0x13:
+- info(udev, "profile 0x%02x media_dvd_rw_ro\n", cur_profile);
+- cd_media = 1;
+- cd_media_dvd_rw = 1;
+- cd_media_dvd_rw_ro = 1;
+- break;
+- case 0x14:
+- info(udev, "profile 0x%02x media_dvd_rw_seq\n", cur_profile);
+- cd_media = 1;
+- cd_media_dvd_rw = 1;
+- cd_media_dvd_rw_seq = 1;
+- break;
+- case 0x1B:
+- info(udev, "profile 0x%02x media_dvd_plus_r\n", cur_profile);
+- cd_media = 1;
+- cd_media_dvd_plus_r = 1;
+- break;
+- case 0x1A:
+- info(udev, "profile 0x%02x media_dvd_plus_rw\n", cur_profile);
+- cd_media = 1;
+- cd_media_dvd_plus_rw = 1;
+- break;
+- case 0x2A:
+- info(udev, "profile 0x%02x media_dvd_plus_rw_dl\n", cur_profile);
+- cd_media = 1;
+- cd_media_dvd_plus_rw_dl = 1;
+- break;
+- case 0x2B:
+- info(udev, "profile 0x%02x media_dvd_plus_r_dl\n", cur_profile);
+- cd_media = 1;
+- cd_media_dvd_plus_r_dl = 1;
+- break;
+- case 0x40:
+- info(udev, "profile 0x%02x media_bd\n", cur_profile);
+- cd_media = 1;
+- cd_media_bd = 1;
+- break;
+- case 0x41:
+- case 0x42:
+- info(udev, "profile 0x%02x media_bd_r\n", cur_profile);
+- cd_media = 1;
+- cd_media_bd_r = 1;
+- break;
+- case 0x43:
+- info(udev, "profile 0x%02x media_bd_re\n", cur_profile);
+- cd_media = 1;
+- cd_media_bd_re = 1;
+- break;
+- case 0x50:
+- info(udev, "profile 0x%02x media_hddvd\n", cur_profile);
+- cd_media = 1;
+- cd_media_hddvd = 1;
+- break;
+- case 0x51:
+- info(udev, "profile 0x%02x media_hddvd_r\n", cur_profile);
+- cd_media = 1;
+- cd_media_hddvd_r = 1;
+- break;
+- case 0x52:
+- info(udev, "profile 0x%02x media_hddvd_rw\n", cur_profile);
+- cd_media = 1;
+- cd_media_hddvd_rw = 1;
+- break;
+- default:
+- info(udev, "profile 0x%02x <ignored>\n", cur_profile);
+- break;
+- }
+-
+-
+ len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3];
+ info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len);
+
+@@ -577,8 +585,8 @@ static int cd_profiles(struct udev *udev, int fd)
+ break;
+ }
+ }
+-
+- return 0;
++out:
++ return ret;
+ }
+
+ static int cd_media_info(struct udev *udev, int fd)
+@@ -905,9 +913,12 @@ int main(int argc, char *argv[])
+ goto print;
+
+ /* read drive and possibly current profile */
+- if (cd_profiles(udev, fd) < 0)
++ if (cd_profiles(udev, fd) != 0)
+ goto print;
+
++ /* at this point we are guaranteed to have media in the
++ * drive - find out more about it */
++
+ /* get session/track info */
+ cd_media_toc(udev, fd);
+
diff --git a/udev.spec b/udev.spec
index be272ad..105de70 100644
--- a/udev.spec
+++ b/udev.spec
@@ -7,7 +7,7 @@
Summary: A rule-based device node and kernel event manager
Name: udev
Version: 166
-Release: 1%{?dist}
+Release: 2%{?dist}
License: GPLv2+
Group: System Environment/Base
Provides: udev-persistent = %{version}-%{release}
@@ -18,6 +18,9 @@ Source1: start_udev
Source2: udev-retry.init
Patch6: udev-164-no-v4l1.patch
+Patch7: udev-5e199245f2d2fd03c2586a7f1140300b073a4abe.patch
+Patch8: udev-98ab6a377285d5943563cfa397e8b350e43878ec.patch
+
ExclusiveOS: Linux
URL: http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html
@@ -116,6 +119,8 @@ glib-based applications using libudev functionality.
%prep
%setup -q
%patch6 -p1
+%patch7 -p1
+%patch8 -p1
%build
export CFLAGS="$CFLAGS $RPM_OPT_FLAGS -fPIE -DPIE -pie -Wl,-z,relro -Wl,-z,now"
@@ -360,6 +365,11 @@ rm -rf $RPM_BUILD_ROOT
%attr(0644,root,root) %{_libdir}/pkgconfig/gudev-1.0*
%changelog
+* Wed Mar 23 2011 Harald Hoyer <harald at redhat.com> 166-2
+- add ACLs for harmony remote controls
+Resolves: rhbz#559412
+- fixed CDROM profile handling
+
* Wed Feb 16 2011 Harald Hoyer <harald at redhat.com> 166-1
- renamed udev-post initscript to udev-retry to match
upstream systemd service name
More information about the scm-commits
mailing list