From 66d65ff607a23c777db71c54e7992f23c38b1796 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Wed, 17 Feb 2010 03:22:54 +0000 Subject: [PATCH 01/24] Initialize branch F-13 for udev --- branch | 1 + 1 file changed, 1 insertion(+) create mode 100644 branch diff --git a/branch b/branch new file mode 100644 index 0000000..baa94ef --- /dev/null +++ b/branch @@ -0,0 +1 @@ +F-13 From e8b32676928cedce9e9480cea4379a12002f0a04 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Fri, 19 Mar 2010 12:49:37 +0000 Subject: [PATCH 02/24] - add patch for virtio-ports (#569700) - own libgudev dirs (#561319) - minor udev startup script improvements (#549518) - create /dev/hugepages subdir in start_udev (#541998) - remove GPL COPYING file from LGPL subpackages (#536843) - removed symlinks to udevadm - touch all device nodes after udev settled for the timezone timestamp (#569335) - add some upstream bugfixes --- ...or-reporting-on-missing-firmware-fil.patch | 43 + ...eymap-Add-Dell-Inspiron-1011-Mini-10.patch | 26 + ...ix-brightness-keys-on-MSI-Wind-U-100.patch | 37 + ...ort-for-Gateway-AOA110-AOA150-clones.patch | 29 + 0005-keymap-Fix-LG-X110.patch | 64 + ...e-for-volume-keys-on-Dell-Studio-155.patch | 55 + 0007-keymap-Add-Toshiba-Satellite-M30X.patch | 55 + ...amsung-Q210-P210-force-release-quirk.patch | 30 + ...tsu-Amilo-1848-u-force-release-quirk.patch | 53 + ...er-size-when-advancing-past-NUL-byte.patch | 29 + ...ZE-not-UTIL_PATH_SIZE-to-truncate-pr.patch | 26 + ...se-UTIL_LINE_SIZE-from-2048-to-16384.patch | 37 + ...rts-rule-to-use-attr-instead-of-ATTR.patch | 29 + ...cl-Correctly-handle-ENV-ACL_MANAGE-0.patch | 47 + 0021-input_id-Fix-linking.patch | 27 + 0022-replace-utimes-with-utimensat.patch | 34 + ...sible-segfault-when-firmware-device-.patch | 40 + ...create-by-path-links-for-pci-devices.patch | 25 + ...gitech-bluetooth-adapters-into-hci-m.patch | 29 + ...inux-context-when-the-node-was-not-t.patch | 88 + ...dd-LGPL-COPYING-to-libudev-and-GUdev.patch | 1035 ++++++++ ...on-mounted-optical-media-with-O_EXCL.patch | 58 + ...-into-tool-that-only-switches-Mobile.patch | 2142 +++++++++++++++++ start_udev | 30 +- udev-151-virtio.patch | 30 + udev-post.init | 4 +- udev.spec | 180 +- 27 files changed, 4206 insertions(+), 76 deletions(-) create mode 100644 0001-firmware-fix-error-reporting-on-missing-firmware-fil.patch create mode 100644 0002-keymap-Add-Dell-Inspiron-1011-Mini-10.patch create mode 100644 0003-Fix-brightness-keys-on-MSI-Wind-U-100.patch create mode 100644 0004-keymap-Add-support-for-Gateway-AOA110-AOA150-clones.patch create mode 100644 0005-keymap-Fix-LG-X110.patch create mode 100644 0006-Force-key-release-for-volume-keys-on-Dell-Studio-155.patch create mode 100644 0007-keymap-Add-Toshiba-Satellite-M30X.patch create mode 100644 0013-keymap-Add-Samsung-Q210-P210-force-release-quirk.patch create mode 100644 0014-keymap-Add-Fujitsu-Amilo-1848-u-force-release-quirk.patch create mode 100644 0015-Decrease-buffer-size-when-advancing-past-NUL-byte.patch create mode 100644 0016-Use-UTIL_LINE_SIZE-not-UTIL_PATH_SIZE-to-truncate-pr.patch create mode 100644 0017-Increase-UTIL_LINE_SIZE-from-2048-to-16384.patch create mode 100644 0018-Fix-virtio-ports-rule-to-use-attr-instead-of-ATTR.patch create mode 100644 0019-udev-acl-Correctly-handle-ENV-ACL_MANAGE-0.patch create mode 100644 0021-input_id-Fix-linking.patch create mode 100644 0022-replace-utimes-with-utimensat.patch create mode 100644 0029-firmware-fix-possible-segfault-when-firmware-device-.patch create mode 100644 0030-rules-input-create-by-path-links-for-pci-devices.patch create mode 100644 0031-Fix-switching-Logitech-bluetooth-adapters-into-hci-m.patch create mode 100644 0032-do-not-reset-SELinux-context-when-the-node-was-not-t.patch create mode 100644 0034-add-LGPL-COPYING-to-libudev-and-GUdev.patch create mode 100644 0035-cdrom_id-open-non-mounted-optical-media-with-O_EXCL.patch create mode 100644 0036-modeswitch-morph-into-tool-that-only-switches-Mobile.patch create mode 100644 udev-151-virtio.patch diff --git a/0001-firmware-fix-error-reporting-on-missing-firmware-fil.patch b/0001-firmware-fix-error-reporting-on-missing-firmware-fil.patch new file mode 100644 index 0000000..933407f --- /dev/null +++ b/0001-firmware-fix-error-reporting-on-missing-firmware-fil.patch @@ -0,0 +1,43 @@ +From 86a7a2f853fe6022c5b0c1b415918047b65533be Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Thomas=20B=C3=A4chler?= +Date: Sun, 31 Jan 2010 13:49:02 +0100 +Subject: [PATCH 01/36] firmware: fix error reporting on missing firmware files + +The new firmware loader does not report an error to the kernel if a firmware file +is missing. This results in modprobe stalling for 60 seconds for each firmware +a module tries to load. +--- + extras/firmware/firmware.c | 3 ++- + 1 files changed, 2 insertions(+), 1 deletions(-) + +diff --git a/extras/firmware/firmware.c b/extras/firmware/firmware.c +index 8f70be4..16455de 100644 +--- a/extras/firmware/firmware.c ++++ b/extras/firmware/firmware.c +@@ -149,6 +149,7 @@ int main(int argc, char **argv) + + util_path_encode(firmware, fwencpath, sizeof(fwencpath)); + util_strscpyl(misspath, sizeof(misspath), udev_get_dev_path(udev), "/.udev/firmware-missing/", fwencpath, NULL); ++ util_strscpyl(loadpath, sizeof(loadpath), udev_get_sys_path(udev), devpath, "/loading", NULL); + + if (fwfile == NULL) { + int err; +@@ -166,6 +167,7 @@ int main(int argc, char **argv) + udev_selinux_resetfscreatecon(udev); + } while (err == -ENOENT); + rc = 2; ++ set_loading(udev, loadpath, "-1"); + goto exit; + } + +@@ -176,7 +178,6 @@ int main(int argc, char **argv) + if (unlink(misspath) == 0) + util_delete_path(udev, misspath); + +- util_strscpyl(loadpath, sizeof(loadpath), udev_get_sys_path(udev), devpath, "/loading", NULL); + set_loading(udev, loadpath, "1"); + + util_strscpyl(datapath, sizeof(datapath), udev_get_sys_path(udev), devpath, "/data", NULL); +-- +1.6.6 + diff --git a/0002-keymap-Add-Dell-Inspiron-1011-Mini-10.patch b/0002-keymap-Add-Dell-Inspiron-1011-Mini-10.patch new file mode 100644 index 0000000..47cc9fa --- /dev/null +++ b/0002-keymap-Add-Dell-Inspiron-1011-Mini-10.patch @@ -0,0 +1,26 @@ +From fc47e0b56779ceeaaa40d2dc3248fa002af63aaa Mon Sep 17 00:00:00 2001 +From: Martin Pitt +Date: Mon, 1 Feb 2010 15:27:46 -0800 +Subject: [PATCH 02/36] keymap: Add Dell Inspiron 1011 (Mini 10) + +This fixes the broken WLAN key. +--- + extras/keymap/95-keymap.rules | 2 ++ + 1 files changed, 2 insertions(+), 0 deletions(-) + +diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules +index 2b1c4bd..51c8c3b 100644 +--- a/extras/keymap/95-keymap.rules ++++ b/extras/keymap/95-keymap.rules +@@ -53,6 +53,8 @@ GOTO="keyboard_end" + LABEL="keyboard_vendorcheck" + + ENV{DMI_VENDOR}=="Dell*", RUN+="keymap $name dell" ++ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Inspiron 1011", RUN+="keymap $name 0x84 wlan" ++ + ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N*", RUN+="keymap $name compaq-e_evo" + + ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*3000*", RUN+="keymap $name lenovo-3000" +-- +1.6.6 + diff --git a/0003-Fix-brightness-keys-on-MSI-Wind-U-100.patch b/0003-Fix-brightness-keys-on-MSI-Wind-U-100.patch new file mode 100644 index 0000000..c00f51e --- /dev/null +++ b/0003-Fix-brightness-keys-on-MSI-Wind-U-100.patch @@ -0,0 +1,37 @@ +From d7e2d38c1f0ead2239808dd117577a99a3ad3cde Mon Sep 17 00:00:00 2001 +From: Martin Pitt +Date: Tue, 9 Feb 2010 15:47:47 +0100 +Subject: [PATCH 03/36] Fix brightness keys on MSI Wind U-100 + +The MSI Wind 100 generates ACPI/input events on the LNXVIDEO input device. On +top of that, the video module/BIOS synthesize some extra event on atkbd as an +echo of actually changing the brightness. + +Ignore the wrong and useless atkbd ones, to avoid event loops. + +Many thanks to Hans de Goede for tracking this down! + +https://launchpad.net/bugs/415023 +--- + extras/keymap/95-keymap.rules | 5 +++++ + 1 files changed, 5 insertions(+), 0 deletions(-) + +diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules +index 51c8c3b..684619b 100644 +--- a/extras/keymap/95-keymap.rules ++++ b/extras/keymap/95-keymap.rules +@@ -98,6 +98,11 @@ ENV{DMI_VENDOR}=="MEDIONNB", ATTR{[dmi/id]product_name}=="A555*", RUN+="keymap $ + + ENV{DMI_VENDOR}=="MICRO-STAR*", RUN+="keymap $name micro-star" + ++# some MSI models generate ACPI/input events on the LNXVIDEO input devices, ++# plus some extra synthesized ones on atkbd as an echo of actually changing the ++# brightness; so ignore those atkbd ones, to avoid loops ++ENV{DMI_VENDOR}=="MICRO-STAR*", ATTR{[dmi/id]product_name}=="*U-100*|*U100*|*N033", RUN+="keymap $name 0xF7 reserved 0xF8 reserved" ++ + ENV{DMI_VENDOR}=="INVENTEC", ATTR{[dmi/id]product_name}=="SYMPHONY 6.0/7.0", RUN+="keymap $name inventec-symphony_6.0_7.0" + + ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keymap $name maxdata-pro_7000" +-- +1.6.6 + diff --git a/0004-keymap-Add-support-for-Gateway-AOA110-AOA150-clones.patch b/0004-keymap-Add-support-for-Gateway-AOA110-AOA150-clones.patch new file mode 100644 index 0000000..a7167c4 --- /dev/null +++ b/0004-keymap-Add-support-for-Gateway-AOA110-AOA150-clones.patch @@ -0,0 +1,29 @@ +From 063985ef7dd6050f33920700777831426b221697 Mon Sep 17 00:00:00 2001 +From: Robert Hooker +Date: Sun, 7 Feb 2010 13:56:27 -0500 +Subject: [PATCH 04/36] keymap: Add support for Gateway AOA110/AOA150 clones. + +https://launchpad.net/bugs/518496 + +Signed-off-by: Martin Pitt +--- + extras/keymap/95-keymap.rules | 3 +++ + 1 files changed, 3 insertions(+), 0 deletions(-) + +diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules +index 684619b..d3690bb 100644 +--- a/extras/keymap/95-keymap.rules ++++ b/extras/keymap/95-keymap.rules +@@ -71,6 +71,9 @@ ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="Presario 2100*" + # HP Pavillion dv6315ea has empty DMI_VENDOR + ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dmi/id]board_version}=="65.2B", RUN+="keymap $name 0x88 media" # "quick play + ++# Gateway clone of Acer Aspire One AOA110/AOA150 ++ENV{DMI_VENDOR}=="Gateway*", ATTR{[dmi/id]product_name}=="*AOA1*", RUN+="keymap $name acer" ++ + ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" + ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" + ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C300*", RUN+="keymap $name acer-travelmate_c300" +-- +1.6.6 + diff --git a/0005-keymap-Fix-LG-X110.patch b/0005-keymap-Fix-LG-X110.patch new file mode 100644 index 0000000..380ecf0 --- /dev/null +++ b/0005-keymap-Fix-LG-X110.patch @@ -0,0 +1,64 @@ +From 4c514e31734a704ca58e543fa4330616ba584b39 Mon Sep 17 00:00:00 2001 +From: Martin Pitt +Date: Fri, 12 Feb 2010 19:25:47 +0100 +Subject: [PATCH 05/36] keymap: Fix LG X110 + +The LG X110 is not a perfect clone of the MSI Wind after all, and needs its own +keymap. Thanks to Konstantin Lavrov! + +https://launchpad.net/bugs/520650 +--- + Makefile.am | 1 + + extras/keymap/95-keymap.rules | 3 +-- + extras/keymap/keymaps/lg-x110 | 12 ++++++++++++ + 3 files changed, 14 insertions(+), 2 deletions(-) + create mode 100644 extras/keymap/keymaps/lg-x110 + +diff --git a/Makefile.am b/Makefile.am +index 728076a..069bf7f 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -518,6 +518,7 @@ dist_udevkeymap_DATA = \ + extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint \ + extras/keymap/keymaps/lenovo-thinkpad_x6_tablet \ + extras/keymap/keymaps/lenovo-thinkpad_x200_tablet \ ++ extras/keymap/keymaps/lg-x110 \ + extras/keymap/keymaps/logitech-wave \ + extras/keymap/keymaps/logitech-wave-cordless \ + extras/keymap/keymaps/maxdata-pro_7000 \ +diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules +index d3690bb..fcd42aa 100644 +--- a/extras/keymap/95-keymap.rules ++++ b/extras/keymap/95-keymap.rules +@@ -93,8 +93,7 @@ ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*Amilo Si 1520*", RUN+ + ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="AMILO*M*", RUN+="keymap $name 0x97 prog2 0x9F prog1" + ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="Amilo Li 1718", RUN+="keymap $name 0xD6 wlan" + +-# MSI Wind clone +-ENV{DMI_VENDOR}=="LG*", ATTR{[dmi/id]product_name}=="*X110*", RUN+="keymap $name micro-star" ++ENV{DMI_VENDOR}=="LG*", ATTR{[dmi/id]product_name}=="*X110*", RUN+="keymap $name lg-x110" + + ENV{DMI_VENDOR}=="MEDION*", ATTR{[dmi/id]product_name}=="*FID2060*", RUN+="keymap $name medion-fid2060" + ENV{DMI_VENDOR}=="MEDIONNB", ATTR{[dmi/id]product_name}=="A555*", RUN+="keymap $name medionnb-a555" +diff --git a/extras/keymap/keymaps/lg-x110 b/extras/keymap/keymaps/lg-x110 +new file mode 100644 +index 0000000..a61cf3d +--- /dev/null ++++ b/extras/keymap/keymaps/lg-x110 +@@ -0,0 +1,12 @@ ++0xA0 mute # Fn-F9 ++0xAE volumedown # Fn-Left ++0xAF search # Fn-F3 ++0xB0 volumeup # Fn-Right ++0xB1 battery # Fn-F10 Info ++0xB3 suspend # Fn-F12 ++0xDF sleep # Fn-F4 ++# 0xE2 bluetooth # satellite dish2 ++0xE4 f22 # Fn-F5 Touchpad disable ++0xF6 wlan # Fn-F6 ++0xF7 reserved # brightnessdown # Fn-Down ++0xF8 reserved # brightnessup # Fn-Up +\ No newline at end of file +-- +1.6.6 + diff --git a/0006-Force-key-release-for-volume-keys-on-Dell-Studio-155.patch b/0006-Force-key-release-for-volume-keys-on-Dell-Studio-155.patch new file mode 100644 index 0000000..2f147fc --- /dev/null +++ b/0006-Force-key-release-for-volume-keys-on-Dell-Studio-155.patch @@ -0,0 +1,55 @@ +From b15bb8019094797aee65f35e3e654354b61bfd7b Mon Sep 17 00:00:00 2001 +From: Jerone Young +Date: Fri, 12 Feb 2010 18:08:08 -0600 +Subject: [PATCH 06/36] Force key release for volume keys on Dell Studio 1557 + +Dell Studio 1557 does not generate a release code when the volume keys +are pressed, causing them to generate infinite key presses. This forces +key release of these keys. + +Signed-off-by: Jerone Young +Signed-off-by: Martin Pitt +--- + Makefile.am | 3 ++- + extras/keymap/95-keyboard-force-release.rules | 2 ++ + extras/keymap/force-release-maps/dell-studio-1557 | 3 +++ + 3 files changed, 7 insertions(+), 1 deletions(-) + create mode 100755 extras/keymap/force-release-maps/dell-studio-1557 + +diff --git a/Makefile.am b/Makefile.am +index 069bf7f..1b4e2ea 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -541,7 +541,8 @@ dist_udevkeymap_DATA = \ + + udevkeymapforcereldir = $(libexecdir)/keymaps/force-release + dist_udevkeymapforcerel_DATA = \ +- extras/keymap/force-release-maps/samsung-other ++ extras/keymap/force-release-maps/samsung-other \ ++ extras/keymap/force-release-maps/dell-studio-1557 + + extras/keymap/keys.txt: $(INCLUDE_PREFIX)/linux/input.h + mkdir -p extras/keymap +diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules +index 689afe9..659ee95 100644 +--- a/extras/keymap/95-keyboard-force-release.rules ++++ b/extras/keymap/95-keyboard-force-release.rules +@@ -21,4 +21,6 @@ ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" + + ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N130*|*N140*|*SR70S/SR71S*", RUN+="keyboard-force-release.sh $devpath samsung-other" + ++ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557", RUN+="keyboard-force-release.sh $devpath dell-studio-1557" ++ + LABEL="force_release_end" +diff --git a/extras/keymap/force-release-maps/dell-studio-1557 b/extras/keymap/force-release-maps/dell-studio-1557 +new file mode 100755 +index 0000000..1718673 +--- /dev/null ++++ b/extras/keymap/force-release-maps/dell-studio-1557 +@@ -0,0 +1,3 @@ ++0xa0 #mute ++0xae #volume up ++0xb0 #volume down +-- +1.6.6 + diff --git a/0007-keymap-Add-Toshiba-Satellite-M30X.patch b/0007-keymap-Add-Toshiba-Satellite-M30X.patch new file mode 100644 index 0000000..4d17c00 --- /dev/null +++ b/0007-keymap-Add-Toshiba-Satellite-M30X.patch @@ -0,0 +1,55 @@ +From 4ca91a04e8b727a079a973fdd9bc2b093e8315a5 Mon Sep 17 00:00:00 2001 +From: Martin Pitt +Date: Mon, 15 Feb 2010 13:15:25 +0100 +Subject: [PATCH 07/36] keymap: Add Toshiba Satellite M30X + +Thanks to Alessio Gaeta! + +https://launchpad.net/bugs/510019 +--- + Makefile.am | 1 + + extras/keymap/95-keymap.rules | 1 + + extras/keymap/keymaps/toshiba-satellite_m30x | 7 +++++++ + 3 files changed, 9 insertions(+), 0 deletions(-) + create mode 100644 extras/keymap/keymaps/toshiba-satellite_m30x + +diff --git a/Makefile.am b/Makefile.am +index 1b4e2ea..db23f16 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -537,6 +537,7 @@ dist_udevkeymap_DATA = \ + extras/keymap/keymaps/samsung-sx20s \ + extras/keymap/keymaps/toshiba-satellite_a100 \ + extras/keymap/keymaps/toshiba-satellite_a110 \ ++ extras/keymap/keymaps/toshiba-satellite_m30x \ + extras/keymap/keymaps/zepto-znote + + udevkeymapforcereldir = $(libexecdir)/keymaps/force-release +diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules +index fcd42aa..65b0d6e 100644 +--- a/extras/keymap/95-keymap.rules ++++ b/extras/keymap/95-keymap.rules +@@ -115,6 +115,7 @@ ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="S + + ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="SATELLITE A100", RUN+="keymap $name toshiba-satellite_a100" + ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite A110", RUN+="keymap $name toshiba-satellite_a110" ++ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite M30X", RUN+="keymap $name toshiba-satellite_m30x" + + ENV{DMI_VENDOR}=="OQO Inc.*", ATTR{[dmi/id]product_name}=="OQO Model 2*", RUN+="keymap $name oqo-model2" + +diff --git a/extras/keymap/keymaps/toshiba-satellite_m30x b/extras/keymap/keymaps/toshiba-satellite_m30x +new file mode 100644 +index 0000000..cf6d912 +--- /dev/null ++++ b/extras/keymap/keymaps/toshiba-satellite_m30x +@@ -0,0 +1,7 @@ ++0xef brightnessdown ++0xd9 brightnessup ++0xee screenlock ++0x93 media ++0x9e prog1 #touchpad_enable ++0x9f prog2 #touchpad_disable ++ +-- +1.6.6 + diff --git a/0013-keymap-Add-Samsung-Q210-P210-force-release-quirk.patch b/0013-keymap-Add-Samsung-Q210-P210-force-release-quirk.patch new file mode 100644 index 0000000..328a2b4 --- /dev/null +++ b/0013-keymap-Add-Samsung-Q210-P210-force-release-quirk.patch @@ -0,0 +1,30 @@ +From 20b48c3727eef1f266cbfd6bf5854b5c1419beb9 Mon Sep 17 00:00:00 2001 +From: Andy Whitcroft +Date: Tue, 2 Mar 2010 13:55:03 +0100 +Subject: [PATCH 13/36] keymap: Add Samsung Q210/P210 force-release quirk + +The Samsung Q210/P210 laptop also needs all of its function keys quirked. + +https://launchpad.net/bugs/530093 + +Signed-off-by: Martin Pitt +--- + extras/keymap/95-keyboard-force-release.rules | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules +index 659ee95..48b896d 100644 +--- a/extras/keymap/95-keyboard-force-release.rules ++++ b/extras/keymap/95-keyboard-force-release.rules +@@ -19,7 +19,7 @@ DRIVER!="atkbd", GOTO="force_release_end" + ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" + + +-ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N130*|*N140*|*SR70S/SR71S*", RUN+="keyboard-force-release.sh $devpath samsung-other" ++ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N130*|*N140*|*SR70S/SR71S*|*Q210/P210*", RUN+="keyboard-force-release.sh $devpath samsung-other" + + ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557", RUN+="keyboard-force-release.sh $devpath dell-studio-1557" + +-- +1.6.6 + diff --git a/0014-keymap-Add-Fujitsu-Amilo-1848-u-force-release-quirk.patch b/0014-keymap-Add-Fujitsu-Amilo-1848-u-force-release-quirk.patch new file mode 100644 index 0000000..9bedd1e --- /dev/null +++ b/0014-keymap-Add-Fujitsu-Amilo-1848-u-force-release-quirk.patch @@ -0,0 +1,53 @@ +From da96a11b9c9164447bef206db47c405342ab8daa Mon Sep 17 00:00:00 2001 +From: Andy Whitcroft +Date: Tue, 2 Mar 2010 14:00:32 +0100 +Subject: [PATCH 14/36] keymap: Add Fujitsu Amilo 1848+u force-release quirk + +The Fujitsu Amilo Si 1848+u laptop requires the volume and mute keys +quirking. + +https://launchpad.net/bugs/530089 + +Signed-off-by: Martin Pitt +--- + Makefile.am | 1 + + extras/keymap/95-keyboard-force-release.rules | 2 ++ + .../keymap/force-release-maps/fujitsu-amilo-si1848 | 3 +++ + 3 files changed, 6 insertions(+), 0 deletions(-) + create mode 100644 extras/keymap/force-release-maps/fujitsu-amilo-si1848 + +diff --git a/Makefile.am b/Makefile.am +index 3780f50..471c5dd 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -543,6 +543,7 @@ dist_udevkeymap_DATA = \ + udevkeymapforcereldir = $(libexecdir)/keymaps/force-release + dist_udevkeymapforcerel_DATA = \ + extras/keymap/force-release-maps/samsung-other \ ++ extras/keymap/force-release-maps/fujitsu-amilo-si1848 \ + extras/keymap/force-release-maps/dell-studio-1557 + + extras/keymap/keys.txt: $(INCLUDE_PREFIX)/linux/input.h +diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules +index 48b896d..28639a5 100644 +--- a/extras/keymap/95-keyboard-force-release.rules ++++ b/extras/keymap/95-keyboard-force-release.rules +@@ -23,4 +23,6 @@ ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="* + + ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557", RUN+="keyboard-force-release.sh $devpath dell-studio-1557" + ++ENV{DMI_VENDOR}=="FUJITSU SIEMENS", ATTR{[dmi/id]product_name}=="AMILO Si 1848+u", RUN+="keyboard-force-release.sh $devpath fujitsu-amilo-si1848" ++ + LABEL="force_release_end" +diff --git a/extras/keymap/force-release-maps/fujitsu-amilo-si1848 b/extras/keymap/force-release-maps/fujitsu-amilo-si1848 +new file mode 100644 +index 0000000..1718673 +--- /dev/null ++++ b/extras/keymap/force-release-maps/fujitsu-amilo-si1848 +@@ -0,0 +1,3 @@ ++0xa0 #mute ++0xae #volume up ++0xb0 #volume down +-- +1.6.6 + diff --git a/0015-Decrease-buffer-size-when-advancing-past-NUL-byte.patch b/0015-Decrease-buffer-size-when-advancing-past-NUL-byte.patch new file mode 100644 index 0000000..4ad5dce --- /dev/null +++ b/0015-Decrease-buffer-size-when-advancing-past-NUL-byte.patch @@ -0,0 +1,29 @@ +From ecd42de2c56b4fcf0069b8b4a4d6607710e5de61 Mon Sep 17 00:00:00 2001 +From: David Zeuthen +Date: Tue, 2 Mar 2010 17:06:33 -0500 +Subject: [PATCH 15/36] Decrease buffer size when advancing past NUL byte + +Otherwise we'll overflow the buffer if space is tight. Also add a comment explaining this. + +Signed-off-by: David Zeuthen +--- + libudev/libudev-device.c | 2 ++ + 1 files changed, 2 insertions(+), 0 deletions(-) + +diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c +index 71fc775..4f42aa2 100644 +--- a/libudev/libudev-device.c ++++ b/libudev/libudev-device.c +@@ -1166,7 +1166,9 @@ static int update_envp_monitor_buf(struct udev_device *udev_device) + l = util_strpcpyl(&s, l, key, "=", udev_list_entry_get_value(list_entry), NULL); + if (l == 0) + return -EINVAL; ++ /* advance past the trailing '\0' that util_strpcpyl() guarantees */ + s++; ++ l--; + } + udev_device->envp[i] = NULL; + udev_device->monitor_buf_len = s - udev_device->monitor_buf; +-- +1.6.6 + diff --git a/0016-Use-UTIL_LINE_SIZE-not-UTIL_PATH_SIZE-to-truncate-pr.patch b/0016-Use-UTIL_LINE_SIZE-not-UTIL_PATH_SIZE-to-truncate-pr.patch new file mode 100644 index 0000000..174767d --- /dev/null +++ b/0016-Use-UTIL_LINE_SIZE-not-UTIL_PATH_SIZE-to-truncate-pr.patch @@ -0,0 +1,26 @@ +From 3a19299202b5d34b89d5910fde25e8a4cfa2b31a Mon Sep 17 00:00:00 2001 +From: David Zeuthen +Date: Tue, 2 Mar 2010 17:07:14 -0500 +Subject: [PATCH 16/36] Use UTIL_LINE_SIZE, not UTIL_PATH_SIZE to truncate properties + +Signed-off-by: David Zeuthen +--- + libudev/libudev-device.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c +index 4f42aa2..b841745 100644 +--- a/libudev/libudev-device.c ++++ b/libudev/libudev-device.c +@@ -1089,7 +1089,7 @@ struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device + + struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property) + { +- char name[UTIL_PATH_SIZE]; ++ char name[UTIL_LINE_SIZE]; + char *val; + + util_strscpy(name, sizeof(name), property); +-- +1.6.6 + diff --git a/0017-Increase-UTIL_LINE_SIZE-from-2048-to-16384.patch b/0017-Increase-UTIL_LINE_SIZE-from-2048-to-16384.patch new file mode 100644 index 0000000..802351e --- /dev/null +++ b/0017-Increase-UTIL_LINE_SIZE-from-2048-to-16384.patch @@ -0,0 +1,37 @@ +From e32d5237ea045045c621edba7341631abd602d74 Mon Sep 17 00:00:00 2001 +From: David Zeuthen +Date: Tue, 2 Mar 2010 17:10:02 -0500 +Subject: [PATCH 17/36] Increase UTIL_LINE_SIZE from 2048 to 16384 + +Recent udisks versions, for LVM2 integration, ships with probers that +produce very long lines such as + +UDISKS_LVM2_PV_VG_PV_LIST= + uuid=98lyZl-Ya7U-p26Z-Ia7b-xf8u-xZqP-jc4njb;size=2000397795328;allocated_size=2000397795328 + uuid=iFs0cM-sxCF-ceQK-hZl1-kbwo-ZTjq-gSewQR;size=2000397795328;allocated_size=2000397795328 + [...] + +e.g. roughly 100 bytes per LVM2 physical volume for each LVM2 +PV encountered. + +Signed-off-by: David Zeuthen +--- + libudev/libudev-private.h | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h +index 0d28b80..e0c51dc 100644 +--- a/libudev/libudev-private.h ++++ b/libudev/libudev-private.h +@@ -187,7 +187,7 @@ int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, + /* libudev-util.c */ + #define UTIL_PATH_SIZE 1024 + #define UTIL_NAME_SIZE 512 +-#define UTIL_LINE_SIZE 2048 ++#define UTIL_LINE_SIZE 16384 + #define UDEV_ALLOWED_CHARS_INPUT "/ $%?," + ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size); + ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size); +-- +1.6.6 + diff --git a/0018-Fix-virtio-ports-rule-to-use-attr-instead-of-ATTR.patch b/0018-Fix-virtio-ports-rule-to-use-attr-instead-of-ATTR.patch new file mode 100644 index 0000000..f02f3f0 --- /dev/null +++ b/0018-Fix-virtio-ports-rule-to-use-attr-instead-of-ATTR.patch @@ -0,0 +1,29 @@ +From 3c4b1738a9d591d7ddce361ea184b76b253c4e87 Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 26 Feb 2010 14:05:41 +0530 +Subject: [PATCH 18/36] Fix virtio-ports rule to use $attr instead of $ATTR + +Newer udev versions don't understand $ATTR. + +Signed-off-by: Amit Shah +Signed-off-by: Martin Pitt +--- + rules/rules.d/50-udev-default.rules | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules +index f8556d1..da1535f 100644 +--- a/rules/rules.d/50-udev-default.rules ++++ b/rules/rules.d/50-udev-default.rules +@@ -18,7 +18,7 @@ KERNEL=="mwave", GROUP="dialout" + KERNEL=="hvc*|hvsi*", GROUP="dialout" + + # virtio serial / console ports +-KERNEL=="vport*", SYMLINK+="virtio-ports/$ATTR{name}" ++KERNEL=="vport*", SYMLINK+="virtio-ports/$attr{name}" + + # mem + KERNEL=="null|zero|full|random|urandom", MODE="0666" +-- +1.6.6 + diff --git a/0019-udev-acl-Correctly-handle-ENV-ACL_MANAGE-0.patch b/0019-udev-acl-Correctly-handle-ENV-ACL_MANAGE-0.patch new file mode 100644 index 0000000..29f81f1 --- /dev/null +++ b/0019-udev-acl-Correctly-handle-ENV-ACL_MANAGE-0.patch @@ -0,0 +1,47 @@ +From 5c3ebbf35a2c101e0212c7066f0d65e457fcf40c Mon Sep 17 00:00:00 2001 +From: Martin Pitt +Date: Thu, 4 Mar 2010 00:48:59 +0100 +Subject: [PATCH 19/36] udev-acl: Correctly handle ENV{ACL_MANAGE}==0 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When a custom rule sets ACL_MANAGE to 0 to disable ACL management for a +particular device, handle this as "disabled", by explicitly checking against +"1" instead of "nonempty". + +Thanks to RafaƂ Rzepecki for pointing this out. +--- + extras/udev-acl/70-acl.rules | 2 +- + extras/udev-acl/udev-acl.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules +index 8380f53..874667c 100644 +--- a/extras/udev-acl/70-acl.rules ++++ b/extras/udev-acl/70-acl.rules +@@ -69,7 +69,7 @@ SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0c02", ENV{ACL_MANAG + ENV{COLOR_MEASUREMENT_DEVICE}=="*?", ENV{ACL_MANAGE}="1" + + # apply ACL for all locally logged in users +-LABEL="acl_apply", ENV{ACL_MANAGE}=="?*", TEST=="/var/run/ConsoleKit/database", \ ++LABEL="acl_apply", ENV{ACL_MANAGE}=="1", TEST=="/var/run/ConsoleKit/database", \ + RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}" + + LABEL="acl_end" +diff --git a/extras/udev-acl/udev-acl.c b/extras/udev-acl/udev-acl.c +index e670ce7..c070fcc 100644 +--- a/extras/udev-acl/udev-acl.c ++++ b/extras/udev-acl/udev-acl.c +@@ -289,7 +289,7 @@ static void apply_acl_to_devices(uid_t uid, int add) + /* iterate over all devices tagged with ACL_SET */ + udev = udev_new(); + enumerate = udev_enumerate_new(udev); +- udev_enumerate_add_match_property(enumerate, "ACL_MANAGE", "*"); ++ udev_enumerate_add_match_property(enumerate, "ACL_MANAGE", "1"); + udev_enumerate_scan_devices(enumerate); + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { + struct udev_device *device; +-- +1.6.6 + diff --git a/0021-input_id-Fix-linking.patch b/0021-input_id-Fix-linking.patch new file mode 100644 index 0000000..2e822bc --- /dev/null +++ b/0021-input_id-Fix-linking.patch @@ -0,0 +1,27 @@ +From a245a97b4e805c65ce22659742371550ccf002c1 Mon Sep 17 00:00:00 2001 +From: Martin Pitt +Date: Wed, 10 Mar 2010 12:17:03 +0100 +Subject: [PATCH 21/36] input_id: Fix linking + +Link against libudev-private.a instead of libudev.a, to avoid runtime +dependency to libudev. +--- + Makefile.am | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 471c5dd..99a0133 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -239,7 +239,7 @@ dist_udevrules_DATA += extras/floppy/60-floppy.rules + # input_id - import input device class + # ------------------------------------------------------------------------------ + extras_input_id_input_id_SOURCES = extras/input_id/input_id.c +-extras_input_id_input_id_LDADD = libudev/libudev.la ++extras_input_id_input_id_LDADD = libudev/libudev-private.la + libexec_PROGRAMS += extras/input_id/input_id + + # ------------------------------------------------------------------------------ +-- +1.6.6 + diff --git a/0022-replace-utimes-with-utimensat.patch b/0022-replace-utimes-with-utimensat.patch new file mode 100644 index 0000000..7a42304 --- /dev/null +++ b/0022-replace-utimes-with-utimensat.patch @@ -0,0 +1,34 @@ +From 455f792e4791e037eb0406005b92c345cf0baf56 Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Wed, 10 Mar 2010 14:43:07 +0100 +Subject: [PATCH 22/36] replace utimes() with utimensat() + +--- + udev/udev-node.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/udev/udev-node.c b/udev/udev-node.c +index a70c147..307a76b 100644 +--- a/udev/udev-node.c ++++ b/udev/udev-node.c +@@ -57,7 +57,7 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod + preserve = 1; + udev_selinux_lsetfilecon(udev, file, mode); + /* update time stamp when we re-use the node, like on media change events */ +- utimes(file, NULL); ++ utimensat(AT_FDCWD, file, NULL, 0); + } else { + char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; + +@@ -178,7 +178,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) + info(udev, "preserve already existing symlink '%s' to '%s'\n", + slink, target); + udev_selinux_lsetfilecon(udev, slink, S_IFLNK); +- lutimes(slink, NULL); ++ utimensat(AT_FDCWD, slink, NULL, AT_SYMLINK_NOFOLLOW); + goto exit; + } + } +-- +1.6.6 + diff --git a/0029-firmware-fix-possible-segfault-when-firmware-device-.patch b/0029-firmware-fix-possible-segfault-when-firmware-device-.patch new file mode 100644 index 0000000..05c1939 --- /dev/null +++ b/0029-firmware-fix-possible-segfault-when-firmware-device-.patch @@ -0,0 +1,40 @@ +From d44c27c5ab71dbbcfcf4745977027502309dd795 Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Tue, 16 Mar 2010 10:57:44 +0100 +Subject: [PATCH 29/36] firmware: fix possible segfault when firmware device goes away while loading + +Thanks to Ruediger Oertel. +--- + extras/firmware/firmware.c | 9 ++++++--- + 1 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/extras/firmware/firmware.c b/extras/firmware/firmware.c +index 16455de..92f0918 100644 +--- a/extras/firmware/firmware.c ++++ b/extras/firmware/firmware.c +@@ -63,8 +63,10 @@ static bool copy_firmware(struct udev *udev, const char *source, const char *tar + if (fwrite(buf, size, 1, ftarget) == 1) + ret = true; + exit: +- fclose(ftarget); +- fclose(fsource); ++ if (ftarget != NULL) ++ fclose(ftarget); ++ if (fsource != NULL) ++ fclose(fsource); + free(buf); + return ret; + } +@@ -178,7 +180,8 @@ int main(int argc, char **argv) + if (unlink(misspath) == 0) + util_delete_path(udev, misspath); + +- set_loading(udev, loadpath, "1"); ++ if (!set_loading(udev, loadpath, "1")) ++ goto exit; + + util_strscpyl(datapath, sizeof(datapath), udev_get_sys_path(udev), devpath, "/data", NULL); + if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) { +-- +1.6.6 + diff --git a/0030-rules-input-create-by-path-links-for-pci-devices.patch b/0030-rules-input-create-by-path-links-for-pci-devices.patch new file mode 100644 index 0000000..c35bd60 --- /dev/null +++ b/0030-rules-input-create-by-path-links-for-pci-devices.patch @@ -0,0 +1,25 @@ +From 6b32e8192934619f787c3b5b6f0fe40c32d7d94a Mon Sep 17 00:00:00 2001 +From: Marco d'Itri +Date: Tue, 16 Mar 2010 12:44:43 +0100 +Subject: [PATCH 30/36] rules: input - create by-path/ links for pci devices + +--- + rules/rules.d/60-persistent-input.rules | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules +index e4675ae..1ea4431 100644 +--- a/rules/rules.d/60-persistent-input.rules ++++ b/rules/rules.d/60-persistent-input.rules +@@ -27,7 +27,7 @@ SUBSYSTEMS=="usb", ENV{ID_BUS}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="", A + SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-if$attr{bInterfaceNumber}" + + # by-path +-SUBSYSTEMS=="usb|platform", IMPORT{program}="path_id %p" ++SUBSYSTEMS=="pci|usb|platform", IMPORT{program}="path_id %p" + ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{.INPUT_CLASS}" + ENV{ID_PATH}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{.INPUT_CLASS}" + # allow empty class for platform and usb devices; platform supports only a single interface that way +-- +1.6.6 + diff --git a/0031-Fix-switching-Logitech-bluetooth-adapters-into-hci-m.patch b/0031-Fix-switching-Logitech-bluetooth-adapters-into-hci-m.patch new file mode 100644 index 0000000..a773b94 --- /dev/null +++ b/0031-Fix-switching-Logitech-bluetooth-adapters-into-hci-m.patch @@ -0,0 +1,29 @@ +From 2b463cb050cbf77d9c6b51e0f5a9d89bf7eb1bc3 Mon Sep 17 00:00:00 2001 +From: Marco d'Itri +Date: Tue, 16 Mar 2010 12:47:42 +0100 +Subject: [PATCH 31/36] Fix switching Logitech bluetooth adapters into hci mode. + +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=567237 +https://bugs.launchpad.net/ubuntu/+source/udev/+bug/444420 +--- + extras/hid2hci/70-hid2hci.rules | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/extras/hid2hci/70-hid2hci.rules b/extras/hid2hci/70-hid2hci.rules +index e133afd..01ff30d 100644 +--- a/extras/hid2hci/70-hid2hci.rules ++++ b/extras/hid2hci/70-hid2hci.rules +@@ -10,8 +10,8 @@ ATTR{bInterfaceClass}=="03", ATTR{bInterfaceSubClass}=="01", ATTR{bInterfaceProt + ATTRS{bDeviceClass}=="00", ATTRS{idVendor}=="413c", ATTRS{bmAttributes}=="e0", \ + RUN+="hid2hci --method=dell --devpath=%p", ENV{HID2HCI_SWITCH}="1" + +-# Logitech devices (hidraw) +-KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[34bc]", \ ++# Logitech devices ++KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[34bc]", \ + RUN+="hid2hci --method=logitech-hid --devpath=%p" + + ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end" +-- +1.6.6 + diff --git a/0032-do-not-reset-SELinux-context-when-the-node-was-not-t.patch b/0032-do-not-reset-SELinux-context-when-the-node-was-not-t.patch new file mode 100644 index 0000000..ca136bd --- /dev/null +++ b/0032-do-not-reset-SELinux-context-when-the-node-was-not-t.patch @@ -0,0 +1,88 @@ +From 578cc8a8085a47c963b5940459e475ac5f07219c Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Wed, 17 Mar 2010 09:15:18 +0100 +Subject: [PATCH 32/36] do not reset SELinux context when the node was not touched + +--- + udev/udev-node.c | 42 +++++++++++++++++------------------------- + 1 files changed, 17 insertions(+), 25 deletions(-) + +diff --git a/udev/udev-node.c b/udev/udev-node.c +index 4314cce..3aee15b 100644 +--- a/udev/udev-node.c ++++ b/udev/udev-node.c +@@ -37,7 +37,6 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod + { + struct udev *udev = udev_device_get_udev(dev); + struct stat stats; +- int preserve = 0; + int err = 0; + + if (major(devnum) == 0) +@@ -54,9 +53,15 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod + if (lstat(file, &stats) == 0) { + if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) && (stats.st_rdev == devnum)) { + info(udev, "preserve file '%s', because it has correct dev_t\n", file); +- preserve = 1; +- udev_selinux_lsetfilecon(udev, file, mode); +- /* update time stamp when we re-use the node, like on media change events */ ++ if (stats.st_mode != mode || stats.st_uid != uid || stats.st_gid != gid) { ++ info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); ++ chmod(file, mode); ++ chown(file, uid, gid); ++ udev_selinux_lsetfilecon(udev, file, mode); ++ } else { ++ info(udev, "preserve permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); ++ } ++ /* always update timestamp when we re-use the node, like on media change events */ + utimensat(AT_FDCWD, file, NULL, 0); + } else { + char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; +@@ -76,7 +81,11 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod + if (err != 0) { + err(udev, "rename(%s, %s) failed: %m\n", file_tmp, file); + unlink(file_tmp); ++ goto exit; + } ++ info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); ++ chmod(file, mode); ++ chown(file, uid, gid); + } + } else { + info(udev, "mknod(%s, %#o, (%u,%u))\n", file, mode, major(devnum), minor(devnum)); +@@ -90,28 +99,11 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod + err = -errno; + udev_selinux_resetfscreatecon(udev); + } while (err == -ENOENT); +- if (err != 0) { ++ if (err != 0) + err(udev, "mknod(%s, %#o, (%u,%u) failed: %m\n", file, mode, major(devnum), minor(devnum)); +- goto exit; +- } +- } +- +- if (!preserve || stats.st_mode != mode) { +- info(udev, "chmod(%s, %#o)\n", file, mode); +- err = chmod(file, mode); +- if (err != 0) { +- err(udev, "chmod(%s, %#o) failed: %m\n", file, mode); +- goto exit; +- } +- } +- +- if (!preserve || stats.st_uid != uid || stats.st_gid != gid) { +- info(udev, "chown(%s, %u, %u)\n", file, uid, gid); +- err = chown(file, uid, gid); +- if (err != 0) { +- err(udev, "chown(%s, %u, %u) failed: %m\n", file, uid, gid); +- goto exit; +- } ++ info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); ++ chmod(file, mode); ++ chown(file, uid, gid); + } + exit: + return err; +-- +1.6.6 + diff --git a/0034-add-LGPL-COPYING-to-libudev-and-GUdev.patch b/0034-add-LGPL-COPYING-to-libudev-and-GUdev.patch new file mode 100644 index 0000000..8440ea9 --- /dev/null +++ b/0034-add-LGPL-COPYING-to-libudev-and-GUdev.patch @@ -0,0 +1,1035 @@ +From 23325a66ccf3a2f90a4f5d1702f60408187de28a Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Thu, 18 Mar 2010 09:57:44 +0100 +Subject: [PATCH 34/36] add LGPL COPYING to libudev and GUdev + +--- + extras/gudev/COPYING | 504 ++++++++++++++++++++++++++++++++++++++++++++++++++ + libudev/COPYING | 504 ++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 1008 insertions(+), 0 deletions(-) + create mode 100644 extras/gudev/COPYING + create mode 100644 libudev/COPYING + +diff --git a/extras/gudev/COPYING b/extras/gudev/COPYING +new file mode 100644 +index 0000000..8add30a +--- /dev/null ++++ b/extras/gudev/COPYING +@@ -0,0 +1,504 @@ ++ GNU LESSER GENERAL PUBLIC LICENSE ++ Version 2.1, February 1999 ++ ++ Copyright (C) 1991, 1999 Free Software Foundation, Inc. ++ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ++ Everyone is permitted to copy and distribute verbatim copies ++ of this license document, but changing it is not allowed. ++ ++[This is the first released version of the Lesser GPL. It also counts ++ as the successor of the GNU Library Public License, version 2, hence ++ the version number 2.1.] ++ ++ Preamble ++ ++ The licenses for most software are designed to take away your ++freedom to share and change it. By contrast, the GNU General Public ++Licenses are intended to guarantee your freedom to share and change ++free software--to make sure the software is free for all its users. ++ ++ This license, the Lesser General Public License, applies to some ++specially designated software packages--typically libraries--of the ++Free Software Foundation and other authors who decide to use it. You ++can use it too, but we suggest you first think carefully about whether ++this license or the ordinary General Public License is the better ++strategy to use in any particular case, based on the explanations below. ++ ++ When we speak of free software, we are referring to freedom of use, ++not price. Our General Public Licenses are designed to make sure that ++you have the freedom to distribute copies of free software (and charge ++for this service if you wish); that you receive source code or can get ++it if you want it; that you can change the software and use pieces of ++it in new free programs; and that you are informed that you can do ++these things. ++ ++ To protect your rights, we need to make restrictions that forbid ++distributors to deny you these rights or to ask you to surrender these ++rights. These restrictions translate to certain responsibilities for ++you if you distribute copies of the library or if you modify it. ++ ++ For example, if you distribute copies of the library, whether gratis ++or for a fee, you must give the recipients all the rights that we gave ++you. You must make sure that they, too, receive or can get the source ++code. If you link other code with the library, you must provide ++complete object files to the recipients, so that they can relink them ++with the library after making changes to the library and recompiling ++it. And you must show them these terms so they know their rights. ++ ++ We protect your rights with a two-step method: (1) we copyright the ++library, and (2) we offer you this license, which gives you legal ++permission to copy, distribute and/or modify the library. ++ ++ To protect each distributor, we want to make it very clear that ++there is no warranty for the free library. Also, if the library is ++modified by someone else and passed on, the recipients should know ++that what they have is not the original version, so that the original ++author's reputation will not be affected by problems that might be ++introduced by others. ++ ++ Finally, software patents pose a constant threat to the existence of ++any free program. We wish to make sure that a company cannot ++effectively restrict the users of a free program by obtaining a ++restrictive license from a patent holder. Therefore, we insist that ++any patent license obtained for a version of the library must be ++consistent with the full freedom of use specified in this license. ++ ++ Most GNU software, including some libraries, is covered by the ++ordinary GNU General Public License. This license, the GNU Lesser ++General Public License, applies to certain designated libraries, and ++is quite different from the ordinary General Public License. We use ++this license for certain libraries in order to permit linking those ++libraries into non-free programs. ++ ++ When a program is linked with a library, whether statically or using ++a shared library, the combination of the two is legally speaking a ++combined work, a derivative of the original library. The ordinary ++General Public License therefore permits such linking only if the ++entire combination fits its criteria of freedom. The Lesser General ++Public License permits more lax criteria for linking other code with ++the library. ++ ++ We call this license the "Lesser" General Public License because it ++does Less to protect the user's freedom than the ordinary General ++Public License. It also provides other free software developers Less ++of an advantage over competing non-free programs. These disadvantages ++are the reason we use the ordinary General Public License for many ++libraries. However, the Lesser license provides advantages in certain ++special circumstances. ++ ++ For example, on rare occasions, there may be a special need to ++encourage the widest possible use of a certain library, so that it becomes ++a de-facto standard. To achieve this, non-free programs must be ++allowed to use the library. A more frequent case is that a free ++library does the same job as widely used non-free libraries. In this ++case, there is little to gain by limiting the free library to free ++software only, so we use the Lesser General Public License. ++ ++ In other cases, permission to use a particular library in non-free ++programs enables a greater number of people to use a large body of ++free software. For example, permission to use the GNU C Library in ++non-free programs enables many more people to use the whole GNU ++operating system, as well as its variant, the GNU/Linux operating ++system. ++ ++ Although the Lesser General Public License is Less protective of the ++users' freedom, it does ensure that the user of a program that is ++linked with the Library has the freedom and the wherewithal to run ++that program using a modified version of the Library. ++ ++ The precise terms and conditions for copying, distribution and ++modification follow. Pay close attention to the difference between a ++"work based on the library" and a "work that uses the library". The ++former contains code derived from the library, whereas the latter must ++be combined with the library in order to run. ++ ++ GNU LESSER GENERAL PUBLIC LICENSE ++ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION ++ ++ 0. This License Agreement applies to any software library or other ++program which contains a notice placed by the copyright holder or ++other authorized party saying it may be distributed under the terms of ++this Lesser General Public License (also called "this License"). ++Each licensee is addressed as "you". ++ ++ A "library" means a collection of software functions and/or data ++prepared so as to be conveniently linked with application programs ++(which use some of those functions and data) to form executables. ++ ++ The "Library", below, refers to any such software library or work ++which has been distributed under these terms. A "work based on the ++Library" means either the Library or any derivative work under ++copyright law: that is to say, a work containing the Library or a ++portion of it, either verbatim or with modifications and/or translated ++straightforwardly into another language. (Hereinafter, translation is ++included without limitation in the term "modification".) ++ ++ "Source code" for a work means the preferred form of the work for ++making modifications to it. For a library, complete source code means ++all the source code for all modules it contains, plus any associated ++interface definition files, plus the scripts used to control compilation ++and installation of the library. ++ ++ Activities other than copying, distribution and modification are not ++covered by this License; they are outside its scope. The act of ++running a program using the Library is not restricted, and output from ++such a program is covered only if its contents constitute a work based ++on the Library (independent of the use of the Library in a tool for ++writing it). Whether that is true depends on what the Library does ++and what the program that uses the Library does. ++ ++ 1. You may copy and distribute verbatim copies of the Library's ++complete source code as you receive it, in any medium, provided that ++you conspicuously and appropriately publish on each copy an ++appropriate copyright notice and disclaimer of warranty; keep intact ++all the notices that refer to this License and to the absence of any ++warranty; and distribute a copy of this License along with the ++Library. ++ ++ You may charge a fee for the physical act of transferring a copy, ++and you may at your option offer warranty protection in exchange for a ++fee. ++ ++ 2. You may modify your copy or copies of the Library or any portion ++of it, thus forming a work based on the Library, and copy and ++distribute such modifications or work under the terms of Section 1 ++above, provided that you also meet all of these conditions: ++ ++ a) The modified work must itself be a software library. ++ ++ b) You must cause the files modified to carry prominent notices ++ stating that you changed the files and the date of any change. ++ ++ c) You must cause the whole of the work to be licensed at no ++ charge to all third parties under the terms of this License. ++ ++ d) If a facility in the modified Library refers to a function or a ++ table of data to be supplied by an application program that uses ++ the facility, other than as an argument passed when the facility ++ is invoked, then you must make a good faith effort to ensure that, ++ in the event an application does not supply such function or ++ table, the facility still operates, and performs whatever part of ++ its purpose remains meaningful. ++ ++ (For example, a function in a library to compute square roots has ++ a purpose that is entirely well-defined independent of the ++ application. Therefore, Subsection 2d requires that any ++ application-supplied function or table used by this function must ++ be optional: if the application does not supply it, the square ++ root function must still compute square roots.) ++ ++These requirements apply to the modified work as a whole. If ++identifiable sections of that work are not derived from the Library, ++and can be reasonably considered independent and separate works in ++themselves, then this License, and its terms, do not apply to those ++sections when you distribute them as separate works. But when you ++distribute the same sections as part of a whole which is a work based ++on the Library, the distribution of the whole must be on the terms of ++this License, whose permissions for other licensees extend to the ++entire whole, and thus to each and every part regardless of who wrote ++it. ++ ++Thus, it is not the intent of this section to claim rights or contest ++your rights to work written entirely by you; rather, the intent is to ++exercise the right to control the distribution of derivative or ++collective works based on the Library. ++ ++In addition, mere aggregation of another work not based on the Library ++with the Library (or with a work based on the Library) on a volume of ++a storage or distribution medium does not bring the other work under ++the scope of this License. ++ ++ 3. You may opt to apply the terms of the ordinary GNU General Public ++License instead of this License to a given copy of the Library. To do ++this, you must alter all the notices that refer to this License, so ++that they refer to the ordinary GNU General Public License, version 2, ++instead of to this License. (If a newer version than version 2 of the ++ordinary GNU General Public License has appeared, then you can specify ++that version instead if you wish.) Do not make any other change in ++these notices. ++ ++ Once this change is made in a given copy, it is irreversible for ++that copy, so the ordinary GNU General Public License applies to all ++subsequent copies and derivative works made from that copy. ++ ++ This option is useful when you wish to copy part of the code of ++the Library into a program that is not a library. ++ ++ 4. You may copy and distribute the Library (or a portion or ++derivative of it, under Section 2) in object code or executable form ++under the terms of Sections 1 and 2 above provided that you accompany ++it with the complete corresponding machine-readable source code, which ++must be distributed under the terms of Sections 1 and 2 above on a ++medium customarily used for software interchange. ++ ++ If distribution of object code is made by offering access to copy ++from a designated place, then offering equivalent access to copy the ++source code from the same place satisfies the requirement to ++distribute the source code, even though third parties are not ++compelled to copy the source along with the object code. ++ ++ 5. A program that contains no derivative of any portion of the ++Library, but is designed to work with the Library by being compiled or ++linked with it, is called a "work that uses the Library". Such a ++work, in isolation, is not a derivative work of the Library, and ++therefore falls outside the scope of this License. ++ ++ However, linking a "work that uses the Library" with the Library ++creates an executable that is a derivative of the Library (because it ++contains portions of the Library), rather than a "work that uses the ++library". The executable is therefore covered by this License. ++Section 6 states terms for distribution of such executables. ++ ++ When a "work that uses the Library" uses material from a header file ++that is part of the Library, the object code for the work may be a ++derivative work of the Library even though the source code is not. ++Whether this is true is especially significant if the work can be ++linked without the Library, or if the work is itself a library. The ++threshold for this to be true is not precisely defined by law. ++ ++ If such an object file uses only numerical parameters, data ++structure layouts and accessors, and small macros and small inline ++functions (ten lines or less in length), then the use of the object ++file is unrestricted, regardless of whether it is legally a derivative ++work. (Executables containing this object code plus portions of the ++Library will still fall under Section 6.) ++ ++ Otherwise, if the work is a derivative of the Library, you may ++distribute the object code for the work under the terms of Section 6. ++Any executables containing that work also fall under Section 6, ++whether or not they are linked directly with the Library itself. ++ ++ 6. As an exception to the Sections above, you may also combine or ++link a "work that uses the Library" with the Library to produce a ++work containing portions of the Library, and distribute that work ++under terms of your choice, provided that the terms permit ++modification of the work for the customer's own use and reverse ++engineering for debugging such modifications. ++ ++ You must give prominent notice with each copy of the work that the ++Library is used in it and that the Library and its use are covered by ++this License. You must supply a copy of this License. If the work ++during execution displays copyright notices, you must include the ++copyright notice for the Library among them, as well as a reference ++directing the user to the copy of this License. Also, you must do one ++of these things: ++ ++ a) Accompany the work with the complete corresponding ++ machine-readable source code for the Library including whatever ++ changes were used in the work (which must be distributed under ++ Sections 1 and 2 above); and, if the work is an executable linked ++ with the Library, with the complete machine-readable "work that ++ uses the Library", as object code and/or source code, so that the ++ user can modify the Library and then relink to produce a modified ++ executable containing the modified Library. (It is understood ++ that the user who changes the contents of definitions files in the ++ Library will not necessarily be able to recompile the application ++ to use the modified definitions.) ++ ++ b) Use a suitable shared library mechanism for linking with the ++ Library. A suitable mechanism is one that (1) uses at run time a ++ copy of the library already present on the user's computer system, ++ rather than copying library functions into the executable, and (2) ++ will operate properly with a modified version of the library, if ++ the user installs one, as long as the modified version is ++ interface-compatible with the version that the work was made with. ++ ++ c) Accompany the work with a written offer, valid for at ++ least three years, to give the same user the materials ++ specified in Subsection 6a, above, for a charge no more ++ than the cost of performing this distribution. ++ ++ d) If distribution of the work is made by offering access to copy ++ from a designated place, offer equivalent access to copy the above ++ specified materials from the same place. ++ ++ e) Verify that the user has already received a copy of these ++ materials or that you have already sent this user a copy. ++ ++ For an executable, the required form of the "work that uses the ++Library" must include any data and utility programs needed for ++reproducing the executable from it. However, as a special exception, ++the materials to be distributed need not include anything that is ++normally distributed (in either source or binary form) with the major ++components (compiler, kernel, and so on) of the operating system on ++which the executable runs, unless that component itself accompanies ++the executable. ++ ++ It may happen that this requirement contradicts the license ++restrictions of other proprietary libraries that do not normally ++accompany the operating system. Such a contradiction means you cannot ++use both them and the Library together in an executable that you ++distribute. ++ ++ 7. You may place library facilities that are a work based on the ++Library side-by-side in a single library together with other library ++facilities not covered by this License, and distribute such a combined ++library, provided that the separate distribution of the work based on ++the Library and of the other library facilities is otherwise ++permitted, and provided that you do these two things: ++ ++ a) Accompany the combined library with a copy of the same work ++ based on the Library, uncombined with any other library ++ facilities. This must be distributed under the terms of the ++ Sections above. ++ ++ b) Give prominent notice with the combined library of the fact ++ that part of it is a work based on the Library, and explaining ++ where to find the accompanying uncombined form of the same work. ++ ++ 8. You may not copy, modify, sublicense, link with, or distribute ++the Library except as expressly provided under this License. Any ++attempt otherwise to copy, modify, sublicense, link with, or ++distribute the Library is void, and will automatically terminate your ++rights under this License. However, parties who have received copies, ++or rights, from you under this License will not have their licenses ++terminated so long as such parties remain in full compliance. ++ ++ 9. You are not required to accept this License, since you have not ++signed it. However, nothing else grants you permission to modify or ++distribute the Library or its derivative works. These actions are ++prohibited by law if you do not accept this License. Therefore, by ++modifying or distributing the Library (or any work based on the ++Library), you indicate your acceptance of this License to do so, and ++all its terms and conditions for copying, distributing or modifying ++the Library or works based on it. ++ ++ 10. Each time you redistribute the Library (or any work based on the ++Library), the recipient automatically receives a license from the ++original licensor to copy, distribute, link with or modify the Library ++subject to these terms and conditions. You may not impose any further ++restrictions on the recipients' exercise of the rights granted herein. ++You are not responsible for enforcing compliance by third parties with ++this License. ++ ++ 11. If, as a consequence of a court judgment or allegation of patent ++infringement or for any other reason (not limited to patent issues), ++conditions are imposed on you (whether by court order, agreement or ++otherwise) that contradict the conditions of this License, they do not ++excuse you from the conditions of this License. If you cannot ++distribute so as to satisfy simultaneously your obligations under this ++License and any other pertinent obligations, then as a consequence you ++may not distribute the Library at all. For example, if a patent ++license would not permit royalty-free redistribution of the Library by ++all those who receive copies directly or indirectly through you, then ++the only way you could satisfy both it and this License would be to ++refrain entirely from distribution of the Library. ++ ++If any portion of this section is held invalid or unenforceable under any ++particular circumstance, the balance of the section is intended to apply, ++and the section as a whole is intended to apply in other circumstances. ++ ++It is not the purpose of this section to induce you to infringe any ++patents or other property right claims or to contest validity of any ++such claims; this section has the sole purpose of protecting the ++integrity of the free software distribution system which is ++implemented by public license practices. Many people have made ++generous contributions to the wide range of software distributed ++through that system in reliance on consistent application of that ++system; it is up to the author/donor to decide if he or she is willing ++to distribute software through any other system and a licensee cannot ++impose that choice. ++ ++This section is intended to make thoroughly clear what is believed to ++be a consequence of the rest of this License. ++ ++ 12. If the distribution and/or use of the Library is restricted in ++certain countries either by patents or by copyrighted interfaces, the ++original copyright holder who places the Library under this License may add ++an explicit geographical distribution limitation excluding those countries, ++so that distribution is permitted only in or among countries not thus ++excluded. In such case, this License incorporates the limitation as if ++written in the body of this License. ++ ++ 13. The Free Software Foundation may publish revised and/or new ++versions of the Lesser General Public License from time to time. ++Such new versions will be similar in spirit to the present version, ++but may differ in detail to address new problems or concerns. ++ ++Each version is given a distinguishing version number. If the Library ++specifies a version number of this License which applies to it and ++"any later version", you have the option of following the terms and ++conditions either of that version or of any later version published by ++the Free Software Foundation. If the Library does not specify a ++license version number, you may choose any version ever published by ++the Free Software Foundation. ++ ++ 14. If you wish to incorporate parts of the Library into other free ++programs whose distribution conditions are incompatible with these, ++write to the author to ask for permission. For software which is ++copyrighted by the Free Software Foundation, write to the Free ++Software Foundation; we sometimes make exceptions for this. Our ++decision will be guided by the two goals of preserving the free status ++of all derivatives of our free software and of promoting the sharing ++and reuse of software generally. ++ ++ NO WARRANTY ++ ++ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO ++WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. ++EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR ++OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY ++KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE ++IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ++PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE ++LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME ++THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. ++ ++ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN ++WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY ++AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU ++FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR ++CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE ++LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING ++RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A ++FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF ++SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH ++DAMAGES. ++ ++ END OF TERMS AND CONDITIONS ++ ++ How to Apply These Terms to Your New Libraries ++ ++ If you develop a new library, and you want it to be of the greatest ++possible use to the public, we recommend making it free software that ++everyone can redistribute and change. You can do so by permitting ++redistribution under these terms (or, alternatively, under the terms of the ++ordinary General Public License). ++ ++ To apply these terms, attach the following notices to the library. It is ++safest to attach them to the start of each source file to most effectively ++convey the exclusion of warranty; and each file should have at least the ++"copyright" line and a pointer to where the full notice is found. ++ ++ ++ Copyright (C) ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library; if not, write to the Free Software ++ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ++ ++Also add information on how to contact you by electronic and paper mail. ++ ++You should also get your employer (if you work as a programmer) or your ++school, if any, to sign a "copyright disclaimer" for the library, if ++necessary. Here is a sample; alter the names: ++ ++ Yoyodyne, Inc., hereby disclaims all copyright interest in the ++ library `Frob' (a library for tweaking knobs) written by James Random Hacker. ++ ++ , 1 April 1990 ++ Ty Coon, President of Vice ++ ++That's all there is to it! ++ ++ +diff --git a/libudev/COPYING b/libudev/COPYING +new file mode 100644 +index 0000000..8add30a +--- /dev/null ++++ b/libudev/COPYING +@@ -0,0 +1,504 @@ ++ GNU LESSER GENERAL PUBLIC LICENSE ++ Version 2.1, February 1999 ++ ++ Copyright (C) 1991, 1999 Free Software Foundation, Inc. ++ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ++ Everyone is permitted to copy and distribute verbatim copies ++ of this license document, but changing it is not allowed. ++ ++[This is the first released version of the Lesser GPL. It also counts ++ as the successor of the GNU Library Public License, version 2, hence ++ the version number 2.1.] ++ ++ Preamble ++ ++ The licenses for most software are designed to take away your ++freedom to share and change it. By contrast, the GNU General Public ++Licenses are intended to guarantee your freedom to share and change ++free software--to make sure the software is free for all its users. ++ ++ This license, the Lesser General Public License, applies to some ++specially designated software packages--typically libraries--of the ++Free Software Foundation and other authors who decide to use it. You ++can use it too, but we suggest you first think carefully about whether ++this license or the ordinary General Public License is the better ++strategy to use in any particular case, based on the explanations below. ++ ++ When we speak of free software, we are referring to freedom of use, ++not price. Our General Public Licenses are designed to make sure that ++you have the freedom to distribute copies of free software (and charge ++for this service if you wish); that you receive source code or can get ++it if you want it; that you can change the software and use pieces of ++it in new free programs; and that you are informed that you can do ++these things. ++ ++ To protect your rights, we need to make restrictions that forbid ++distributors to deny you these rights or to ask you to surrender these ++rights. These restrictions translate to certain responsibilities for ++you if you distribute copies of the library or if you modify it. ++ ++ For example, if you distribute copies of the library, whether gratis ++or for a fee, you must give the recipients all the rights that we gave ++you. You must make sure that they, too, receive or can get the source ++code. If you link other code with the library, you must provide ++complete object files to the recipients, so that they can relink them ++with the library after making changes to the library and recompiling ++it. And you must show them these terms so they know their rights. ++ ++ We protect your rights with a two-step method: (1) we copyright the ++library, and (2) we offer you this license, which gives you legal ++permission to copy, distribute and/or modify the library. ++ ++ To protect each distributor, we want to make it very clear that ++there is no warranty for the free library. Also, if the library is ++modified by someone else and passed on, the recipients should know ++that what they have is not the original version, so that the original ++author's reputation will not be affected by problems that might be ++introduced by others. ++ ++ Finally, software patents pose a constant threat to the existence of ++any free program. We wish to make sure that a company cannot ++effectively restrict the users of a free program by obtaining a ++restrictive license from a patent holder. Therefore, we insist that ++any patent license obtained for a version of the library must be ++consistent with the full freedom of use specified in this license. ++ ++ Most GNU software, including some libraries, is covered by the ++ordinary GNU General Public License. This license, the GNU Lesser ++General Public License, applies to certain designated libraries, and ++is quite different from the ordinary General Public License. We use ++this license for certain libraries in order to permit linking those ++libraries into non-free programs. ++ ++ When a program is linked with a library, whether statically or using ++a shared library, the combination of the two is legally speaking a ++combined work, a derivative of the original library. The ordinary ++General Public License therefore permits such linking only if the ++entire combination fits its criteria of freedom. The Lesser General ++Public License permits more lax criteria for linking other code with ++the library. ++ ++ We call this license the "Lesser" General Public License because it ++does Less to protect the user's freedom than the ordinary General ++Public License. It also provides other free software developers Less ++of an advantage over competing non-free programs. These disadvantages ++are the reason we use the ordinary General Public License for many ++libraries. However, the Lesser license provides advantages in certain ++special circumstances. ++ ++ For example, on rare occasions, there may be a special need to ++encourage the widest possible use of a certain library, so that it becomes ++a de-facto standard. To achieve this, non-free programs must be ++allowed to use the library. A more frequent case is that a free ++library does the same job as widely used non-free libraries. In this ++case, there is little to gain by limiting the free library to free ++software only, so we use the Lesser General Public License. ++ ++ In other cases, permission to use a particular library in non-free ++programs enables a greater number of people to use a large body of ++free software. For example, permission to use the GNU C Library in ++non-free programs enables many more people to use the whole GNU ++operating system, as well as its variant, the GNU/Linux operating ++system. ++ ++ Although the Lesser General Public License is Less protective of the ++users' freedom, it does ensure that the user of a program that is ++linked with the Library has the freedom and the wherewithal to run ++that program using a modified version of the Library. ++ ++ The precise terms and conditions for copying, distribution and ++modification follow. Pay close attention to the difference between a ++"work based on the library" and a "work that uses the library". The ++former contains code derived from the library, whereas the latter must ++be combined with the library in order to run. ++ ++ GNU LESSER GENERAL PUBLIC LICENSE ++ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION ++ ++ 0. This License Agreement applies to any software library or other ++program which contains a notice placed by the copyright holder or ++other authorized party saying it may be distributed under the terms of ++this Lesser General Public License (also called "this License"). ++Each licensee is addressed as "you". ++ ++ A "library" means a collection of software functions and/or data ++prepared so as to be conveniently linked with application programs ++(which use some of those functions and data) to form executables. ++ ++ The "Library", below, refers to any such software library or work ++which has been distributed under these terms. A "work based on the ++Library" means either the Library or any derivative work under ++copyright law: that is to say, a work containing the Library or a ++portion of it, either verbatim or with modifications and/or translated ++straightforwardly into another language. (Hereinafter, translation is ++included without limitation in the term "modification".) ++ ++ "Source code" for a work means the preferred form of the work for ++making modifications to it. For a library, complete source code means ++all the source code for all modules it contains, plus any associated ++interface definition files, plus the scripts used to control compilation ++and installation of the library. ++ ++ Activities other than copying, distribution and modification are not ++covered by this License; they are outside its scope. The act of ++running a program using the Library is not restricted, and output from ++such a program is covered only if its contents constitute a work based ++on the Library (independent of the use of the Library in a tool for ++writing it). Whether that is true depends on what the Library does ++and what the program that uses the Library does. ++ ++ 1. You may copy and distribute verbatim copies of the Library's ++complete source code as you receive it, in any medium, provided that ++you conspicuously and appropriately publish on each copy an ++appropriate copyright notice and disclaimer of warranty; keep intact ++all the notices that refer to this License and to the absence of any ++warranty; and distribute a copy of this License along with the ++Library. ++ ++ You may charge a fee for the physical act of transferring a copy, ++and you may at your option offer warranty protection in exchange for a ++fee. ++ ++ 2. You may modify your copy or copies of the Library or any portion ++of it, thus forming a work based on the Library, and copy and ++distribute such modifications or work under the terms of Section 1 ++above, provided that you also meet all of these conditions: ++ ++ a) The modified work must itself be a software library. ++ ++ b) You must cause the files modified to carry prominent notices ++ stating that you changed the files and the date of any change. ++ ++ c) You must cause the whole of the work to be licensed at no ++ charge to all third parties under the terms of this License. ++ ++ d) If a facility in the modified Library refers to a function or a ++ table of data to be supplied by an application program that uses ++ the facility, other than as an argument passed when the facility ++ is invoked, then you must make a good faith effort to ensure that, ++ in the event an application does not supply such function or ++ table, the facility still operates, and performs whatever part of ++ its purpose remains meaningful. ++ ++ (For example, a function in a library to compute square roots has ++ a purpose that is entirely well-defined independent of the ++ application. Therefore, Subsection 2d requires that any ++ application-supplied function or table used by this function must ++ be optional: if the application does not supply it, the square ++ root function must still compute square roots.) ++ ++These requirements apply to the modified work as a whole. If ++identifiable sections of that work are not derived from the Library, ++and can be reasonably considered independent and separate works in ++themselves, then this License, and its terms, do not apply to those ++sections when you distribute them as separate works. But when you ++distribute the same sections as part of a whole which is a work based ++on the Library, the distribution of the whole must be on the terms of ++this License, whose permissions for other licensees extend to the ++entire whole, and thus to each and every part regardless of who wrote ++it. ++ ++Thus, it is not the intent of this section to claim rights or contest ++your rights to work written entirely by you; rather, the intent is to ++exercise the right to control the distribution of derivative or ++collective works based on the Library. ++ ++In addition, mere aggregation of another work not based on the Library ++with the Library (or with a work based on the Library) on a volume of ++a storage or distribution medium does not bring the other work under ++the scope of this License. ++ ++ 3. You may opt to apply the terms of the ordinary GNU General Public ++License instead of this License to a given copy of the Library. To do ++this, you must alter all the notices that refer to this License, so ++that they refer to the ordinary GNU General Public License, version 2, ++instead of to this License. (If a newer version than version 2 of the ++ordinary GNU General Public License has appeared, then you can specify ++that version instead if you wish.) Do not make any other change in ++these notices. ++ ++ Once this change is made in a given copy, it is irreversible for ++that copy, so the ordinary GNU General Public License applies to all ++subsequent copies and derivative works made from that copy. ++ ++ This option is useful when you wish to copy part of the code of ++the Library into a program that is not a library. ++ ++ 4. You may copy and distribute the Library (or a portion or ++derivative of it, under Section 2) in object code or executable form ++under the terms of Sections 1 and 2 above provided that you accompany ++it with the complete corresponding machine-readable source code, which ++must be distributed under the terms of Sections 1 and 2 above on a ++medium customarily used for software interchange. ++ ++ If distribution of object code is made by offering access to copy ++from a designated place, then offering equivalent access to copy the ++source code from the same place satisfies the requirement to ++distribute the source code, even though third parties are not ++compelled to copy the source along with the object code. ++ ++ 5. A program that contains no derivative of any portion of the ++Library, but is designed to work with the Library by being compiled or ++linked with it, is called a "work that uses the Library". Such a ++work, in isolation, is not a derivative work of the Library, and ++therefore falls outside the scope of this License. ++ ++ However, linking a "work that uses the Library" with the Library ++creates an executable that is a derivative of the Library (because it ++contains portions of the Library), rather than a "work that uses the ++library". The executable is therefore covered by this License. ++Section 6 states terms for distribution of such executables. ++ ++ When a "work that uses the Library" uses material from a header file ++that is part of the Library, the object code for the work may be a ++derivative work of the Library even though the source code is not. ++Whether this is true is especially significant if the work can be ++linked without the Library, or if the work is itself a library. The ++threshold for this to be true is not precisely defined by law. ++ ++ If such an object file uses only numerical parameters, data ++structure layouts and accessors, and small macros and small inline ++functions (ten lines or less in length), then the use of the object ++file is unrestricted, regardless of whether it is legally a derivative ++work. (Executables containing this object code plus portions of the ++Library will still fall under Section 6.) ++ ++ Otherwise, if the work is a derivative of the Library, you may ++distribute the object code for the work under the terms of Section 6. ++Any executables containing that work also fall under Section 6, ++whether or not they are linked directly with the Library itself. ++ ++ 6. As an exception to the Sections above, you may also combine or ++link a "work that uses the Library" with the Library to produce a ++work containing portions of the Library, and distribute that work ++under terms of your choice, provided that the terms permit ++modification of the work for the customer's own use and reverse ++engineering for debugging such modifications. ++ ++ You must give prominent notice with each copy of the work that the ++Library is used in it and that the Library and its use are covered by ++this License. You must supply a copy of this License. If the work ++during execution displays copyright notices, you must include the ++copyright notice for the Library among them, as well as a reference ++directing the user to the copy of this License. Also, you must do one ++of these things: ++ ++ a) Accompany the work with the complete corresponding ++ machine-readable source code for the Library including whatever ++ changes were used in the work (which must be distributed under ++ Sections 1 and 2 above); and, if the work is an executable linked ++ with the Library, with the complete machine-readable "work that ++ uses the Library", as object code and/or source code, so that the ++ user can modify the Library and then relink to produce a modified ++ executable containing the modified Library. (It is understood ++ that the user who changes the contents of definitions files in the ++ Library will not necessarily be able to recompile the application ++ to use the modified definitions.) ++ ++ b) Use a suitable shared library mechanism for linking with the ++ Library. A suitable mechanism is one that (1) uses at run time a ++ copy of the library already present on the user's computer system, ++ rather than copying library functions into the executable, and (2) ++ will operate properly with a modified version of the library, if ++ the user installs one, as long as the modified version is ++ interface-compatible with the version that the work was made with. ++ ++ c) Accompany the work with a written offer, valid for at ++ least three years, to give the same user the materials ++ specified in Subsection 6a, above, for a charge no more ++ than the cost of performing this distribution. ++ ++ d) If distribution of the work is made by offering access to copy ++ from a designated place, offer equivalent access to copy the above ++ specified materials from the same place. ++ ++ e) Verify that the user has already received a copy of these ++ materials or that you have already sent this user a copy. ++ ++ For an executable, the required form of the "work that uses the ++Library" must include any data and utility programs needed for ++reproducing the executable from it. However, as a special exception, ++the materials to be distributed need not include anything that is ++normally distributed (in either source or binary form) with the major ++components (compiler, kernel, and so on) of the operating system on ++which the executable runs, unless that component itself accompanies ++the executable. ++ ++ It may happen that this requirement contradicts the license ++restrictions of other proprietary libraries that do not normally ++accompany the operating system. Such a contradiction means you cannot ++use both them and the Library together in an executable that you ++distribute. ++ ++ 7. You may place library facilities that are a work based on the ++Library side-by-side in a single library together with other library ++facilities not covered by this License, and distribute such a combined ++library, provided that the separate distribution of the work based on ++the Library and of the other library facilities is otherwise ++permitted, and provided that you do these two things: ++ ++ a) Accompany the combined library with a copy of the same work ++ based on the Library, uncombined with any other library ++ facilities. This must be distributed under the terms of the ++ Sections above. ++ ++ b) Give prominent notice with the combined library of the fact ++ that part of it is a work based on the Library, and explaining ++ where to find the accompanying uncombined form of the same work. ++ ++ 8. You may not copy, modify, sublicense, link with, or distribute ++the Library except as expressly provided under this License. Any ++attempt otherwise to copy, modify, sublicense, link with, or ++distribute the Library is void, and will automatically terminate your ++rights under this License. However, parties who have received copies, ++or rights, from you under this License will not have their licenses ++terminated so long as such parties remain in full compliance. ++ ++ 9. You are not required to accept this License, since you have not ++signed it. However, nothing else grants you permission to modify or ++distribute the Library or its derivative works. These actions are ++prohibited by law if you do not accept this License. Therefore, by ++modifying or distributing the Library (or any work based on the ++Library), you indicate your acceptance of this License to do so, and ++all its terms and conditions for copying, distributing or modifying ++the Library or works based on it. ++ ++ 10. Each time you redistribute the Library (or any work based on the ++Library), the recipient automatically receives a license from the ++original licensor to copy, distribute, link with or modify the Library ++subject to these terms and conditions. You may not impose any further ++restrictions on the recipients' exercise of the rights granted herein. ++You are not responsible for enforcing compliance by third parties with ++this License. ++ ++ 11. If, as a consequence of a court judgment or allegation of patent ++infringement or for any other reason (not limited to patent issues), ++conditions are imposed on you (whether by court order, agreement or ++otherwise) that contradict the conditions of this License, they do not ++excuse you from the conditions of this License. If you cannot ++distribute so as to satisfy simultaneously your obligations under this ++License and any other pertinent obligations, then as a consequence you ++may not distribute the Library at all. For example, if a patent ++license would not permit royalty-free redistribution of the Library by ++all those who receive copies directly or indirectly through you, then ++the only way you could satisfy both it and this License would be to ++refrain entirely from distribution of the Library. ++ ++If any portion of this section is held invalid or unenforceable under any ++particular circumstance, the balance of the section is intended to apply, ++and the section as a whole is intended to apply in other circumstances. ++ ++It is not the purpose of this section to induce you to infringe any ++patents or other property right claims or to contest validity of any ++such claims; this section has the sole purpose of protecting the ++integrity of the free software distribution system which is ++implemented by public license practices. Many people have made ++generous contributions to the wide range of software distributed ++through that system in reliance on consistent application of that ++system; it is up to the author/donor to decide if he or she is willing ++to distribute software through any other system and a licensee cannot ++impose that choice. ++ ++This section is intended to make thoroughly clear what is believed to ++be a consequence of the rest of this License. ++ ++ 12. If the distribution and/or use of the Library is restricted in ++certain countries either by patents or by copyrighted interfaces, the ++original copyright holder who places the Library under this License may add ++an explicit geographical distribution limitation excluding those countries, ++so that distribution is permitted only in or among countries not thus ++excluded. In such case, this License incorporates the limitation as if ++written in the body of this License. ++ ++ 13. The Free Software Foundation may publish revised and/or new ++versions of the Lesser General Public License from time to time. ++Such new versions will be similar in spirit to the present version, ++but may differ in detail to address new problems or concerns. ++ ++Each version is given a distinguishing version number. If the Library ++specifies a version number of this License which applies to it and ++"any later version", you have the option of following the terms and ++conditions either of that version or of any later version published by ++the Free Software Foundation. If the Library does not specify a ++license version number, you may choose any version ever published by ++the Free Software Foundation. ++ ++ 14. If you wish to incorporate parts of the Library into other free ++programs whose distribution conditions are incompatible with these, ++write to the author to ask for permission. For software which is ++copyrighted by the Free Software Foundation, write to the Free ++Software Foundation; we sometimes make exceptions for this. Our ++decision will be guided by the two goals of preserving the free status ++of all derivatives of our free software and of promoting the sharing ++and reuse of software generally. ++ ++ NO WARRANTY ++ ++ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO ++WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. ++EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR ++OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY ++KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE ++IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ++PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE ++LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME ++THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. ++ ++ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN ++WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY ++AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU ++FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR ++CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE ++LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING ++RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A ++FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF ++SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH ++DAMAGES. ++ ++ END OF TERMS AND CONDITIONS ++ ++ How to Apply These Terms to Your New Libraries ++ ++ If you develop a new library, and you want it to be of the greatest ++possible use to the public, we recommend making it free software that ++everyone can redistribute and change. You can do so by permitting ++redistribution under these terms (or, alternatively, under the terms of the ++ordinary General Public License). ++ ++ To apply these terms, attach the following notices to the library. It is ++safest to attach them to the start of each source file to most effectively ++convey the exclusion of warranty; and each file should have at least the ++"copyright" line and a pointer to where the full notice is found. ++ ++ ++ Copyright (C) ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library; if not, write to the Free Software ++ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ++ ++Also add information on how to contact you by electronic and paper mail. ++ ++You should also get your employer (if you work as a programmer) or your ++school, if any, to sign a "copyright disclaimer" for the library, if ++necessary. Here is a sample; alter the names: ++ ++ Yoyodyne, Inc., hereby disclaims all copyright interest in the ++ library `Frob' (a library for tweaking knobs) written by James Random Hacker. ++ ++ , 1 April 1990 ++ Ty Coon, President of Vice ++ ++That's all there is to it! ++ ++ +-- +1.6.6 + diff --git a/0035-cdrom_id-open-non-mounted-optical-media-with-O_EXCL.patch b/0035-cdrom_id-open-non-mounted-optical-media-with-O_EXCL.patch new file mode 100644 index 0000000..870a344 --- /dev/null +++ b/0035-cdrom_id-open-non-mounted-optical-media-with-O_EXCL.patch @@ -0,0 +1,58 @@ +From 38a3cde11bc77af49a96245b8a8a0f2b583a344c Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Thu, 18 Mar 2010 11:14:32 +0100 +Subject: [PATCH 35/36] cdrom_id: open non-mounted optical media with O_EXCL + +This should prevent confusing drives during CD burning sessions. Based +on a patch from Harald Hoyer. +--- + extras/cdrom_id/cdrom_id.c | 26 +++++++++++++++++++++++++- + 1 files changed, 25 insertions(+), 1 deletions(-) + +diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c +index 2380b15..e485768 100644 +--- a/extras/cdrom_id/cdrom_id.c ++++ b/extras/cdrom_id/cdrom_id.c +@@ -112,6 +112,30 @@ static unsigned long long int cd_media_session_last_offset; + #define ASC(errcode) (((errcode) >> 8) & 0xFF) + #define ASCQ(errcode) ((errcode) & 0xFF) + ++static int is_mounted(const char *device) ++{ ++ struct stat statbuf; ++ FILE *fp; ++ int maj, min; ++ int mounted = 0; ++ ++ if (stat(device, &statbuf) < 0) ++ return -ENODEV; ++ ++ fp = fopen("/proc/self/mountinfo", "r"); ++ if (fp == NULL) ++ return -ENOSYS; ++ while (fscanf(fp, "%*s %*s %i:%i %*[^\n]", &maj, &min) == 2) { ++ printf("got %u %u\n", maj, min); ++ if (makedev(maj, min) == statbuf.st_rdev) { ++ mounted = 1; ++ break; ++ } ++ } ++ fclose(fp); ++ return mounted; ++} ++ + static void info_scsi_cmd_err(struct udev *udev, char *cmd, int err) + { + if (err == -1) { +@@ -568,7 +592,7 @@ int main(int argc, char *argv[]) + goto exit; + } + +- fd = open(node, O_RDONLY | O_NONBLOCK); ++ fd = open(node, O_RDONLY|O_NONBLOCK|(is_mounted(node) ? 0 : O_EXCL)); + if (fd < 0) { + info(udev, "unable to open '%s'\n", node); + fprintf(stderr, "unable to open '%s'\n", node); +-- +1.6.6 + diff --git a/0036-modeswitch-morph-into-tool-that-only-switches-Mobile.patch b/0036-modeswitch-morph-into-tool-that-only-switches-Mobile.patch new file mode 100644 index 0000000..45f1397 --- /dev/null +++ b/0036-modeswitch-morph-into-tool-that-only-switches-Mobile.patch @@ -0,0 +1,2142 @@ +From 4dd9b291354e76f34b0d6d7b5c3b28d03a624418 Mon Sep 17 00:00:00 2001 +From: Dan Williams +Date: Thu, 18 Mar 2010 17:13:59 -0700 +Subject: [PATCH 36/36] modeswitch: morph into tool that only switches Mobile Action cables + +Remove option modeswitching code; use usb_modeswitch already, people. +--- + Makefile.am | 27 +- + extras/mobile-action-modeswitch/.gitignore | 1 + + .../61-mobile-action.rules | 15 + + extras/mobile-action-modeswitch/ma8280p_us.c | 462 ++++++++++++++++++++ + extras/mobile-action-modeswitch/ma8280p_us.h | 24 + + .../mobile-action-modeswitch.c | 262 +++++++++++ + extras/mobile-action-modeswitch/utils.c | 83 ++++ + extras/mobile-action-modeswitch/utils.h | 32 ++ + extras/modem-modeswitch/.gitignore | 1 - + extras/modem-modeswitch/61-mobile-action.rules | 15 - + .../61-option-modem-modeswitch.rules | 44 -- + extras/modem-modeswitch/ma8280p_us.c | 462 -------------------- + extras/modem-modeswitch/ma8280p_us.h | 24 - + extras/modem-modeswitch/modem-modeswitch.c | 266 ----------- + extras/modem-modeswitch/option.c | 131 ------ + extras/modem-modeswitch/option.h | 29 -- + extras/modem-modeswitch/utils.c | 83 ---- + extras/modem-modeswitch/utils.h | 32 -- + 18 files changed, 891 insertions(+), 1102 deletions(-) + create mode 100644 extras/mobile-action-modeswitch/.gitignore + create mode 100644 extras/mobile-action-modeswitch/61-mobile-action.rules + create mode 100644 extras/mobile-action-modeswitch/ma8280p_us.c + create mode 100644 extras/mobile-action-modeswitch/ma8280p_us.h + create mode 100644 extras/mobile-action-modeswitch/mobile-action-modeswitch.c + create mode 100644 extras/mobile-action-modeswitch/utils.c + create mode 100644 extras/mobile-action-modeswitch/utils.h + delete mode 100644 extras/modem-modeswitch/.gitignore + delete mode 100644 extras/modem-modeswitch/61-mobile-action.rules + delete mode 100644 extras/modem-modeswitch/61-option-modem-modeswitch.rules + delete mode 100644 extras/modem-modeswitch/ma8280p_us.c + delete mode 100644 extras/modem-modeswitch/ma8280p_us.h + delete mode 100644 extras/modem-modeswitch/modem-modeswitch.c + delete mode 100644 extras/modem-modeswitch/option.c + delete mode 100644 extras/modem-modeswitch/option.h + delete mode 100644 extras/modem-modeswitch/utils.c + delete mode 100644 extras/modem-modeswitch/utils.h + +diff --git a/Makefile.am b/Makefile.am +index 99a0133..68a68d9 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -448,24 +448,21 @@ extras_usb_db_pci_db_LDADD = libudev/libudev-private.la + libexec_PROGRAMS += extras/usb-db/pci-db + + # ------------------------------------------------------------------------------ +-# modem-modeswitch - magic config switch for 3G modems +-# ------------------------------------------------------------------------------ +-extras_modem_modeswitch_modem_modeswitch_SOURCES =\ +- extras/modem-modeswitch/modem-modeswitch.c \ +- extras/modem-modeswitch/utils.c \ +- extras/modem-modeswitch/utils.h \ +- extras/modem-modeswitch/ma8280p_us.c \ +- extras/modem-modeswitch/ma8280p_us.h \ +- extras/modem-modeswitch/option.c \ +- extras/modem-modeswitch/option.h +-extras_modem_modeswitch_modem_modeswitch_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) +-extras_modem_modeswitch_modem_modeswitch_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) ++# mobile-action-modeswitch - switch Mobile Action cables into serial mode ++# ------------------------------------------------------------------------------ ++extras_mobile_action_modeswitch_mobile_action_modeswitch_SOURCES =\ ++ extras/mobile-action-modeswitch/mobile-action-modeswitch.c \ ++ extras/mobile-action-modeswitch/utils.c \ ++ extras/mobile-action-modeswitch/utils.h \ ++ extras/mobile-action-modeswitch/ma8280p_us.c \ ++ extras/mobile-action-modeswitch/ma8280p_us.h ++extras_mobile_action_modeswitch_mobile_action_modeswitch_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) ++extras_mobile_action_modeswitch_mobile_action_modeswitch_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) + + dist_udevrules_DATA += \ +- extras/modem-modeswitch/61-option-modem-modeswitch.rules \ +- extras/modem-modeswitch/61-mobile-action.rules ++ extras/mobile-action-modeswitch/61-mobile-action.rules + +-libexec_PROGRAMS += extras/modem-modeswitch/modem-modeswitch ++libexec_PROGRAMS += extras/mobile-action-modeswitch/mobile-action-modeswitch + + # ------------------------------------------------------------------------------ + # keymap - map custom hardware's multimedia keys +diff --git a/extras/mobile-action-modeswitch/61-mobile-action.rules b/extras/mobile-action-modeswitch/61-mobile-action.rules +new file mode 100644 +index 0000000..0af27a5 +--- /dev/null ++++ b/extras/mobile-action-modeswitch/61-mobile-action.rules +@@ -0,0 +1,15 @@ ++ACTION!="add", GOTO="mobile_action_end" ++ ++# ATTENTION: DO NOT USE THIS FILE FOR ANYTHING EXCEPT ++# MOBILE ACTION CABLES. DO NOT USE IT FOR 3G DEVICES! ++ ++SUBSYSTEM=="usb", ATTR{bDeviceClass}=="00|ff", ATTR{bDeviceSubClass}=="00|ff", ENV{DEVTYPE}=="usb_device", GOTO="mobile_action_switch" ++GOTO="mobile_action_end" ++ ++LABEL="mobile_action_switch" ++ ++# Mobile Action cables like the 8280p and 8230p ++ATTRS{idVendor}=="0df7", ATTRS{idProduct}=="0800", RUN+="mobile-action-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t mobile-action-8280p" ++ ++LABEL="mobile_action_end" ++ +diff --git a/extras/mobile-action-modeswitch/ma8280p_us.c b/extras/mobile-action-modeswitch/ma8280p_us.c +new file mode 100644 +index 0000000..d7cf4f4 +--- /dev/null ++++ b/extras/mobile-action-modeswitch/ma8280p_us.c +@@ -0,0 +1,462 @@ ++/* http://www.natox.be/ma8280p/ ++ * http://www.leopold.dk/~martin/ma-8230p.html ++ * http://figvam.blogspot.com/2007/01/mobile-action-8730p-usb-cable-and-linux.html ++ */ ++ ++/* ++ * ++ * Code by davy hollevoet. This is simply an adaptation of code ++ * generated by usbsnoop2libusb. (http://iki.fi/lindi/usb/usbsnoop2libusb.pl) ++ * ++ * This code is released under both the GPL version 2 and BSD licenses. ++ * Either license may be used. ++ * ++ * GPLv2 ++ * ******** ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * In addition: ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * 3. The name of the author may not be used to endorse or promote ++ * products derived from this software without specific prior written ++ * permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, ++ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, ++ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING ++ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ++ * POSSIBILITY OF SUCH DAMAGE. ++ * ++ * BSD ++ * ****** ++ * Copyright (c) 1998, Regents of the University of California ++ * All rights reserved. ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are met: ++ * ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * * Neither the name of the University of California, Berkeley nor the ++ * names of its contributors may be used to endorse or promote products ++ * derived from this software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND ANY ++ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++ * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY ++ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ * ++ */ ++ ++/* This file is (mostly) generated with usbsnoop2libusb.pl from a usbsnoop log file. */ ++/* Latest version of the script should be in http://iki.fi/lindi/usb/usbsnoop2libusb.pl */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "utils.h" ++#include "ma8280p_us.h" ++ ++static void msleep(long msec) ++{ ++ struct timespec duration = { 0, msec * 1000 * 1000 }; ++ ++ nanosleep(&duration, NULL); ++} ++ ++int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev) ++{ ++ int ret = 1; ++ char *buf = NULL; ++ ++ buf = malloc (65535); ++ if (!buf) { ++ error ("%s: not enough memory", dev->filename, ret); ++ return -1; ++ } ++ ++ usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); ++ msleep(6); ++ usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); ++ msleep(6); ++ usb_get_descriptor(devh, 0x0000002, 0x0000000, buf, 0x0000400); ++ msleep(10); ++ ret = usb_release_interface(devh, 0); ++ if (ret != 0) ++ debug ("%s: failed to release interface before set_configuration: %d", dev->filename, ret); ++ usb_set_configuration(devh, 0x0000001); ++ ret = usb_claim_interface(devh, 0); ++ if (ret != 0) ++ debug ("%s: claim after set_configuration failed with error %d", dev->filename, ret); ++ //usb_set_altinterface(devh, 0); ++ //msleep(33); ++ usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE + USB_ENDPOINT_IN, 0x0000001, 0x0000300, 0x0000000, buf, 0x0000008, 1000); ++ msleep(5); ++ memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); ++ usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); ++ msleep(4); ++ memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); ++ usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); ++ msleep(4); ++ ++ msleep(4); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(6); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(1); ++ //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped ++ msleep(4); ++ memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); ++ usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); ++ msleep(3); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(1); ++ memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); ++ usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); ++ msleep(7); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(1); ++ memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); ++ usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); ++ msleep(7); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(2); ++ //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped ++ msleep(4); ++ memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); ++ usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); ++ msleep(2); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(1); ++ memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); ++ usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); ++ msleep(7); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(1); ++ memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); ++ usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); ++ msleep(7); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(8); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(1); ++ //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped ++ msleep(4); ++ memcpy(buf, "\x33\x04\xfe\x00\xf4\x6c\x1f\xf0", 0x0000008); ++ usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); ++ msleep(3); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ msleep(1); ++ //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped ++ msleep(4); ++ memcpy(buf, "\x32\x07\xfe\xf0\x29\xb9\x3a\xf0", 0x0000008); ++ usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); ++ msleep(3); ++ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); ++ ++ if (buf) ++ free (buf); ++ return 0; ++} +diff --git a/extras/mobile-action-modeswitch/ma8280p_us.h b/extras/mobile-action-modeswitch/ma8280p_us.h +new file mode 100644 +index 0000000..bf0e304 +--- /dev/null ++++ b/extras/mobile-action-modeswitch/ma8280p_us.h +@@ -0,0 +1,24 @@ ++/* ++ * Modem mode switcher ++ * ++ * Copyright (C) 2009 Dan Williams ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details: ++ */ ++ ++#ifndef __MA8280P_H__ ++#define __MA8280P_H__ ++ ++#include ++ ++int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev); ++ ++#endif /* __MA8280P_H__ */ +diff --git a/extras/mobile-action-modeswitch/mobile-action-modeswitch.c b/extras/mobile-action-modeswitch/mobile-action-modeswitch.c +new file mode 100644 +index 0000000..36d7d81 +--- /dev/null ++++ b/extras/mobile-action-modeswitch/mobile-action-modeswitch.c +@@ -0,0 +1,262 @@ ++/* ++ * Mobile action cable mode switcher ++ * ++ * Copyright (C) 2008 - 2010 Dan Williams ++ * Copyright (C) 2008 Peter Henn ++ * ++ * Heavily based on the 'ozerocdoff' tool by Peter Henn. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details: ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "utils.h" ++ ++#include "ma8280p_us.h" ++ ++struct usb_dev_handle *handle = NULL; ++ ++typedef struct usb_device * (*FindFunc) (int vid, int pid); ++typedef int (*SwitchFunc) (struct usb_dev_handle *dh, struct usb_device *dev); ++ ++typedef enum { ++ ST_UNKNOWN = 0, ++ ST_MA8280P ++} SwitchType; ++ ++typedef struct SwitchEntry { ++ SwitchType st; ++ const char *clopt; ++ FindFunc find_func; ++ SwitchFunc switch_func; ++} SwitchEntry; ++ ++static SwitchEntry switch_types[] = { ++ { ST_MA8280P, "mobile-action-8280p", NULL, ma8280p_switch }, ++ { ST_UNKNOWN, NULL, NULL } ++}; ++ ++static struct usb_device * ++generic_find (int vid, int pid) ++{ ++ struct usb_bus *bus; ++ struct usb_device *dev; ++ ++ for (bus = usb_get_busses(); bus; bus = bus->next) { ++ for (dev = bus->devices; dev; dev = dev->next) { ++ if (dev->descriptor.idVendor == vid && dev->descriptor.idProduct == pid) { ++ debug ("Found device '%s'", dev->filename); ++ return dev; ++ } ++ } ++ } ++ return NULL; ++} ++ ++static void ++release_usb_device (int param) ++{ ++ usb_release_interface (handle, 0); ++ usb_close (handle); ++} ++ ++static void ++print_usage (void) ++{ ++ printf ("Usage: mobile-action-modeswitch [-hdq] [-l ] -v -p -t \n" ++ " -h, --help show this help message\n" ++ " -v, --vendor target USB vendor ID\n" ++ " -p, --product target USB product ID\n" ++ " -t, --type type of switch to attempt, varies by device:\n" ++ " mobile-action-8280p - For Mobile Action 8xxxP USB cables\n" ++ " -l, --log log output to a file\n" ++ " -q, --quiet don't print anything to stdout\n" ++ " -d, --debug display debugging messages\n\n" ++ "Examples:\n" ++ " mobile-action-modeswitch -v 0x0df7 -p 0x8000 -t mobile-action-8280p\n"); ++} ++ ++static SwitchEntry * ++parse_type (const char *s) ++{ ++ SwitchEntry *entry = &switch_types[0]; ++ ++ while (entry->clopt) { ++ if (!strcmp (entry->clopt, s)) ++ return entry; ++ entry++; ++ } ++ ++ return NULL; ++} ++ ++static void ++do_exit (int val) ++{ ++ log_shutdown (); ++ exit (val); ++} ++ ++int main(int argc, char **argv) ++{ ++ static struct option options[] = { ++ { "help", no_argument, NULL, 'h' }, ++ { "vendor", required_argument, NULL, 'v' }, ++ { "product", required_argument, NULL, 'p' }, ++ { "type", required_argument, NULL, 't' }, ++ { "log", required_argument, NULL, 'l' }, ++ { "debug", no_argument, NULL, 'd' }, ++ { "quiet", no_argument, NULL, 'q' }, ++ { NULL, 0, NULL, 0} ++ }; ++ ++ struct usb_device *dev; ++ int vid = 0, pid = 0; ++ const char *logpath = NULL; ++ char buffer[256]; ++ int ret, quiet = 0, debug = 0; ++ SwitchEntry *sentry = NULL; ++ ++ while (1) { ++ int option; ++ ++ option = getopt_long(argc, argv, "hv:p:l:t:dq", options, NULL); ++ if (option == -1) ++ break; ++ ++ switch (option) { ++ case 'v': ++ vid = strtol (optarg, NULL, 0); ++ break; ++ case 'p': ++ pid = strtol (optarg, NULL, 0); ++ break; ++ case 't': ++ sentry = parse_type (optarg); ++ if (!sentry) { ++ error ("unknown switch type '%s'", optarg); ++ print_usage (); ++ exit (1); ++ } ++ break; ++ case 'l': ++ logpath = optarg; ++ break; ++ case 'q': ++ quiet = 1; ++ break; ++ case 'd': ++ debug = 1; ++ break; ++ case 'h': ++ default: ++ print_usage (); ++ exit (1); ++ } ++ } ++ ++ if (log_startup (logpath, debug, quiet)) { ++ fprintf (stderr, "Couldn't open/create logfile %s", logpath); ++ exit (2); ++ } ++ ++ if (!sentry) { ++ if (!quiet) ++ print_usage (); ++ else ++ error ("missing device switch type."); ++ do_exit (3); ++ } ++ ++ if (!vid || !pid) { ++ if (!quiet) ++ print_usage (); ++ else ++ error ("missing vendor and device IDs."); ++ do_exit (3); ++ } ++ ++ usb_init(); ++ ++ if (usb_find_busses() < 0) { ++ error ("no USB busses found."); ++ do_exit (4); ++ } ++ ++ if (usb_find_devices() < 0) { ++ error ("no USB devices found."); ++ do_exit (4); ++ } ++ ++ if (sentry->find_func) ++ dev = (*sentry->find_func) (vid, pid); ++ else ++ dev = generic_find (vid, pid); ++ if (dev == NULL) { ++ error ("no device found."); ++ do_exit (5); ++ } ++ ++ handle = usb_open (dev); ++ if (handle == NULL) { ++ error ("%s: could not access the device.", ++ dev->filename); ++ do_exit (6); ++ } ++ ++ /* detach running default driver */ ++ signal (SIGTERM, release_usb_device); ++ ret = usb_get_driver_np (handle, 0, buffer, sizeof (buffer)); ++ if (ret == 0) { ++ debug ("%s: found already attached driver '%s'", dev->filename, buffer); ++ ++ ret = usb_detach_kernel_driver_np (handle, 0); ++ if (ret != 0) { ++ debug ("%s: error: unable to detach current driver.", dev->filename); ++ usb_close (handle); ++ do_exit (7); ++ } ++ } ++ ++ ret = usb_claim_interface (handle, 0); ++ if (ret != 0) { ++ debug ("%s: couldn't claim device's USB interface: %d.", ++ dev->filename, ret); ++ usb_close (handle); ++ do_exit (8); ++ } ++ ++ ret = (*sentry->switch_func) (handle, dev); ++ if (ret < 0) { ++ debug ("%s: failed to switch device to serial mode.", dev->filename); ++ usb_release_interface (handle, 0); ++ usb_close (handle); ++ do_exit(9); ++ } ++ ++ usb_release_interface (handle, 0); ++ ++ ret = usb_close (handle); ++ if (ret < 0) ++ debug ("%s: failed to close the device.", dev->filename); ++ ++ do_exit (0); ++ return 0; ++} +diff --git a/extras/mobile-action-modeswitch/utils.c b/extras/mobile-action-modeswitch/utils.c +new file mode 100644 +index 0000000..37d0df4 +--- /dev/null ++++ b/extras/mobile-action-modeswitch/utils.c +@@ -0,0 +1,83 @@ ++/* ++ * Modem mode switcher ++ * ++ * Copyright (C) 2009 Dan Williams ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details: ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "utils.h" ++ ++static int debug_on = 0; ++static int quiet = 0; ++FILE *logfile = NULL; ++ ++void ++do_log (int level, const char *fmt, ...) ++{ ++ va_list args; ++ char buffer[1024]; ++ char tag = 'L'; ++ ++ if (level >= LOG_DBG && !debug_on) ++ return; ++ ++ va_start (args, fmt); ++ vsnprintf (buffer, sizeof (buffer), fmt, args); ++ va_end (args); ++ ++ if (level == LOG_ERR) ++ tag = 'E'; ++ else if (level == LOG_MSG) ++ tag = 'L'; ++ else if (level == LOG_DBG) ++ tag = 'D'; ++ ++ if (logfile) ++ fprintf (logfile, "%c: %s\n", tag, buffer); ++ if (!quiet) ++ fprintf ((level == LOG_ERR) ? stderr : stdout, "%c: %s\n", tag, buffer); ++} ++ ++int ++log_startup (const char *path, int do_debug, int be_quiet) ++{ ++ time_t t; ++ ++ quiet = be_quiet; ++ debug_on = do_debug; ++ ++ if (!path) ++ return 0; ++ ++ logfile = fopen (path, "a+"); ++ if (!logfile) ++ return 1; ++ ++ t = time (NULL); ++ message ("\n**** Started: %s\n", ctime (&t)); ++ return 0; ++} ++ ++void ++log_shutdown (void) ++{ ++ if (logfile) ++ fclose (logfile); ++} ++ +diff --git a/extras/mobile-action-modeswitch/utils.h b/extras/mobile-action-modeswitch/utils.h +new file mode 100644 +index 0000000..1ef557a +--- /dev/null ++++ b/extras/mobile-action-modeswitch/utils.h +@@ -0,0 +1,32 @@ ++/* ++ * Modem mode switcher ++ * ++ * Copyright (C) 2009 Dan Williams ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details: ++ */ ++ ++#ifndef __UTILS_H__ ++#define __UTILS_H__ ++ ++#define LOG_ERR 0 ++#define LOG_MSG 1 ++#define LOG_DBG 2 ++ ++#define message(fmt, args...) do_log (LOG_MSG, fmt, ##args); ++#define error(fmt, args...) do_log (LOG_ERR, fmt, ##args); ++#define debug(fmt, args...) do_log (LOG_DBG, fmt, ##args); ++ ++void do_log (int level, const char *fmt, ...); ++int log_startup (const char *path, int do_debug, int be_quiet); ++void log_shutdown (void); ++ ++#endif /* __UTILS_H__ */ +diff --git a/extras/modem-modeswitch/61-mobile-action.rules b/extras/modem-modeswitch/61-mobile-action.rules +deleted file mode 100644 +index 29d460d..0000000 +--- a/extras/modem-modeswitch/61-mobile-action.rules ++++ /dev/null +@@ -1,15 +0,0 @@ +-ACTION!="add", GOTO="mobile_action_end" +- +-SUBSYSTEM=="usb", ATTR{bDeviceClass}=="00|ff", ATTR{bDeviceSubClass}=="00|ff", ENV{DEVTYPE}=="usb_device", GOTO="mobile_action_switch" +-GOTO="mobile_action_end" +- +-LABEL="mobile_action_switch" +-ATTRS{idVendor}=="0df7", ATTRS{idProduct}=="0800", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t mobile-action-8280p" +- +-LABEL="mobile_action_end" +- +-# modem-modeswitch does not work with these devices, the fake CD-ROM needs to be ejected +- +-# ZTE MF6xx +-ACTION=="add", ENV{ID_CDROM}=="1", ENV{ID_VENDOR_ID}=="19d2", ENV{ID_MODEL_ID}=="2000", RUN+="/usr/bin/eject %k" +- +diff --git a/extras/modem-modeswitch/61-option-modem-modeswitch.rules b/extras/modem-modeswitch/61-option-modem-modeswitch.rules +deleted file mode 100644 +index 053733e..0000000 +--- a/extras/modem-modeswitch/61-option-modem-modeswitch.rules ++++ /dev/null +@@ -1,44 +0,0 @@ +-# NOTE: only for devices manufactured by Option NV +-# DO NOT add devices that are not manufactured by Option NV +- +-ACTION!="add", GOTO="option_zerocd_end" +- +-SUBSYSTEM=="usb", ATTR{bDeviceClass}!="ff", ENV{DEVTYPE}=="usb_device", GOTO="option_zerocd_disable" +-SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", GOTO="option_zerocd_disable" +-GOTO="option_zerocd_end" +- +-LABEL="option_zerocd_disable" +-ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="1000", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6711", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6711", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6731", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6751", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6771", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6791", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6811", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6911", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6951", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6971", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7011", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7031", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7051", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7071", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7111", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7211", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7251", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7271", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7311", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="c031", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="d031", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="d033", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7301", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7361", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7401", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7501", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7601", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +-ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7901", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +- +-# NOTE: only for devices manufactured by Option NV +-# DO NOT add devices that are not manufactured by Option NV +- +-LABEL="option_zerocd_end" +diff --git a/extras/modem-modeswitch/ma8280p_us.c b/extras/modem-modeswitch/ma8280p_us.c +deleted file mode 100644 +index d7cf4f4..0000000 +--- a/extras/modem-modeswitch/ma8280p_us.c ++++ /dev/null +@@ -1,462 +0,0 @@ +-/* http://www.natox.be/ma8280p/ +- * http://www.leopold.dk/~martin/ma-8230p.html +- * http://figvam.blogspot.com/2007/01/mobile-action-8730p-usb-cable-and-linux.html +- */ +- +-/* +- * +- * Code by davy hollevoet. This is simply an adaptation of code +- * generated by usbsnoop2libusb. (http://iki.fi/lindi/usb/usbsnoop2libusb.pl) +- * +- * This code is released under both the GPL version 2 and BSD licenses. +- * Either license may be used. +- * +- * GPLv2 +- * ******** +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version 2 +- * of the License, or (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * In addition: +- * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions +- * are met: +- * +- * 1. Redistributions of source code must retain the above copyright +- * notice, this list of conditions and the following disclaimer. +- * 2. Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in the +- * documentation and/or other materials provided with the distribution. +- * 3. The name of the author may not be used to endorse or promote +- * products derived from this software without specific prior written +- * permission. +- * +- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +- * POSSIBILITY OF SUCH DAMAGE. +- * +- * BSD +- * ****** +- * Copyright (c) 1998, Regents of the University of California +- * All rights reserved. +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions are met: +- * +- * * Redistributions of source code must retain the above copyright +- * notice, this list of conditions and the following disclaimer. +- * * Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in the +- * documentation and/or other materials provided with the distribution. +- * * Neither the name of the University of California, Berkeley nor the +- * names of its contributors may be used to endorse or promote products +- * derived from this software without specific prior written permission. +- * +- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND ANY +- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY +- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- * +- */ +- +-/* This file is (mostly) generated with usbsnoop2libusb.pl from a usbsnoop log file. */ +-/* Latest version of the script should be in http://iki.fi/lindi/usb/usbsnoop2libusb.pl */ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include "utils.h" +-#include "ma8280p_us.h" +- +-static void msleep(long msec) +-{ +- struct timespec duration = { 0, msec * 1000 * 1000 }; +- +- nanosleep(&duration, NULL); +-} +- +-int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev) +-{ +- int ret = 1; +- char *buf = NULL; +- +- buf = malloc (65535); +- if (!buf) { +- error ("%s: not enough memory", dev->filename, ret); +- return -1; +- } +- +- usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); +- msleep(6); +- usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); +- msleep(6); +- usb_get_descriptor(devh, 0x0000002, 0x0000000, buf, 0x0000400); +- msleep(10); +- ret = usb_release_interface(devh, 0); +- if (ret != 0) +- debug ("%s: failed to release interface before set_configuration: %d", dev->filename, ret); +- usb_set_configuration(devh, 0x0000001); +- ret = usb_claim_interface(devh, 0); +- if (ret != 0) +- debug ("%s: claim after set_configuration failed with error %d", dev->filename, ret); +- //usb_set_altinterface(devh, 0); +- //msleep(33); +- usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE + USB_ENDPOINT_IN, 0x0000001, 0x0000300, 0x0000000, buf, 0x0000008, 1000); +- msleep(5); +- memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); +- usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); +- msleep(4); +- memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); +- usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); +- msleep(4); +- +- msleep(4); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(6); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(1); +- //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped +- msleep(4); +- memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); +- usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); +- msleep(3); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(1); +- memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); +- usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); +- msleep(7); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(1); +- memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); +- usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); +- msleep(7); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(2); +- //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped +- msleep(4); +- memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); +- usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); +- msleep(2); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(1); +- memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); +- usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); +- msleep(7); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(1); +- memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); +- usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); +- msleep(7); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(8); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(1); +- //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped +- msleep(4); +- memcpy(buf, "\x33\x04\xfe\x00\xf4\x6c\x1f\xf0", 0x0000008); +- usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); +- msleep(3); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- msleep(1); +- //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped +- msleep(4); +- memcpy(buf, "\x32\x07\xfe\xf0\x29\xb9\x3a\xf0", 0x0000008); +- usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); +- msleep(3); +- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); +- +- if (buf) +- free (buf); +- return 0; +-} +diff --git a/extras/modem-modeswitch/ma8280p_us.h b/extras/modem-modeswitch/ma8280p_us.h +deleted file mode 100644 +index bf0e304..0000000 +--- a/extras/modem-modeswitch/ma8280p_us.h ++++ /dev/null +@@ -1,24 +0,0 @@ +-/* +- * Modem mode switcher +- * +- * Copyright (C) 2009 Dan Williams +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details: +- */ +- +-#ifndef __MA8280P_H__ +-#define __MA8280P_H__ +- +-#include +- +-int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev); +- +-#endif /* __MA8280P_H__ */ +diff --git a/extras/modem-modeswitch/modem-modeswitch.c b/extras/modem-modeswitch/modem-modeswitch.c +deleted file mode 100644 +index a60ce7a..0000000 +--- a/extras/modem-modeswitch/modem-modeswitch.c ++++ /dev/null +@@ -1,266 +0,0 @@ +-/* +- * Modem mode switcher +- * +- * Copyright (C) 2008 Dan Williams +- * Copyright (C) 2008 Peter Henn +- * +- * Heavily based on the 'ozerocdoff' tool by Peter Henn. +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details: +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-#include "utils.h" +- +-#include "ma8280p_us.h" +-#include "option.h" +- +-struct usb_dev_handle *handle = NULL; +- +-typedef struct usb_device * (*FindFunc) (int vid, int pid); +-typedef int (*SwitchFunc) (struct usb_dev_handle *dh, struct usb_device *dev); +- +-typedef enum { +- ST_UNKNOWN = 0, +- ST_OPTION_ZEROCD, +- ST_MA8280P +-} SwitchType; +- +-typedef struct SwitchEntry { +- SwitchType st; +- const char *clopt; +- FindFunc find_func; +- SwitchFunc switch_func; +-} SwitchEntry; +- +-static SwitchEntry switch_types[] = { +- { ST_OPTION_ZEROCD, "option-zerocd", option_zerocd_find, option_zerocd_switch }, +- { ST_MA8280P, "mobile-action-8280p", NULL, ma8280p_switch }, +- { ST_UNKNOWN, NULL, NULL } +-}; +- +-static struct usb_device * +-generic_find (int vid, int pid) +-{ +- struct usb_bus *bus; +- struct usb_device *dev; +- +- for (bus = usb_get_busses(); bus; bus = bus->next) { +- for (dev = bus->devices; dev; dev = dev->next) { +- if (dev->descriptor.idVendor == vid && dev->descriptor.idProduct == pid) { +- debug ("Found device '%s'", dev->filename); +- return dev; +- } +- } +- } +- return NULL; +-} +- +-static void +-release_usb_device (int param) +-{ +- usb_release_interface (handle, 0); +- usb_close (handle); +-} +- +-static void +-print_usage (void) +-{ +- printf ("Usage: modem-modeswitch [-hdq] [-l ] -v -p -t \n" +- " -h, --help show this help message\n" +- " -v, --vendor target USB vendor ID\n" +- " -p, --product target USB product ID\n" +- " -t, --type type of switch to attempt, varies by device:\n" +- " option-zerocd - For many newer Option N.V. devices\n" +- " mobile-action-8280p - For Mobile Action 8xxxP USB cables\n" +- " -l, --log log output to a file\n" +- " -q, --quiet don't print anything to stdout\n" +- " -d, --debug display debugging messages\n\n" +- "Examples:\n" +- " modem-modeswitch -v 0x0af0 -p 0xc031 -t option-zerocd\n"); +-} +- +-static SwitchEntry * +-parse_type (const char *s) +-{ +- SwitchEntry *entry = &switch_types[0]; +- +- while (entry->clopt) { +- if (!strcmp (entry->clopt, s)) +- return entry; +- entry++; +- } +- +- return NULL; +-} +- +-static void +-do_exit (int val) +-{ +- log_shutdown (); +- exit (val); +-} +- +-int main(int argc, char **argv) +-{ +- static struct option options[] = { +- { "help", no_argument, NULL, 'h' }, +- { "vendor", required_argument, NULL, 'v' }, +- { "product", required_argument, NULL, 'p' }, +- { "type", required_argument, NULL, 't' }, +- { "log", required_argument, NULL, 'l' }, +- { "debug", no_argument, NULL, 'd' }, +- { "quiet", no_argument, NULL, 'q' }, +- { NULL, 0, NULL, 0} +- }; +- +- struct usb_device *dev; +- int vid = 0, pid = 0; +- const char *logpath = NULL; +- char buffer[256]; +- int ret, quiet = 0, debug = 0; +- SwitchEntry *sentry = NULL; +- +- while (1) { +- int option; +- +- option = getopt_long(argc, argv, "hv:p:l:t:dq", options, NULL); +- if (option == -1) +- break; +- +- switch (option) { +- case 'v': +- vid = strtol (optarg, NULL, 0); +- break; +- case 'p': +- pid = strtol (optarg, NULL, 0); +- break; +- case 't': +- sentry = parse_type (optarg); +- if (!sentry) { +- error ("unknown switch type '%s'", optarg); +- print_usage (); +- exit (1); +- } +- break; +- case 'l': +- logpath = optarg; +- break; +- case 'q': +- quiet = 1; +- break; +- case 'd': +- debug = 1; +- break; +- case 'h': +- default: +- print_usage (); +- exit (1); +- } +- } +- +- if (log_startup (logpath, debug, quiet)) { +- fprintf (stderr, "Couldn't open/create logfile %s", logpath); +- exit (2); +- } +- +- if (!sentry) { +- if (!quiet) +- print_usage (); +- else +- error ("missing device switch type."); +- do_exit (3); +- } +- +- if (!vid || !pid) { +- if (!quiet) +- print_usage (); +- else +- error ("missing vendor and device IDs."); +- do_exit (3); +- } +- +- usb_init(); +- +- if (usb_find_busses() < 0) { +- error ("no USB busses found."); +- do_exit (4); +- } +- +- if (usb_find_devices() < 0) { +- error ("no USB devices found."); +- do_exit (4); +- } +- +- if (sentry->find_func) +- dev = (*sentry->find_func) (vid, pid); +- else +- dev = generic_find (vid, pid); +- if (dev == NULL) { +- error ("no device found."); +- do_exit (5); +- } +- +- handle = usb_open (dev); +- if (handle == NULL) { +- error ("%s: could not access the device.", +- dev->filename); +- do_exit (6); +- } +- +- /* detach running default driver */ +- signal (SIGTERM, release_usb_device); +- ret = usb_get_driver_np (handle, 0, buffer, sizeof (buffer)); +- if (ret == 0) { +- debug ("%s: found already attached driver '%s'", dev->filename, buffer); +- +- ret = usb_detach_kernel_driver_np (handle, 0); +- if (ret != 0) { +- debug ("%s: error: unable to detach current driver.", dev->filename); +- usb_close (handle); +- do_exit (7); +- } +- } +- +- ret = usb_claim_interface (handle, 0); +- if (ret != 0) { +- debug ("%s: couldn't claim device's USB interface: %d.", +- dev->filename, ret); +- usb_close (handle); +- do_exit (8); +- } +- +- ret = (*sentry->switch_func) (handle, dev); +- if (ret < 0) { +- debug ("%s: failed to switch device to modem mode.", dev->filename); +- usb_release_interface (handle, 0); +- usb_close (handle); +- do_exit(9); +- } +- +- usb_release_interface (handle, 0); +- +- ret = usb_close (handle); +- if (ret < 0) +- debug ("%s: failed to close the device.", dev->filename); +- +- do_exit (0); +- return 0; +-} +diff --git a/extras/modem-modeswitch/option.c b/extras/modem-modeswitch/option.c +deleted file mode 100644 +index 5b299fd..0000000 +--- a/extras/modem-modeswitch/option.c ++++ /dev/null +@@ -1,131 +0,0 @@ +-/* +- * Modem mode switcher +- * +- * Copyright (C) 2008 Dan Williams +- * Copyright (C) 2008 Peter Henn +- * +- * Heavily based on the 'ozerocdoff' tool by Peter Henn. +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details: +- */ +- +-#include +- +-#include "utils.h" +-#include "option.h" +- +-/* Borrowed from /usr/include/linux/usb/ch9.h */ +-#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */ +-#define USB_ENDPOINT_XFER_BULK 2 +-#define USB_ENDPOINT_DIR_MASK 0x80 +-#define USB_DIR_OUT 0 /* to device */ +-#define USB_DIR_IN 0x80 /* to host */ +- +-struct usb_device * +-option_zerocd_find (int vid, int pid) +-{ +- struct usb_bus *bus; +- struct usb_device *dev; +- +- for (bus = usb_get_busses(); bus; bus = bus->next) { +- for (dev = bus->devices; dev; dev = dev->next) { +- if (dev->descriptor.idVendor == vid && dev->descriptor.idProduct == pid) { +- debug ("Found mass storage device:"); +- debug (" Endpoints: %d", dev->config[0].interface[0].altsetting[0].bNumEndpoints); +- debug (" Class: 0x%X", dev->config[0].interface[0].altsetting[0].bInterfaceClass); +- debug (" SubClass: 0x%X", dev->config[0].interface[0].altsetting[0].bInterfaceSubClass); +- debug (" Protocol: 0x%X", dev->config[0].interface[0].altsetting[0].bInterfaceProtocol); +- +- if ( (dev->config[0].interface[0].altsetting[0].bNumEndpoints == 2) +- && (dev->config[0].interface[0].altsetting[0].bInterfaceClass == 0x08) +- && (dev->config[0].interface[0].altsetting[0].bInterfaceSubClass == 0x06) +- && (dev->config[0].interface[0].altsetting[0].bInterfaceProtocol == 0x50) ) { +- debug ("Found modem mass storage device '%s'", dev->filename); +- return dev; +- } +- } +- } +- } +- return NULL; +-} +- +-static int +-find_endpoints (struct usb_device *dev, int *in_ep, int *out_ep) +-{ +- int i; +- +- for (i = 0; i < dev->config[0].interface[0].altsetting[0].bNumEndpoints; i++) { +- struct usb_endpoint_descriptor *ep = &(dev->config[0].interface[0].altsetting[0].endpoint[i]); +- +- if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK) { +- unsigned int direction = ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK; +- +- if (!*out_ep && (direction == USB_DIR_OUT)) +- *out_ep = ep->bEndpointAddress; +- else if (!*in_ep && (direction == USB_DIR_IN)) +- *in_ep = ep->bEndpointAddress; +- } +- +- if (*in_ep && *out_ep) +- return 0; +- } +- +- return -1; +-} +- +-int +-option_zerocd_switch (struct usb_dev_handle *dh, struct usb_device *dev) +-{ +- const char const rezero_cbw[] = { +- 0x55, 0x53, 0x42, 0x43, /* bulk command signature (LE) */ +- 0x78, 0x56, 0x34, 0x12, /* bulk command host tag */ +- 0x01, 0x00, 0x00, 0x00, /* bulk command data transfer length (LE) */ +- 0x80, /* flags: direction data-in */ +- 0x00, /* LUN */ +- 0x06, /* SCSI command length */ +- 0x01, /* SCSI command: REZERO */ +- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* filler */ +- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +- }; +- +- int ret = -1, ep_in = 0, ep_out = 0; +- char buffer[256]; +- +- /* Find the device's bulk in and out endpoints */ +- if (find_endpoints (dev, &ep_in, &ep_out) < 0) { +- debug ("%s: couldn't find correct USB endpoints.", dev->filename); +- goto out; +- } +- +- usb_clear_halt (dh, ep_out); +- ret = usb_set_altinterface (dh, 0); +- if (ret != 0) { +- debug ("%s: couldn't set device alternate interface.", dev->filename); +- goto out; +- } +- +- /* Let the mass storage device settle */ +- sleep (1); +- +- /* Send the modeswitch command */ +- ret = usb_bulk_write (dh, ep_out, (char *) rezero_cbw, sizeof (rezero_cbw), 1000); +- if (ret < 0) +- return ret; +- +- debug ("%s: REZERO command sent.", dev->filename); +- +- /* Some devices need to be read from */ +- ret = usb_bulk_read (dh, ep_in, buffer, sizeof (buffer), 1000); +- +-out: +- return ret; +-} +- +diff --git a/extras/modem-modeswitch/option.h b/extras/modem-modeswitch/option.h +deleted file mode 100644 +index e00dabf..0000000 +--- a/extras/modem-modeswitch/option.h ++++ /dev/null +@@ -1,29 +0,0 @@ +-/* +- * Modem mode switcher +- * +- * Copyright (C) 2008 Dan Williams +- * Copyright (C) 2008 Peter Henn +- * +- * Heavily based on the 'ozerocdoff' tool by Peter Henn. +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details: +- */ +- +-#ifndef __OPTION_H__ +-#define __OPTION_H__ +- +-#include +- +-struct usb_device *option_zerocd_find (int vid, int pid); +- +-int option_zerocd_switch (struct usb_dev_handle *dh, struct usb_device *dev); +- +-#endif /* __OPTION_H__ */ +diff --git a/extras/modem-modeswitch/utils.c b/extras/modem-modeswitch/utils.c +deleted file mode 100644 +index 37d0df4..0000000 +--- a/extras/modem-modeswitch/utils.c ++++ /dev/null +@@ -1,83 +0,0 @@ +-/* +- * Modem mode switcher +- * +- * Copyright (C) 2009 Dan Williams +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details: +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include "utils.h" +- +-static int debug_on = 0; +-static int quiet = 0; +-FILE *logfile = NULL; +- +-void +-do_log (int level, const char *fmt, ...) +-{ +- va_list args; +- char buffer[1024]; +- char tag = 'L'; +- +- if (level >= LOG_DBG && !debug_on) +- return; +- +- va_start (args, fmt); +- vsnprintf (buffer, sizeof (buffer), fmt, args); +- va_end (args); +- +- if (level == LOG_ERR) +- tag = 'E'; +- else if (level == LOG_MSG) +- tag = 'L'; +- else if (level == LOG_DBG) +- tag = 'D'; +- +- if (logfile) +- fprintf (logfile, "%c: %s\n", tag, buffer); +- if (!quiet) +- fprintf ((level == LOG_ERR) ? stderr : stdout, "%c: %s\n", tag, buffer); +-} +- +-int +-log_startup (const char *path, int do_debug, int be_quiet) +-{ +- time_t t; +- +- quiet = be_quiet; +- debug_on = do_debug; +- +- if (!path) +- return 0; +- +- logfile = fopen (path, "a+"); +- if (!logfile) +- return 1; +- +- t = time (NULL); +- message ("\n**** Started: %s\n", ctime (&t)); +- return 0; +-} +- +-void +-log_shutdown (void) +-{ +- if (logfile) +- fclose (logfile); +-} +- +diff --git a/extras/modem-modeswitch/utils.h b/extras/modem-modeswitch/utils.h +deleted file mode 100644 +index 1ef557a..0000000 +--- a/extras/modem-modeswitch/utils.h ++++ /dev/null +@@ -1,32 +0,0 @@ +-/* +- * Modem mode switcher +- * +- * Copyright (C) 2009 Dan Williams +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details: +- */ +- +-#ifndef __UTILS_H__ +-#define __UTILS_H__ +- +-#define LOG_ERR 0 +-#define LOG_MSG 1 +-#define LOG_DBG 2 +- +-#define message(fmt, args...) do_log (LOG_MSG, fmt, ##args); +-#define error(fmt, args...) do_log (LOG_ERR, fmt, ##args); +-#define debug(fmt, args...) do_log (LOG_DBG, fmt, ##args); +- +-void do_log (int level, const char *fmt, ...); +-int log_startup (const char *path, int do_debug, int be_quiet); +-void log_shutdown (void); +- +-#endif /* __UTILS_H__ */ +-- +1.6.6 + diff --git a/start_udev b/start_udev index 57801aa..0da55f4 100755 --- a/start_udev +++ b/start_udev @@ -56,7 +56,13 @@ if [ -n "$selinuxfs" ] && [ "`cat /proc/self/attr/current`" != "kernel" ]; then fi fi - +touch_recursive() { + ( cd $1; + for i in *; do + [[ -c "$i" || -b "$i" ]] && touch "$i" + [ -d "$i" ] && touch_recursive "$i" + done ) +} xargs_simple () { if [ "$1" = "-n" ]; then @@ -94,10 +100,11 @@ make_extra_nodes () { [ -d $udev_root/pts ] || mkdir -m 0755 $udev_root/pts [ -d $udev_root/shm ] || mkdir -m 0755 $udev_root/shm + [ -d $udev_root/hugepages ] || mkdir -m 0755 $udev_root/hugepages [ -a /dev/MAKEDEV ] || ln -s $MAKEDEV /dev/MAKEDEV; USE_MD5="false" - [ -x /usr/bin/md5sum -a "$UDEV_USE_MAKEDEV_CACHE" == "yes" ] && USE_MD5="true" + [[ "$UDEV_USE_MAKEDEV_CACHE" == "yes" && -x /usr/bin/md5sum ]] && USE_MD5="true" for i in 0 1 2 3 4 5 6 7; do [ -b /dev/loop$i ] || /bin/mknod -m 0640 /dev/loop$i b 7 $i @@ -157,9 +164,11 @@ make_extra_nodes () { if [ "$1" != "*" ]; then #echo "Warning: $devdir is deprecated. Please use /etc/udev/makedev.d/." cp -ar "$@" $udev_root/ - pushd "$udev_root" &> "$udev_root/null" - [ -x /sbin/restorecon ] && /sbin/restorecon "$@" - popd &> "$udev_root/null" + if [ -x /sbin/restorecon ]; then + pushd "$udev_root" &> "$udev_root/null" + /sbin/restorecon "$@" + popd &> "$udev_root/null" + fi fi popd &> "$udev_root/null" done @@ -224,11 +233,11 @@ echo -n "$STRING" # mount the tmpfs on ${udev_root%/}, if not already done LANG=C awk "\$2 == \"${udev_root%/}\" && ( \$3 == \"devtmpfs\" || \$3 == \"tmpfs\" ) { exit 1 }" /proc/mounts && { - if LANG=C fgrep -q "none ${udev_root%/}/pts " /proc/mounts; then + if LANG=C grep -Fq "none ${udev_root%/}/pts " /proc/mounts; then PTSDIR=$(mktemp -d) mount --move $udev_root/pts "$PTSDIR" fi - if LANG=C fgrep -q "none ${udev_root%/}/shm " /proc/mounts; then + if LANG=C grep -Fq "none ${udev_root%/}/shm " /proc/mounts; then SHMDIR=$(mktemp -d) mount --move $udev_root/shm "$SHMDIR" fi @@ -250,7 +259,6 @@ LANG=C awk "\$2 == \"${udev_root%/}\" && ( \$3 == \"devtmpfs\" || \$3 == \"tmpfs } make_extra_nodes -cmdline=$(cat /proc/cmdline) kill_udevd > "$udev_root/null" 2>&1 rm -fr $udev_root/.udev > "$udev_root/null" 2>&1 mkdir -p $udev_root/.udev > "$udev_root/null" 2>&1 @@ -259,6 +267,8 @@ if [ -f "/sys/class/tty/console/uevent" ]; then # trigger the sorted events echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug + cmdline=$(cat /proc/cmdline) + if strstr "$cmdline" udevtrace; then UDEV_OPTS="$UDEV_OPTS --debug-trace" fi @@ -307,6 +317,10 @@ if [ -f "/sys/class/tty/console/uevent" ]; then ret=$[$ret + $?] wait /sbin/udevadm control --env=STARTUP= + # touch all device files for timezone glitches + # "find" is in /usr/bin and might not be available + touch_recursive /dev > "$udev_root/null" 2>&1 + else echo -n " kernel too old for this udev version " /sbin/udevd -d $UDEV_OPTS diff --git a/udev-151-virtio.patch b/udev-151-virtio.patch new file mode 100644 index 0000000..d1a7644 --- /dev/null +++ b/udev-151-virtio.patch @@ -0,0 +1,30 @@ +From 764304885705e51ef3eb1d078eed3cf6604c4684 Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 26 Feb 2010 14:02:51 +0530 +Subject: [PATCH] Fix virtio-ports rule to use $attr instead of $ATTR + +Newer udev versions don't understand $ATTR. + +Signed-off-by: Amit Shah +--- + rules/rules.d/50-udev-default.rules | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +Changed by Harald Hoyer + +diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules +index f8556d1..da1535f 100644 +--- a/rules/rules.d/50-udev-default.rules ++++ b/rules/rules.d/50-udev-default.rules +@@ -18,7 +18,7 @@ KERNEL=="mwave", GROUP="dialout" + KERNEL=="hvc*|hvsi*", GROUP="dialout" + + # virtio serial / console ports +-KERNEL=="vport*", SYMLINK+="virtio-ports/$attr{name}" ++KERNEL=="vport*", ATTRS{name}=="?*", SYMLINK+="virtio-ports/$attr{name}" + + # mem + KERNEL=="null|zero|full|random|urandom", MODE="0666" +-- +1.6.2.5 + diff --git a/udev-post.init b/udev-post.init index f040950..67ed0c9 100644 --- a/udev-post.init +++ b/udev-post.init @@ -58,8 +58,8 @@ case "$1" in STRING=$"Generating udev makedev cache file" MAKEDEV="/sbin/MAKEDEV" USE_MD5="false" - [ -x /usr/bin/md5sum -a "$UDEV_USE_MAKEDEV_CACHE" == "yes" ] && USE_MD5="true" - if [ "$USE_MD5" == "true" -a -x "$MAKEDEV" ]; then + [[ "$UDEV_USE_MAKEDEV_CACHE" == "yes" && -x /usr/bin/md5sum ]] && USE_MD5="true" + if [[ "$USE_MD5" == "true" && -x "$MAKEDEV" ]]; then for i in /etc/udev/makedev.d/*.nodes; do if [ -f "$i" ]; then # use a little caching to speedup things diff --git a/udev.spec b/udev.spec index edce2f8..2684220 100644 --- a/udev.spec +++ b/udev.spec @@ -5,7 +5,7 @@ Summary: A userspace implementation of devfs Name: udev Version: 151 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2 Group: System Environment/Base Provides: udev-persistent = %{version}-%{release} @@ -13,8 +13,32 @@ Obsoletes: udev-persistent < 0:030-5 Obsoletes: udev-extras < 20090618 Provides: udev-extras = 20090618-1 Source: ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/%{name}-%{version}.tar.bz2 -Patch1: udev-151-rules.patch -Patch2: udev-86a7a2f-fix-missing-firmware.patch +Patch1: 0001-firmware-fix-error-reporting-on-missing-firmware-fil.patch +Patch2: 0002-keymap-Add-Dell-Inspiron-1011-Mini-10.patch +Patch3: 0003-Fix-brightness-keys-on-MSI-Wind-U-100.patch +Patch4: 0004-keymap-Add-support-for-Gateway-AOA110-AOA150-clones.patch +Patch5: 0005-keymap-Fix-LG-X110.patch +Patch6: 0006-Force-key-release-for-volume-keys-on-Dell-Studio-155.patch +Patch7: 0007-keymap-Add-Toshiba-Satellite-M30X.patch +Patch13: 0013-keymap-Add-Samsung-Q210-P210-force-release-quirk.patch +Patch14: 0014-keymap-Add-Fujitsu-Amilo-1848-u-force-release-quirk.patch +Patch15: 0015-Decrease-buffer-size-when-advancing-past-NUL-byte.patch +Patch16: 0016-Use-UTIL_LINE_SIZE-not-UTIL_PATH_SIZE-to-truncate-pr.patch +Patch17: 0017-Increase-UTIL_LINE_SIZE-from-2048-to-16384.patch +Patch18: 0018-Fix-virtio-ports-rule-to-use-attr-instead-of-ATTR.patch +Patch19: 0019-udev-acl-Correctly-handle-ENV-ACL_MANAGE-0.patch +Patch21: 0021-input_id-Fix-linking.patch +Patch22: 0022-replace-utimes-with-utimensat.patch +Patch29: 0029-firmware-fix-possible-segfault-when-firmware-device-.patch +Patch30: 0030-rules-input-create-by-path-links-for-pci-devices.patch +Patch31: 0031-Fix-switching-Logitech-bluetooth-adapters-into-hci-m.patch +Patch32: 0032-do-not-reset-SELinux-context-when-the-node-was-not-t.patch +Patch34: 0034-add-LGPL-COPYING-to-libudev-and-GUdev.patch +Patch35: 0035-cdrom_id-open-non-mounted-optical-media-with-O_EXCL.patch +Patch36: 0036-modeswitch-morph-into-tool-that-only-switches-Mobile.patch + +Patch101: udev-151-rules.patch +Patch102: udev-151-virtio.patch Source1: start_udev Source3: udev-post.init @@ -110,17 +134,42 @@ glib-based applications using libudev functionality. %prep %setup -q -%patch1 -p1 -%patch2 -p1 + +%patch1 -p1 -b .git1 +%patch2 -p1 -b .git2 +%patch3 -p1 -b .git3 +%patch4 -p1 -b .git4 +%patch5 -p1 -b .git5 +%patch6 -p1 -b .git6 +%patch7 -p1 -b .git7 +%patch13 -p1 -b .git13 +%patch14 -p1 -b .git14 +%patch15 -p1 -b .git15 +%patch16 -p1 -b .git16 +%patch17 -p1 -b .git17 +%patch18 -p1 -b .git18 +%patch19 -p1 -b .git19 +%patch21 -p1 -b .git21 +%patch22 -p1 -b .git22 +%patch29 -p1 -b .git29 +%patch30 -p1 -b .git30 +%patch31 -p1 -b .git31 +%patch32 -p1 -b .git32 +%patch34 -p1 -b .git34 +%patch35 -p1 -b .git35 +%patch36 -p1 -b .git36 + +%patch101 -p1 +%patch102 -p1 %build # get rid of rpath libtoolize -f -c %configure --with-selinux --prefix=%{_prefix} --exec-prefix="" \ - --sysconfdir=%{_sysconfdir} --with-libdir-name=%{_lib} \ - --sbindir="/sbin" --libexecdir=%{udev_scriptdir} \ - --with-rootlibdir=/%{_lib} --enable-introspection \ - --disable-rpath --enable-debug + --sysconfdir=%{_sysconfdir} --with-libdir-name=%{_lib} \ + --sbindir="/sbin" --libexecdir=%{udev_scriptdir} \ + --with-rootlibdir=/%{_lib} --enable-introspection \ + --disable-rpath --enable-debug make %{?_smp_mflags} @@ -143,32 +192,24 @@ touch $RPM_BUILD_ROOT%{_sysconfdir}/scsi_id.config # force relative symlinks ln -sf ..%{udev_scriptdir}/scsi_id $RPM_BUILD_ROOT/sbin/scsi_id -ln -sf ../../sbin/udevadm $RPM_BUILD_ROOT%{_bindir}/udevinfo -ln -sf ../../sbin/udevadm $RPM_BUILD_ROOT%{_bindir}/udevtest -ln -sf ../../sbin/udevadm $RPM_BUILD_ROOT%{_sbindir}/udevmonitor - -ln -sf ../../sbin/udevadm $RPM_BUILD_ROOT/sbin/udevtrigger -ln -sf ../../sbin/udevadm $RPM_BUILD_ROOT/sbin/udevsettle -ln -sf ../../sbin/udevadm $RPM_BUILD_ROOT/sbin/udevcontrol - for i in \ - rules/redhat/40-redhat.rules \ + rules/redhat/40-redhat.rules \ %ifarch ia64 - rules/packages/40-ia64.rules \ + rules/packages/40-ia64.rules \ %endif %ifarch ppc ppc64 - rules/packages/40-ppc.rules \ + rules/packages/40-ppc.rules \ %endif %ifarch s390 s390x - rules/packages/40-s390.rules \ + rules/packages/40-s390.rules \ %endif - rules/packages/40-isdn.rules \ - rules/packages/64-md-raid.rules \ - rules/packages/64-device-mapper.rules \ - ; do - install -m 0644 "$i" "$RPM_BUILD_ROOT%{udev_scriptdir}/rules.d/${i##*/}" + rules/packages/40-isdn.rules \ + rules/packages/64-md-raid.rules \ + rules/packages/64-device-mapper.rules \ + ; do + install -m 0644 "$i" "$RPM_BUILD_ROOT%{udev_scriptdir}/rules.d/${i##*/}" done - + mkdir -p $RPM_BUILD_ROOT%{udev_scriptdir}/{,devices} install -m 0755 %{SOURCE4} $RPM_BUILD_ROOT%{udev_scriptdir}/fw_unit_symlinks.sh @@ -188,16 +229,16 @@ mkdir -p $RPM_BUILD_ROOT/var/lib/udev/makedev.d %preun if [ "$1" -eq 0 -a -f %{_initrddir}/udev ]; then - if [ -x /sbin/pidof ]; then - pid=$(/sbin/pidof -c udevd) - if [ -n "$pid" ]; then - kill $pid - fi - fi - /sbin/chkconfig --del udev + if [ -x /sbin/pidof ]; then + pid=$(/sbin/pidof -c udevd) + if [ -n "$pid" ]; then + kill $pid + fi + fi + /sbin/chkconfig --del udev fi if [ "$1" -eq 0 ]; then - /sbin/chkconfig --del udev-post + /sbin/chkconfig --del udev-post fi exit 0 @@ -212,29 +253,29 @@ getent group dialout >/dev/null || /usr/sbin/groupadd -g 18 dialout || : # kill daemon if we are not in a chroot if test -f /proc/1/exe -a -d /proc/1/root; then - if test -x /usr/bin/stat -a "$(/usr/bin/stat -Lc '%%D-%%i' /)" = "$(/usr/bin/stat -Lc '%%D-%%i' /proc/1/root)"; then - if test -x /sbin/udevd -a -x /sbin/pidof ; then - /sbin/udevadm control --stop-exec-queue - pid=$(/sbin/pidof -c udevd) - while [ -n "$pid" ]; do - for p in $pid; do - kill $hard $p; - done - pid=$(/sbin/pidof -c udevd) - hard="-9" - done - fi - fi + if test -x /usr/bin/stat -a "$(/usr/bin/stat -Lc '%%D-%%i' /)" = "$(/usr/bin/stat -Lc '%%D-%%i' /proc/1/root)"; then + if test -x /sbin/udevd -a -x /sbin/pidof ; then + /sbin/udevadm control --stop-exec-queue + pid=$(/sbin/pidof -c udevd) + while [ -n "$pid" ]; do + for p in $pid; do + kill $hard $p; + done + pid=$(/sbin/pidof -c udevd) + hard="-9" + done + fi + fi fi exit 0 %post # start daemon if we are not in a chroot if test -f /proc/1/exe -a -d /proc/1/root; then - if test "$(/usr/bin/stat -Lc '%%D-%%i' /)" = "$(/usr/bin/stat -Lc '%%D-%%i' /proc/1/root)"; then - /sbin/udevd -d - /sbin/udevadm control --start-exec-queue - fi + if test "$(/usr/bin/stat -Lc '%%D-%%i' /)" = "$(/usr/bin/stat -Lc '%%D-%%i' /proc/1/root)"; then + /sbin/udevd -d + /sbin/udevadm control --start-exec-queue + fi fi /sbin/chkconfig --add udev-post @@ -259,9 +300,6 @@ rm -rf $RPM_BUILD_ROOT %defattr(0644, root, root, 0755) %doc NEWS COPYING README TODO ChangeLog extras/keymap/README.keymap.txt %attr(0755,root,root) /sbin/udevadm -%attr(0755,root,root) /sbin/udevsettle -%attr(0755,root,root) /sbin/udevtrigger -%attr(0755,root,root) /sbin/udevcontrol %attr(0755,root,root) /sbin/udevd %attr(0755,root,root) /sbin/start_udev %attr(0755,root,root) /sbin/scsi_id @@ -286,9 +324,6 @@ rm -rf $RPM_BUILD_ROOT %attr(0755,root,root) %dir %{udev_scriptdir}/rules.d/ %attr(0755,root,root) %{_sysconfdir}/rc.d/init.d/udev-post -%attr(0755,root,root) %{_bindir}/udevtest -%attr(0755,root,root) %{_bindir}/udevinfo -%attr(0755,root,root) %{_sbindir}/udevmonitor %attr(0755,root,root) %dir %{_sysconfdir}/udev/ %attr(0755,root,root) %dir %{_sysconfdir}/udev/rules.d/ %attr(0755,root,root) %dir %{udev_scriptdir}/ @@ -315,26 +350,26 @@ rm -rf $RPM_BUILD_ROOT %ghost %dir %{_sysconfdir}/udev/devices/ %ghost %dir %{_sysconfdir}/dev.d/ -%attr(0755,root,root) %{udev_scriptdir}/modem-modeswitch +%attr(0755,root,root) %{udev_scriptdir}/mobile-action-modeswitch %attr(0755,root,root) %{udev_scriptdir}/pci-db %attr(0755,root,root) %{udev_scriptdir}/usb-db %attr(0755,root,root) %{udev_scriptdir}/keymap %attr(0755,root,root) %{udev_scriptdir}/udev-acl %attr(0755,root,root) %{udev_scriptdir}/v4l_id %attr(0755,root,root) %{udev_scriptdir}/findkeyboards -%dir %attr(0755,root,root) %{udev_scriptdir}/keymaps -%attr(0644,root,root) %{udev_scriptdir}/keymaps/* +%dir %{udev_scriptdir}/keymaps +%{udev_scriptdir}/keymaps/* %attr(0644,root,root) %{_prefix}/lib/ConsoleKit/run-seat.d/udev-acl.ck %files -n libudev %defattr(0644, root, root, 0755) -%doc COPYING +%doc libudev/COPYING %attr(0755,root,root) /%{_lib}/libudev.so.* %files -n libudev-devel %defattr(0644, root, root, 0755) -%doc COPYING libudev/docs/html/* +%doc libudev/COPYING libudev/docs/html/* %{_includedir}/libudev.h %{_libdir}/libudev.so %{_libdir}/pkgconfig/libudev.pc @@ -343,14 +378,16 @@ rm -rf $RPM_BUILD_ROOT %files -n libgudev1 %defattr(0644, root, root, 0755) -%doc COPYING +%doc extras/gudev/COPYING %attr(0755,root,root) %{_libdir}/libgudev-1.0.so.* %attr(0644,root,root) %{_libdir}/girepository-1.0/GUdev-1.0.typelib %files -n libgudev1-devel %defattr(0644, root, root, 0755) -%doc COPYING extras/gudev/docs/html/* +%doc extras/gudev/COPYING extras/gudev/docs/html/* %attr(0755,root,root) %{_libdir}/libgudev-1.0.so +%dir %attr(0755,root,root) %{_includedir}/gudev-1.0 +%dir %attr(0755,root,root) %{_includedir}/gudev-1.0/gudev %attr(0644,root,root) %{_includedir}/gudev-1.0/gudev/*.h %attr(0644,root,root) %{_datadir}/gir-1.0/GUdev-1.0.gir %dir %{_datadir}/gtk-doc/html/gudev @@ -358,6 +395,17 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_libdir}/pkgconfig/gudev-1.0* %changelog +* Fri Mar 19 2010 Harald Hoyer 151-4 +- add patch for virtio-ports (#569700) +- own libgudev dirs (#561319) +- minor udev startup script improvements (#549518) +- create /dev/hugepages subdir in start_udev (#541998) +- remove GPL COPYING file from LGPL subpackages (#536843) +- removed symlinks to udevadm +- touch all device nodes after udev settled for the timezone + timestamp (#569335) +- add some upstream bugfixes + * Sun Feb 07 2010 Kyle McMartin 151-3 - udev-86a7a2f-fix-missing-firmware.patch: fix hang when loading microcode (since microcode_intel tries to probe firmware which does @@ -445,7 +493,7 @@ rm -rf $RPM_BUILD_ROOT - git fix: rule-generator: cd - skip by-path links if we create by-id links - git fix: fix possible endless loop for GOTO to non-existent LABEL - git fix: cdrom_id: suppress ID_CDROM_MEDIA_STATE=blank for plain non-writable - CDROM media + CDROM media * Thu Jun 08 2009 Harald Hoyer 142-3 - delay device-mapper changes From cd81212d7e2fa7ae2fefef90f56c6e7d40278afa Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Fri, 19 Mar 2010 13:12:23 +0000 Subject: [PATCH 03/24] add "-D" to gperf call --- udev-151-gperf.patch | 13 +++++++++++++ udev.spec | 5 +++++ 2 files changed, 18 insertions(+) create mode 100644 udev-151-gperf.patch diff --git a/udev-151-gperf.patch b/udev-151-gperf.patch new file mode 100644 index 0000000..db93ba7 --- /dev/null +++ b/udev-151-gperf.patch @@ -0,0 +1,13 @@ +diff -up udev-151/extras/keymap/keys-from-name.gperf udev-151/extras/keymap/keys-from-name +diff -up udev-151/Makefile.am.gperf udev-151/Makefile.am +--- udev-151/Makefile.am.gperf 2010-03-19 14:04:36.000000000 +0100 ++++ udev-151/Makefile.am 2010-03-19 14:04:52.000000000 +0100 +@@ -550,7 +550,7 @@ extras/keymap/keys-from-name.gperf: extr + $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print $$1 ", " $$1 }' < $< > $@ + + extras/keymap/keys-from-name.h: extras/keymap/keys-from-name.gperf Makefile +- $(AM_V_GEN)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_key -H hash_key_name -p -C < $< > $@ ++ $(AM_V_GEN)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_key -H hash_key_name -p -C -D < $< > $@ + + extras/keymap/keys-to-name.h: extras/keymap/keys.txt Makefile + $(AM_V_GEN)$(AWK) 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' < $< > $@ diff --git a/udev.spec b/udev.spec index 2684220..e4ffd5b 100644 --- a/udev.spec +++ b/udev.spec @@ -39,6 +39,7 @@ Patch36: 0036-modeswitch-morph-into-tool-that-only-switches-Mobile.patch Patch101: udev-151-rules.patch Patch102: udev-151-virtio.patch +Patch103: udev-151-gperf.patch Source1: start_udev Source3: udev-post.init @@ -161,8 +162,11 @@ glib-based applications using libudev functionality. %patch101 -p1 %patch102 -p1 +%patch103 -p1 %build +autoreconf -i +automake # get rid of rpath libtoolize -f -c %configure --with-selinux --prefix=%{_prefix} --exec-prefix="" \ @@ -405,6 +409,7 @@ rm -rf $RPM_BUILD_ROOT - touch all device nodes after udev settled for the timezone timestamp (#569335) - add some upstream bugfixes +- add "-D" to gperf call * Sun Feb 07 2010 Kyle McMartin 151-3 - udev-86a7a2f-fix-missing-firmware.patch: fix hang when loading From 164998caba75b1122fef739914188d58c090254b Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mon, 22 Mar 2010 10:09:06 +0000 Subject: [PATCH 04/24] - fixed return code of touching the device nodes [FAIL] -> [OK] --- start_udev | 5 +++-- udev.spec | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/start_udev b/start_udev index 0da55f4..e830bce 100755 --- a/start_udev +++ b/start_udev @@ -62,6 +62,7 @@ touch_recursive() { [[ -c "$i" || -b "$i" ]] && touch "$i" [ -d "$i" ] && touch_recursive "$i" done ) + return 0 } xargs_simple () { @@ -316,11 +317,11 @@ if [ -f "/sys/class/tty/console/uevent" ]; then wait_for_queue $udevtimeout ret=$[$ret + $?] wait + ret=$[$ret + $?] /sbin/udevadm control --env=STARTUP= # touch all device files for timezone glitches # "find" is in /usr/bin and might not be available - touch_recursive /dev > "$udev_root/null" 2>&1 - + touch_recursive /dev > "$udev_root/null" 2>&1 else echo -n " kernel too old for this udev version " /sbin/udevd -d $UDEV_OPTS diff --git a/udev.spec b/udev.spec index e4ffd5b..1f4c9ee 100644 --- a/udev.spec +++ b/udev.spec @@ -5,7 +5,7 @@ Summary: A userspace implementation of devfs Name: udev Version: 151 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv2 Group: System Environment/Base Provides: udev-persistent = %{version}-%{release} @@ -399,6 +399,9 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_libdir}/pkgconfig/gudev-1.0* %changelog +* Mon Mar 22 2010 Harald Hoyer 151-5 +- fixed return code of touching the device nodes [FAIL] -> [OK] + * Fri Mar 19 2010 Harald Hoyer 151-4 - add patch for virtio-ports (#569700) - own libgudev dirs (#561319) From e418dca65a21513574f61f210c663ea14a05cbac Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mon, 22 Mar 2010 13:35:22 +0000 Subject: [PATCH 05/24] - touch with "--no-create", will not use open() and trigger devs/watchdogs (bug #575417) --- start_udev | 4 ++-- udev-151-virtio.patch | 2 +- udev.spec | 6 +++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/start_udev b/start_udev index e830bce..f6ca868 100755 --- a/start_udev +++ b/start_udev @@ -59,7 +59,7 @@ fi touch_recursive() { ( cd $1; for i in *; do - [[ -c "$i" || -b "$i" ]] && touch "$i" + [[ -c "$i" || -b "$i" ]] && touch --no-create "$i" [ -d "$i" ] && touch_recursive "$i" done ) return 0 @@ -321,7 +321,7 @@ if [ -f "/sys/class/tty/console/uevent" ]; then /sbin/udevadm control --env=STARTUP= # touch all device files for timezone glitches # "find" is in /usr/bin and might not be available - touch_recursive /dev > "$udev_root/null" 2>&1 + touch_recursive /dev > "$udev_root/null" 2>&1 else echo -n " kernel too old for this udev version " /sbin/udevd -d $UDEV_OPTS diff --git a/udev-151-virtio.patch b/udev-151-virtio.patch index d1a7644..53bbef6 100644 --- a/udev-151-virtio.patch +++ b/udev-151-virtio.patch @@ -21,7 +21,7 @@ index f8556d1..da1535f 100644 # virtio serial / console ports -KERNEL=="vport*", SYMLINK+="virtio-ports/$attr{name}" -+KERNEL=="vport*", ATTRS{name}=="?*", SYMLINK+="virtio-ports/$attr{name}" ++KERNEL=="vport*", ATTR{name}=="?*", SYMLINK+="virtio-ports/$attr{name}" # mem KERNEL=="null|zero|full|random|urandom", MODE="0666" diff --git a/udev.spec b/udev.spec index 1f4c9ee..9aecf3f 100644 --- a/udev.spec +++ b/udev.spec @@ -5,7 +5,7 @@ Summary: A userspace implementation of devfs Name: udev Version: 151 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2 Group: System Environment/Base Provides: udev-persistent = %{version}-%{release} @@ -399,6 +399,10 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_libdir}/pkgconfig/gudev-1.0* %changelog +* Mon Mar 22 2010 Harald Hoyer 151-6 +- touch with "--no-create", will not use open() + and trigger devs/watchdogs (bug #575417) + * Mon Mar 22 2010 Harald Hoyer 151-5 - fixed return code of touching the device nodes [FAIL] -> [OK] From f693b0743f6425b3217c1407f77631185af53910 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mon, 22 Mar 2010 14:18:48 +0000 Subject: [PATCH 06/24] - only correct the timestamp, if UTC=="no" --- start_udev | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/start_udev b/start_udev index f6ca868..07a75d4 100755 --- a/start_udev +++ b/start_udev @@ -321,7 +321,9 @@ if [ -f "/sys/class/tty/console/uevent" ]; then /sbin/udevadm control --env=STARTUP= # touch all device files for timezone glitches # "find" is in /usr/bin and might not be available - touch_recursive /dev > "$udev_root/null" 2>&1 + . /etc/sysconfig/clock + [ "$UTC" == "false" -o "$UTC" == "no" ] \ + && touch_recursive /dev > "$udev_root/null" 2>&1 else echo -n " kernel too old for this udev version " /sbin/udevd -d $UDEV_OPTS From 91652311776a0d0e8d5509992cdf9946bd30dc6d Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mon, 22 Mar 2010 14:19:53 +0000 Subject: [PATCH 07/24] - only correct the timestamp, if UTC=="no" --- start_udev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start_udev b/start_udev index 07a75d4..065596a 100755 --- a/start_udev +++ b/start_udev @@ -322,7 +322,7 @@ if [ -f "/sys/class/tty/console/uevent" ]; then # touch all device files for timezone glitches # "find" is in /usr/bin and might not be available . /etc/sysconfig/clock - [ "$UTC" == "false" -o "$UTC" == "no" ] \ + [[ "$UTC" == "false" || "$UTC" == "no" ]] \ && touch_recursive /dev > "$udev_root/null" 2>&1 else echo -n " kernel too old for this udev version " From 4041a2a8e4c093895db7bbe14a6ba3041dc93be2 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mon, 22 Mar 2010 14:21:43 +0000 Subject: [PATCH 08/24] - only correct the timestamp, if UTC=="no" --- start_udev | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/start_udev b/start_udev index 065596a..862163b 100755 --- a/start_udev +++ b/start_udev @@ -321,9 +321,11 @@ if [ -f "/sys/class/tty/console/uevent" ]; then /sbin/udevadm control --env=STARTUP= # touch all device files for timezone glitches # "find" is in /usr/bin and might not be available - . /etc/sysconfig/clock - [[ "$UTC" == "false" || "$UTC" == "no" ]] \ - && touch_recursive /dev > "$udev_root/null" 2>&1 + if [ -f /etc/sysconfig/clock ]; then + . /etc/sysconfig/clock + [[ "$UTC" == "false" || "$UTC" == "no" ]] \ + && touch_recursive /dev > "$udev_root/null" 2>&1 + fi else echo -n " kernel too old for this udev version " /sbin/udevd -d $UDEV_OPTS From cc9477b6ac489cfa457c02c0613a313a6f8f0c23 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mon, 22 Mar 2010 14:24:27 +0000 Subject: [PATCH 09/24] - only correct the timestamp, if UTC=="no" --- start_udev | 2 -- udev.spec | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/start_udev b/start_udev index 862163b..df6c41b 100755 --- a/start_udev +++ b/start_udev @@ -330,10 +330,8 @@ else echo -n " kernel too old for this udev version " /sbin/udevd -d $UDEV_OPTS ret=10 - fi -ret=$[$ret + $?] [ $ret -eq 0 ] && success $"$STRING" || failure $"$STRING" echo exit 0 diff --git a/udev.spec b/udev.spec index 9aecf3f..9650791 100644 --- a/udev.spec +++ b/udev.spec @@ -5,7 +5,7 @@ Summary: A userspace implementation of devfs Name: udev Version: 151 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv2 Group: System Environment/Base Provides: udev-persistent = %{version}-%{release} @@ -399,6 +399,9 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_libdir}/pkgconfig/gudev-1.0* %changelog +* Mon Mar 22 2010 Harald Hoyer 151-7 +- only correct the timestamp, if UTC=="no" + * Mon Mar 22 2010 Harald Hoyer 151-6 - touch with "--no-create", will not use open() and trigger devs/watchdogs (bug #575417) From e54260941365408a3ca59cedfa0f1c618d7bc54a Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Tue, 13 Apr 2010 15:29:13 +0000 Subject: [PATCH 10/24] - more cdrom_id bugfixes for buggy cdroms and CD burning (bug #577659) --- ...on-mounted-optical-media-with-O_EXCL.patch | 2 +- 0048-cdrom_id-remove-debugging-code.patch | 24 ++++ ...id-retry-to-open-the-device-if-EBUSY.patch | 53 +++++++ ...m_id-check-mount-state-in-retry-loop.patch | 55 ++++++++ ...set-ID_CDROM-regardless-if-we-can-ru.patch | 31 +++++ ...cdrom_id-Fix-uninitialized-variables.patch | 131 ++++++++++++++++++ 0065-cdrom_id-Fix-uninitialized-buffers.patch | 82 +++++++++++ udev.spec | 18 ++- 8 files changed, 394 insertions(+), 2 deletions(-) create mode 100644 0048-cdrom_id-remove-debugging-code.patch create mode 100644 0049-cdrom_id-retry-to-open-the-device-if-EBUSY.patch create mode 100644 0050-cdrom_id-check-mount-state-in-retry-loop.patch create mode 100644 0051-cdrom_id-always-set-ID_CDROM-regardless-if-we-can-ru.patch create mode 100644 0062-cdrom_id-Fix-uninitialized-variables.patch create mode 100644 0065-cdrom_id-Fix-uninitialized-buffers.patch diff --git a/0035-cdrom_id-open-non-mounted-optical-media-with-O_EXCL.patch b/0035-cdrom_id-open-non-mounted-optical-media-with-O_EXCL.patch index 870a344..0d34327 100644 --- a/0035-cdrom_id-open-non-mounted-optical-media-with-O_EXCL.patch +++ b/0035-cdrom_id-open-non-mounted-optical-media-with-O_EXCL.patch @@ -1,7 +1,7 @@ From 38a3cde11bc77af49a96245b8a8a0f2b583a344c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 18 Mar 2010 11:14:32 +0100 -Subject: [PATCH 35/36] cdrom_id: open non-mounted optical media with O_EXCL +Subject: [PATCH 35/65] cdrom_id: open non-mounted optical media with O_EXCL This should prevent confusing drives during CD burning sessions. Based on a patch from Harald Hoyer. diff --git a/0048-cdrom_id-remove-debugging-code.patch b/0048-cdrom_id-remove-debugging-code.patch new file mode 100644 index 0000000..57a4e07 --- /dev/null +++ b/0048-cdrom_id-remove-debugging-code.patch @@ -0,0 +1,24 @@ +From 36a07a8c34a4cff5ad2bbb6e0fdfed49e8191661 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 7 Apr 2010 09:23:46 +0200 +Subject: [PATCH 48/65] cdrom_id: remove debugging code + +--- + extras/cdrom_id/cdrom_id.c | 1 - + 1 files changed, 0 insertions(+), 1 deletions(-) + +diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c +index e485768..036ef28 100644 +--- a/extras/cdrom_id/cdrom_id.c ++++ b/extras/cdrom_id/cdrom_id.c +@@ -126,7 +126,6 @@ static int is_mounted(const char *device) + if (fp == NULL) + return -ENOSYS; + while (fscanf(fp, "%*s %*s %i:%i %*[^\n]", &maj, &min) == 2) { +- printf("got %u %u\n", maj, min); + if (makedev(maj, min) == statbuf.st_rdev) { + mounted = 1; + break; +-- +1.6.6 + diff --git a/0049-cdrom_id-retry-to-open-the-device-if-EBUSY.patch b/0049-cdrom_id-retry-to-open-the-device-if-EBUSY.patch new file mode 100644 index 0000000..f7e6b27 --- /dev/null +++ b/0049-cdrom_id-retry-to-open-the-device-if-EBUSY.patch @@ -0,0 +1,53 @@ +From cccfffbe04c01be12fb42cb12f3f7aa5e2a22dd4 Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Wed, 7 Apr 2010 09:24:25 +0200 +Subject: [PATCH 49/65] cdrom_id: retry to open the device, if EBUSY + +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. +--- + extras/cdrom_id/cdrom_id.c | 18 +++++++++++++++++- + 1 files changed, 17 insertions(+), 1 deletions(-) + +diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c +index 036ef28..7c9f8cc 100644 +--- a/extras/cdrom_id/cdrom_id.c ++++ b/extras/cdrom_id/cdrom_id.c +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -591,7 +592,22 @@ int main(int argc, char *argv[]) + goto exit; + } + +- fd = open(node, O_RDONLY|O_NONBLOCK|(is_mounted(node) ? 0 : O_EXCL)); ++ if (is_mounted(node)) { ++ fd = open(node, O_RDONLY|O_NONBLOCK); ++ } else { ++ int cnt; ++ struct timespec duration; ++ ++ srand((unsigned int)getpid()); ++ for (cnt = 40; cnt > 0; cnt--) { ++ fd = open(node, O_RDONLY|O_NONBLOCK|O_EXCL); ++ if (fd >= 0 || errno != EBUSY) ++ break; ++ duration.tv_sec = 0; ++ duration.tv_nsec = (100 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); ++ nanosleep(&duration, NULL); ++ } ++ } + if (fd < 0) { + info(udev, "unable to open '%s'\n", node); + fprintf(stderr, "unable to open '%s'\n", node); +-- +1.6.6 + diff --git a/0050-cdrom_id-check-mount-state-in-retry-loop.patch b/0050-cdrom_id-check-mount-state-in-retry-loop.patch new file mode 100644 index 0000000..b4fb62b --- /dev/null +++ b/0050-cdrom_id-check-mount-state-in-retry-loop.patch @@ -0,0 +1,55 @@ +From d45c8c8b01c99180f15e24b22f7cf81eaf3cdd1b Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Wed, 7 Apr 2010 11:32:22 +0200 +Subject: [PATCH 50/65] cdrom_id: check mount state in retry loop + +Based on a patch from Harald Hoyer. +--- + extras/cdrom_id/cdrom_id.c | 22 +++++++++------------- + 1 files changed, 9 insertions(+), 13 deletions(-) + +diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c +index 7c9f8cc..894a890 100644 +--- a/extras/cdrom_id/cdrom_id.c ++++ b/extras/cdrom_id/cdrom_id.c +@@ -547,6 +547,7 @@ int main(int argc, char *argv[]) + const char *node = NULL; + int export = 0; + int fd = -1; ++ int cnt; + int rc = 0; + + udev = udev_new(); +@@ -592,21 +593,16 @@ int main(int argc, char *argv[]) + goto exit; + } + +- if (is_mounted(node)) { +- fd = open(node, O_RDONLY|O_NONBLOCK); +- } else { +- int cnt; ++ srand((unsigned int)getpid()); ++ for (cnt = 20; cnt > 0; cnt--) { + struct timespec duration; + +- srand((unsigned int)getpid()); +- for (cnt = 40; cnt > 0; cnt--) { +- fd = open(node, O_RDONLY|O_NONBLOCK|O_EXCL); +- if (fd >= 0 || errno != EBUSY) +- break; +- duration.tv_sec = 0; +- duration.tv_nsec = (100 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); +- nanosleep(&duration, NULL); +- } ++ fd = open(node, O_RDONLY|O_NONBLOCK|(is_mounted(node) ? 0 : O_EXCL)); ++ if (fd >= 0 || errno != EBUSY) ++ break; ++ duration.tv_sec = 0; ++ duration.tv_nsec = (100 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); ++ nanosleep(&duration, NULL); + } + if (fd < 0) { + info(udev, "unable to open '%s'\n", node); +-- +1.6.6 + diff --git a/0051-cdrom_id-always-set-ID_CDROM-regardless-if-we-can-ru.patch b/0051-cdrom_id-always-set-ID_CDROM-regardless-if-we-can-ru.patch new file mode 100644 index 0000000..1d3be0e --- /dev/null +++ b/0051-cdrom_id-always-set-ID_CDROM-regardless-if-we-can-ru.patch @@ -0,0 +1,31 @@ +From 5c5ebde711c4560ae0560e87c33fe477b5add354 Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Mon, 12 Apr 2010 01:12:23 +0200 +Subject: [PATCH 51/65] cdrom_id: always set ID_CDROM regardless if we can run cdrom_id + +--- + extras/cdrom_id/60-cdrom_id.rules | 12 +++++++++--- + 1 files changed, 9 insertions(+), 3 deletions(-) + +diff --git a/extras/cdrom_id/60-cdrom_id.rules b/extras/cdrom_id/60-cdrom_id.rules +index 132a680..811c4aa 100644 +--- a/extras/cdrom_id/60-cdrom_id.rules ++++ b/extras/cdrom_id/60-cdrom_id.rules +@@ -1,5 +1,11 @@ + # do not edit this file, it will be overwritten on update + +-# import optical drive properties +-ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", \ +- KERNEL=="sr[0-9]*|xvd*", IMPORT{program}="cdrom_id --export $tempnode" ++ACTION!="add|change", GOTO="cdrom_end" ++SUBSYSTEM!="block", GOTO="cdrom_end" ++KERNEL!="sr[0-9]*|xvd*", GOTO="cdrom_end" ++ENV{DEVTYPE}!="disk", GOTO="cdrom_end" ++ ++ENV{ID_CDROM}="1" ++IMPORT{program}="cdrom_id --export $tempnode" ++ ++LABEL="cdrom_end" +-- +1.6.6 + diff --git a/0062-cdrom_id-Fix-uninitialized-variables.patch b/0062-cdrom_id-Fix-uninitialized-variables.patch new file mode 100644 index 0000000..1caba57 --- /dev/null +++ b/0062-cdrom_id-Fix-uninitialized-variables.patch @@ -0,0 +1,131 @@ +From 816e6bf0fb0849d03696a4b4ec2334e35e819425 Mon Sep 17 00:00:00 2001 +From: Martin Pitt +Date: Tue, 13 Apr 2010 10:49:24 +0200 +Subject: [PATCH 62/65] cdrom_id: Fix uninitialized variables + +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 +--- + extras/cdrom_id/cdrom_id.c | 96 ++++++++++++++++++++++---------------------- + 1 files changed, 48 insertions(+), 48 deletions(-) + +diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c +index 894a890..db3867c 100644 +--- a/extras/cdrom_id/cdrom_id.c ++++ b/extras/cdrom_id/cdrom_id.c +@@ -56,57 +56,57 @@ static void log_fn(struct udev *udev, int priority, + } + + /* device info */ +-static unsigned int cd_cd_rom; +-static unsigned int cd_cd_r; +-static unsigned int cd_cd_rw; +-static unsigned int cd_dvd_rom; +-static unsigned int cd_dvd_r; +-static unsigned int cd_dvd_rw; +-static unsigned int cd_dvd_ram; +-static unsigned int cd_dvd_plus_r; +-static unsigned int cd_dvd_plus_rw; +-static unsigned int cd_dvd_plus_r_dl; +-static unsigned int cd_dvd_plus_rw_dl; +-static unsigned int cd_bd; +-static unsigned int cd_bd_r; +-static unsigned int cd_bd_re; +-static unsigned int cd_hddvd; +-static unsigned int cd_hddvd_r; +-static unsigned int cd_hddvd_rw; +-static unsigned int cd_mo; +-static unsigned int cd_mrw; +-static unsigned int cd_mrw_w; ++static unsigned int cd_cd_rom = 0; ++static unsigned int cd_cd_r = 0; ++static unsigned int cd_cd_rw = 0; ++static unsigned int cd_dvd_rom = 0; ++static unsigned int cd_dvd_r = 0; ++static unsigned int cd_dvd_rw = 0; ++static unsigned int cd_dvd_ram = 0; ++static unsigned int cd_dvd_plus_r = 0; ++static unsigned int cd_dvd_plus_rw = 0; ++static unsigned int cd_dvd_plus_r_dl = 0; ++static unsigned int cd_dvd_plus_rw_dl = 0; ++static unsigned int cd_bd = 0; ++static unsigned int cd_bd_r = 0; ++static unsigned int cd_bd_re = 0; ++static unsigned int cd_hddvd = 0; ++static unsigned int cd_hddvd_r = 0; ++static unsigned int cd_hddvd_rw = 0; ++static unsigned int cd_mo = 0; ++static unsigned int cd_mrw = 0; ++static unsigned int cd_mrw_w = 0; + + /* 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; +-static unsigned int cd_media_dvd_rom; +-static unsigned int cd_media_dvd_r; +-static unsigned int cd_media_dvd_rw; +-static unsigned int cd_media_dvd_ram; +-static unsigned int cd_media_dvd_plus_r; +-static unsigned int cd_media_dvd_plus_rw; +-static unsigned int cd_media_dvd_plus_r_dl; +-static unsigned int cd_media_dvd_plus_rw_dl; +-static unsigned int cd_media_bd; +-static unsigned int cd_media_bd_r; +-static unsigned int cd_media_bd_re; +-static unsigned int cd_media_hddvd; +-static unsigned int cd_media_hddvd_r; +-static unsigned int cd_media_hddvd_rw; +-static unsigned int cd_media_mo; +-static unsigned int cd_media_mrw; +-static unsigned int cd_media_mrw_w; +- +-static const char *cd_media_state; +-static unsigned int cd_media_session_next; +-static unsigned int cd_media_session_count; +-static unsigned int cd_media_track_count; +-static unsigned int cd_media_track_count_data; +-static unsigned int cd_media_track_count_audio; +-static unsigned long long int cd_media_session_last_offset; ++static unsigned int cd_media = 0; ++static unsigned int cd_media_cd_rom = 0; ++static unsigned int cd_media_cd_r = 0; ++static unsigned int cd_media_cd_rw = 0; ++static unsigned int cd_media_dvd_rom = 0; ++static unsigned int cd_media_dvd_r = 0; ++static unsigned int cd_media_dvd_rw = 0; ++static unsigned int cd_media_dvd_ram = 0; ++static unsigned int cd_media_dvd_plus_r = 0; ++static unsigned int cd_media_dvd_plus_rw = 0; ++static unsigned int cd_media_dvd_plus_r_dl = 0; ++static unsigned int cd_media_dvd_plus_rw_dl = 0; ++static unsigned int cd_media_bd = 0; ++static unsigned int cd_media_bd_r = 0; ++static unsigned int cd_media_bd_re = 0; ++static unsigned int cd_media_hddvd = 0; ++static unsigned int cd_media_hddvd_r = 0; ++static unsigned int cd_media_hddvd_rw = 0; ++static unsigned int cd_media_mo = 0; ++static unsigned int cd_media_mrw = 0; ++static unsigned int cd_media_mrw_w = 0; ++ ++static const char *cd_media_state = NULL; ++static unsigned int cd_media_session_next = 0; ++static unsigned int cd_media_session_count = 0; ++static unsigned int cd_media_track_count = 0; ++static unsigned int cd_media_track_count_data = 0; ++static unsigned int cd_media_track_count_audio = 0; ++static unsigned long long int cd_media_session_last_offset = 0; + + #define ERRCODE(s) ((((s)[2] & 0x0F) << 16) | ((s)[12] << 8) | ((s)[13])) + #define SK(errcode) (((errcode) >> 16) & 0xF) +-- +1.6.6 + diff --git a/0065-cdrom_id-Fix-uninitialized-buffers.patch b/0065-cdrom_id-Fix-uninitialized-buffers.patch new file mode 100644 index 0000000..310e3c6 --- /dev/null +++ b/0065-cdrom_id-Fix-uninitialized-buffers.patch @@ -0,0 +1,82 @@ +From 2b861dc92757b9a3214c2b8e9d8b1c3f3c162391 Mon Sep 17 00:00:00 2001 +From: Martin Pitt +Date: Tue, 13 Apr 2010 15:25:48 +0200 +Subject: [PATCH 65/65] cdrom_id: Fix uninitialized buffers + +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 +--- + extras/cdrom_id/cdrom_id.c | 7 +++++++ + 1 files changed, 7 insertions(+), 0 deletions(-) + +diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c +index db3867c..b6797cd 100644 +--- a/extras/cdrom_id/cdrom_id.c ++++ b/extras/cdrom_id/cdrom_id.c +@@ -237,6 +237,7 @@ static int cd_inquiry(struct udev *udev, int fd) { + unsigned char inq[128]; + int err; + ++ memset (inq, 0, sizeof (inq)); + scsi_cmd_set(udev, &sc, 0, 0x12); + scsi_cmd_set(udev, &sc, 4, 36); + scsi_cmd_set(udev, &sc, 5, 0); +@@ -265,6 +266,7 @@ static int cd_profiles(struct udev *udev, int fd) + unsigned int i; + int err; + ++ memset (header, 0, sizeof (header)); + scsi_cmd_set(udev, &sc, 0, 0x46); + scsi_cmd_set(udev, &sc, 1, 0); + scsi_cmd_set(udev, &sc, 8, sizeof(header)); +@@ -282,6 +284,7 @@ static int cd_profiles(struct udev *udev, int fd) + return -1; + } + ++ memset (profiles, 0, sizeof (profiles)); + scsi_cmd_set(udev, &sc, 0, 0x46); + scsi_cmd_set(udev, &sc, 1, 1); + scsi_cmd_set(udev, &sc, 6, len >> 16); +@@ -440,6 +443,7 @@ static int cd_media_info(struct udev *udev, int fd) + }; + int err; + ++ memset (header, 0, sizeof (header)); + scsi_cmd_set(udev, &sc, 0, 0x51); + scsi_cmd_set(udev, &sc, 8, sizeof(header)); + scsi_cmd_set(udev, &sc, 9, 0); +@@ -472,6 +476,7 @@ static int cd_media_toc(struct udev *udev, int fd) + unsigned char *p; + int err; + ++ memset (header, 0, sizeof (header)); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 6, 1); + scsi_cmd_set(udev, &sc, 8, sizeof(header)); +@@ -493,6 +498,7 @@ static int cd_media_toc(struct udev *udev, int fd) + if (len < 8) + return 0; + ++ memset (toc, 0, sizeof (toc)); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ + scsi_cmd_set(udev, &sc, 7, len >> 8); +@@ -520,6 +526,7 @@ static int cd_media_toc(struct udev *udev, int fd) + cd_media_track_count_audio++; + } + ++ memset (header, 0, sizeof (header)); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ + scsi_cmd_set(udev, &sc, 8, 12); +-- +1.6.6 + diff --git a/udev.spec b/udev.spec index 9650791..adf52fc 100644 --- a/udev.spec +++ b/udev.spec @@ -5,7 +5,7 @@ Summary: A userspace implementation of devfs Name: udev Version: 151 -Release: 7%{?dist} +Release: 8%{?dist} License: GPLv2 Group: System Environment/Base Provides: udev-persistent = %{version}-%{release} @@ -36,6 +36,12 @@ Patch32: 0032-do-not-reset-SELinux-context-when-the-node-was-not-t.patch Patch34: 0034-add-LGPL-COPYING-to-libudev-and-GUdev.patch Patch35: 0035-cdrom_id-open-non-mounted-optical-media-with-O_EXCL.patch Patch36: 0036-modeswitch-morph-into-tool-that-only-switches-Mobile.patch +Patch48: 0048-cdrom_id-remove-debugging-code.patch +Patch49: 0049-cdrom_id-retry-to-open-the-device-if-EBUSY.patch +Patch50: 0050-cdrom_id-check-mount-state-in-retry-loop.patch +Patch51: 0051-cdrom_id-always-set-ID_CDROM-regardless-if-we-can-ru.patch +Patch62: 0062-cdrom_id-Fix-uninitialized-variables.patch +Patch65: 0065-cdrom_id-Fix-uninitialized-buffers.patch Patch101: udev-151-rules.patch Patch102: udev-151-virtio.patch @@ -159,6 +165,12 @@ glib-based applications using libudev functionality. %patch34 -p1 -b .git34 %patch35 -p1 -b .git35 %patch36 -p1 -b .git36 +%patch48 -p1 -b .git48 +%patch49 -p1 -b .git49 +%patch50 -p1 -b .git50 +%patch51 -p1 -b .git51 +%patch62 -p1 -b .git62 +%patch65 -p1 -b .git65 %patch101 -p1 %patch102 -p1 @@ -399,6 +411,10 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_libdir}/pkgconfig/gudev-1.0* %changelog +* Tue Apr 13 2010 Harald Hoyer 151-8 +- more cdrom_id bugfixes for buggy cdroms and CD burning + (bug #577659) + * Mon Mar 22 2010 Harald Hoyer 151-7 - only correct the timestamp, if UTC=="no" From b8ad91fd93359f33c446960d884c055339d7e952 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Tue, 27 Apr 2010 10:41:44 +0000 Subject: [PATCH 11/24] - more cdrom_id bugfixes to prevent autoclosing --- ...on-mounted-optical-media-with-O_EXCL.patch | 4 +- 0048-cdrom_id-remove-debugging-code.patch | 4 +- ...id-retry-to-open-the-device-if-EBUSY.patch | 4 +- ...m_id-check-mount-state-in-retry-loop.patch | 4 +- ...set-ID_CDROM-regardless-if-we-can-ru.patch | 4 +- ...cdrom_id-Fix-uninitialized-variables.patch | 4 +- 0065-cdrom_id-Fix-uninitialized-buffers.patch | 4 +- 0066-cdrom_id.patch | 88 ++++++ ...work-feature-profiles-buffer-parsing.patch | 277 ++++++++++++++++++ 0068-cdrom_id-print-more-debug-messages.patch | 121 ++++++++ ...id-debug-print-feature-values-in-hex.patch | 25 ++ ...id-debug-print-feature-values-in-hex.patch | 25 ++ ...-not-ignore-errors-from-scsi_cmd_run.patch | 79 +++++ ...wap-media-state-and-TOC-info-probing.patch | 38 +++ ...missing-profiles-to-feature_profiles.patch | 36 +++ ...D_CDROM_MEDIA-1-only-for-known-media.patch | 183 ++++++++++++ ...drom_id-only-mark-sr-0-9-as-ID_CDROM.patch | 26 ++ Makefile.git | 4 +- udev.spec | 26 +- 19 files changed, 939 insertions(+), 17 deletions(-) create mode 100644 0066-cdrom_id.patch create mode 100644 0067-cdrom_id-rework-feature-profiles-buffer-parsing.patch create mode 100644 0068-cdrom_id-print-more-debug-messages.patch create mode 100644 0069-cdrom_id-debug-print-feature-values-in-hex.patch create mode 100644 0070-cdrom_id-debug-print-feature-values-in-hex.patch create mode 100644 0071-cdrom_id-Do-not-ignore-errors-from-scsi_cmd_run.patch create mode 100644 0072-cdrom_id-Swap-media-state-and-TOC-info-probing.patch create mode 100644 0074-cdrom_id-add-missing-profiles-to-feature_profiles.patch create mode 100644 0075-cdrom_id-set-ID_CDROM_MEDIA-1-only-for-known-media.patch create mode 100644 0110-cdrom_id-only-mark-sr-0-9-as-ID_CDROM.patch diff --git a/0035-cdrom_id-open-non-mounted-optical-media-with-O_EXCL.patch b/0035-cdrom_id-open-non-mounted-optical-media-with-O_EXCL.patch index 0d34327..e21cb4d 100644 --- a/0035-cdrom_id-open-non-mounted-optical-media-with-O_EXCL.patch +++ b/0035-cdrom_id-open-non-mounted-optical-media-with-O_EXCL.patch @@ -1,7 +1,7 @@ From 38a3cde11bc77af49a96245b8a8a0f2b583a344c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 18 Mar 2010 11:14:32 +0100 -Subject: [PATCH 35/65] cdrom_id: open non-mounted optical media with O_EXCL +Subject: [PATCH 035/110] cdrom_id: open non-mounted optical media with O_EXCL This should prevent confusing drives during CD burning sessions. Based on a patch from Harald Hoyer. @@ -54,5 +54,5 @@ index 2380b15..e485768 100644 info(udev, "unable to open '%s'\n", node); fprintf(stderr, "unable to open '%s'\n", node); -- -1.6.6 +1.7.0.1 diff --git a/0048-cdrom_id-remove-debugging-code.patch b/0048-cdrom_id-remove-debugging-code.patch index 57a4e07..d1043ce 100644 --- a/0048-cdrom_id-remove-debugging-code.patch +++ b/0048-cdrom_id-remove-debugging-code.patch @@ -1,7 +1,7 @@ From 36a07a8c34a4cff5ad2bbb6e0fdfed49e8191661 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 7 Apr 2010 09:23:46 +0200 -Subject: [PATCH 48/65] cdrom_id: remove debugging code +Subject: [PATCH 048/110] cdrom_id: remove debugging code --- extras/cdrom_id/cdrom_id.c | 1 - @@ -20,5 +20,5 @@ index e485768..036ef28 100644 mounted = 1; break; -- -1.6.6 +1.7.0.1 diff --git a/0049-cdrom_id-retry-to-open-the-device-if-EBUSY.patch b/0049-cdrom_id-retry-to-open-the-device-if-EBUSY.patch index f7e6b27..2f94c4d 100644 --- a/0049-cdrom_id-retry-to-open-the-device-if-EBUSY.patch +++ b/0049-cdrom_id-retry-to-open-the-device-if-EBUSY.patch @@ -1,7 +1,7 @@ From cccfffbe04c01be12fb42cb12f3f7aa5e2a22dd4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Apr 2010 09:24:25 +0200 -Subject: [PATCH 49/65] cdrom_id: retry to open the device, if EBUSY +Subject: [PATCH 049/110] cdrom_id: retry to open the device, if EBUSY 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 @@ -49,5 +49,5 @@ index 036ef28..7c9f8cc 100644 info(udev, "unable to open '%s'\n", node); fprintf(stderr, "unable to open '%s'\n", node); -- -1.6.6 +1.7.0.1 diff --git a/0050-cdrom_id-check-mount-state-in-retry-loop.patch b/0050-cdrom_id-check-mount-state-in-retry-loop.patch index b4fb62b..e9c3cfd 100644 --- a/0050-cdrom_id-check-mount-state-in-retry-loop.patch +++ b/0050-cdrom_id-check-mount-state-in-retry-loop.patch @@ -1,7 +1,7 @@ From d45c8c8b01c99180f15e24b22f7cf81eaf3cdd1b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Apr 2010 11:32:22 +0200 -Subject: [PATCH 50/65] cdrom_id: check mount state in retry loop +Subject: [PATCH 050/110] cdrom_id: check mount state in retry loop Based on a patch from Harald Hoyer. --- @@ -51,5 +51,5 @@ index 7c9f8cc..894a890 100644 if (fd < 0) { info(udev, "unable to open '%s'\n", node); -- -1.6.6 +1.7.0.1 diff --git a/0051-cdrom_id-always-set-ID_CDROM-regardless-if-we-can-ru.patch b/0051-cdrom_id-always-set-ID_CDROM-regardless-if-we-can-ru.patch index 1d3be0e..a9bc162 100644 --- a/0051-cdrom_id-always-set-ID_CDROM-regardless-if-we-can-ru.patch +++ b/0051-cdrom_id-always-set-ID_CDROM-regardless-if-we-can-ru.patch @@ -1,7 +1,7 @@ From 5c5ebde711c4560ae0560e87c33fe477b5add354 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Apr 2010 01:12:23 +0200 -Subject: [PATCH 51/65] cdrom_id: always set ID_CDROM regardless if we can run cdrom_id +Subject: [PATCH 051/110] cdrom_id: always set ID_CDROM regardless if we can run cdrom_id --- extras/cdrom_id/60-cdrom_id.rules | 12 +++++++++--- @@ -27,5 +27,5 @@ index 132a680..811c4aa 100644 + +LABEL="cdrom_end" -- -1.6.6 +1.7.0.1 diff --git a/0062-cdrom_id-Fix-uninitialized-variables.patch b/0062-cdrom_id-Fix-uninitialized-variables.patch index 1caba57..b53056a 100644 --- a/0062-cdrom_id-Fix-uninitialized-variables.patch +++ b/0062-cdrom_id-Fix-uninitialized-variables.patch @@ -1,7 +1,7 @@ From 816e6bf0fb0849d03696a4b4ec2334e35e819425 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 13 Apr 2010 10:49:24 +0200 -Subject: [PATCH 62/65] cdrom_id: Fix uninitialized variables +Subject: [PATCH 062/110] cdrom_id: Fix uninitialized variables 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 @@ -127,5 +127,5 @@ index 894a890..db3867c 100644 #define ERRCODE(s) ((((s)[2] & 0x0F) << 16) | ((s)[12] << 8) | ((s)[13])) #define SK(errcode) (((errcode) >> 16) & 0xF) -- -1.6.6 +1.7.0.1 diff --git a/0065-cdrom_id-Fix-uninitialized-buffers.patch b/0065-cdrom_id-Fix-uninitialized-buffers.patch index 310e3c6..e0f3eb2 100644 --- a/0065-cdrom_id-Fix-uninitialized-buffers.patch +++ b/0065-cdrom_id-Fix-uninitialized-buffers.patch @@ -1,7 +1,7 @@ From 2b861dc92757b9a3214c2b8e9d8b1c3f3c162391 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 13 Apr 2010 15:25:48 +0200 -Subject: [PATCH 65/65] cdrom_id: Fix uninitialized buffers +Subject: [PATCH 065/110] cdrom_id: Fix uninitialized buffers 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 @@ -78,5 +78,5 @@ index db3867c..b6797cd 100644 scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ scsi_cmd_set(udev, &sc, 8, 12); -- -1.6.6 +1.7.0.1 diff --git a/0066-cdrom_id.patch b/0066-cdrom_id.patch new file mode 100644 index 0000000..2ff817c --- /dev/null +++ b/0066-cdrom_id.patch @@ -0,0 +1,88 @@ +diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c +index b6797cd..afb481d 100644 +--- a/extras/cdrom_id/cdrom_id.c ++++ b/extras/cdrom_id/cdrom_id.c +@@ -1,7 +1,7 @@ + /* + * cdrom_id - optical drive and media information prober + * +- * Copyright (C) 2008 Kay Sievers ++ * Copyright (C) 2008-2010 Kay Sievers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -157,7 +157,7 @@ struct scsi_cmd { + static void scsi_cmd_set(struct udev *udev, struct scsi_cmd *cmd, size_t i, int arg) + { + if (i == 0) { +- memset(cmd, 0x00, sizeof(struct scsi_cmd)); ++ memset(cmd, 0, sizeof(struct scsi_cmd)); + cmd->cgc.quiet = 1; + cmd->cgc.sense = &cmd->_sense.s; + memset(&cmd->sg_io, 0, sizeof(cmd->sg_io)); +@@ -237,7 +237,7 @@ static int cd_inquiry(struct udev *udev, int fd) { + unsigned char inq[128]; + int err; + +- memset (inq, 0, sizeof (inq)); ++ memset(inq, 0, sizeof(inq)); + scsi_cmd_set(udev, &sc, 0, 0x12); + scsi_cmd_set(udev, &sc, 4, 36); + scsi_cmd_set(udev, &sc, 5, 0); +@@ -266,7 +266,7 @@ static int cd_profiles(struct udev *udev, int fd) + unsigned int i; + int err; + +- memset (header, 0, sizeof (header)); ++ memset(header, 0, sizeof(header)); + scsi_cmd_set(udev, &sc, 0, 0x46); + scsi_cmd_set(udev, &sc, 1, 0); + scsi_cmd_set(udev, &sc, 8, sizeof(header)); +@@ -284,7 +284,7 @@ static int cd_profiles(struct udev *udev, int fd) + return -1; + } + +- memset (profiles, 0, sizeof (profiles)); ++ memset(profiles, 0, sizeof(profiles)); + scsi_cmd_set(udev, &sc, 0, 0x46); + scsi_cmd_set(udev, &sc, 1, 1); + scsi_cmd_set(udev, &sc, 6, len >> 16); +@@ -443,7 +443,7 @@ static int cd_media_info(struct udev *udev, int fd) + }; + int err; + +- memset (header, 0, sizeof (header)); ++ memset(header, 0, sizeof(header)); + scsi_cmd_set(udev, &sc, 0, 0x51); + scsi_cmd_set(udev, &sc, 8, sizeof(header)); + scsi_cmd_set(udev, &sc, 9, 0); +@@ -476,7 +476,7 @@ static int cd_media_toc(struct udev *udev, int fd) + unsigned char *p; + int err; + +- memset (header, 0, sizeof (header)); ++ memset(header, 0, sizeof(header)); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 6, 1); + scsi_cmd_set(udev, &sc, 8, sizeof(header)); +@@ -498,7 +498,7 @@ static int cd_media_toc(struct udev *udev, int fd) + if (len < 8) + return 0; + +- memset (toc, 0, sizeof (toc)); ++ memset(toc, 0, sizeof(toc)); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ + scsi_cmd_set(udev, &sc, 7, len >> 8); +@@ -526,7 +526,7 @@ static int cd_media_toc(struct udev *udev, int fd) + cd_media_track_count_audio++; + } + +- memset (header, 0, sizeof (header)); ++ memset(header, 0, sizeof (header)); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ + scsi_cmd_set(udev, &sc, 8, 12); +-- +1.7.0.1 + diff --git a/0067-cdrom_id-rework-feature-profiles-buffer-parsing.patch b/0067-cdrom_id-rework-feature-profiles-buffer-parsing.patch new file mode 100644 index 0000000..8f96622 --- /dev/null +++ b/0067-cdrom_id-rework-feature-profiles-buffer-parsing.patch @@ -0,0 +1,277 @@ +From 0413a47ebfcd46ae43cb56ad508b2484bc97ff14 Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Thu, 15 Apr 2010 20:07:07 +0200 +Subject: [PATCH 067/110] cdrom_id: rework feature/profiles buffer parsing + +--- + extras/cdrom_id/cdrom_id.c | 156 +++++++++++++++++++++++++------------------ + 1 files changed, 91 insertions(+), 65 deletions(-) + +diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c +index afb481d..3f9ca4c 100644 +--- a/extras/cdrom_id/cdrom_id.c ++++ b/extras/cdrom_id/cdrom_id.c +@@ -154,19 +154,22 @@ struct scsi_cmd { + struct sg_io_hdr sg_io; + }; + +-static void scsi_cmd_set(struct udev *udev, struct scsi_cmd *cmd, size_t i, int arg) ++static void scsi_cmd_init(struct udev *udev, struct scsi_cmd *cmd, unsigned char *buf, size_t bufsize) ++{ ++ memset(cmd, 0x00, sizeof(struct scsi_cmd)); ++ memset(buf, 0x00, bufsize); ++ cmd->cgc.quiet = 1; ++ cmd->cgc.sense = &cmd->_sense.s; ++ memset(&cmd->sg_io, 0, sizeof(cmd->sg_io)); ++ cmd->sg_io.interface_id = 'S'; ++ cmd->sg_io.mx_sb_len = sizeof(cmd->_sense); ++ cmd->sg_io.cmdp = cmd->cgc.cmd; ++ cmd->sg_io.sbp = cmd->_sense.u; ++ cmd->sg_io.flags = SG_FLAG_LUN_INHIBIT | SG_FLAG_DIRECT_IO; ++} ++ ++static void scsi_cmd_set(struct udev *udev, struct scsi_cmd *cmd, size_t i, unsigned char arg) + { +- if (i == 0) { +- memset(cmd, 0, sizeof(struct scsi_cmd)); +- cmd->cgc.quiet = 1; +- cmd->cgc.sense = &cmd->_sense.s; +- memset(&cmd->sg_io, 0, sizeof(cmd->sg_io)); +- cmd->sg_io.interface_id = 'S'; +- cmd->sg_io.mx_sb_len = sizeof(cmd->_sense); +- cmd->sg_io.cmdp = cmd->cgc.cmd; +- cmd->sg_io.sbp = cmd->_sense.u; +- cmd->sg_io.flags = SG_FLAG_LUN_INHIBIT | SG_FLAG_DIRECT_IO; +- } + cmd->sg_io.cmd_len = i + 1; + cmd->cgc.cmd[i] = arg; + } +@@ -237,7 +240,7 @@ static int cd_inquiry(struct udev *udev, int fd) { + unsigned char inq[128]; + int err; + +- memset(inq, 0, sizeof(inq)); ++ scsi_cmd_init(udev, &sc, inq, sizeof(inq)); + scsi_cmd_set(udev, &sc, 0, 0x12); + scsi_cmd_set(udev, &sc, 4, 36); + scsi_cmd_set(udev, &sc, 5, 0); +@@ -256,109 +259,132 @@ static int cd_inquiry(struct udev *udev, int fd) { + return 0; + } + +-static int cd_profiles(struct udev *udev, int fd) ++static int feature_profiles(struct udev *udev, const unsigned char *profiles, size_t size) + { +- struct scsi_cmd sc; +- unsigned char header[8]; +- unsigned char profiles[512]; +- unsigned int cur_profile; +- unsigned int len; + unsigned int i; +- int err; +- +- memset(header, 0, sizeof(header)); +- scsi_cmd_set(udev, &sc, 0, 0x46); +- scsi_cmd_set(udev, &sc, 1, 0); +- scsi_cmd_set(udev, &sc, 8, sizeof(header)); +- scsi_cmd_set(udev, &sc, 9, 0); +- err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); +- if ((err < 0)) { +- info_scsi_cmd_err(udev, "GET CONFIGURATION", err); +- return -1; +- } + +- len = 4 + (header[0] << 24 | header[1] << 16 | header[2] << 8 | header[3]); +- info(udev, "GET CONFIGURATION: number of profiles %i\n", len); +- if (len > sizeof(profiles)) { +- info(udev, "invalid number of profiles\n"); +- return -1; +- } +- +- memset(profiles, 0, sizeof(profiles)); +- scsi_cmd_set(udev, &sc, 0, 0x46); +- scsi_cmd_set(udev, &sc, 1, 1); +- scsi_cmd_set(udev, &sc, 6, len >> 16); +- scsi_cmd_set(udev, &sc, 7, len >> 8); +- scsi_cmd_set(udev, &sc, 8, len); +- scsi_cmd_set(udev, &sc, 9, 0); +- err = scsi_cmd_run(udev, &sc, fd, profiles, len); +- if ((err < 0)) { +- info_scsi_cmd_err(udev, "GET CONFIGURATION", err); +- return -1; +- } +- +- /* device profiles */ +- for (i = 12; i < profiles[11]; i += 4) { +- unsigned int profile = (profiles[i] << 8 | profiles[i + 1]); +- if (profile == 0) +- continue; +- info(udev, "profile 0x%02x\n", profile); ++ for (i = 0; i+4 <= size; i += 4) { ++ int profile; + ++ profile = profiles[i] << 8 | profiles[i+1]; + switch (profile) { + case 0x03: + case 0x04: + case 0x05: ++ info(udev, "profile 0x%02x mo\n", profile); + cd_mo = 1; +- break; ++ break; + case 0x10: ++ info(udev, "profile 0x%02x dvd_rom\n", profile); + cd_dvd_rom = 1; + break; + case 0x12: ++ info(udev, "profile 0x%02x dvd_ram\n", profile); + cd_dvd_ram = 1; + break; + case 0x13: + case 0x14: ++ info(udev, "profile 0x%02x dvd_rw\n", profile); + cd_dvd_rw = 1; + break; + case 0x1B: ++ info(udev, "profile 0x%02x dvd_plus_r\n", profile); + cd_dvd_plus_r = 1; + break; + case 0x1A: ++ info(udev, "profile 0x%02x dvd_plus_rw\n", profile); + cd_dvd_plus_rw = 1; + break; + case 0x2A: ++ info(udev, "profile 0x%02x dvd_plus_rw_dl\n", profile); + cd_dvd_plus_rw_dl = 1; + break; + case 0x2B: ++ info(udev, "profile 0x%02x dvd_plus_r_dl\n", profile); + cd_dvd_plus_r_dl = 1; + break; + case 0x40: + cd_bd = 1; ++ info(udev, "profile 0x%02x bd\n", profile); + break; + case 0x41: + case 0x42: + cd_bd_r = 1; ++ info(udev, "profile 0x%02x bd_r\n", profile); + break; + case 0x43: + cd_bd_re = 1; ++ info(udev, "profile 0x%02x bd_re\n", profile); + break; + case 0x50: + cd_hddvd = 1; ++ info(udev, "profile 0x%02x hddvd\n", profile); + break; + case 0x51: + cd_hddvd_r = 1; ++ info(udev, "profile 0x%02x hddvd_r\n", profile); + break; + case 0x52: + cd_hddvd_rw = 1; ++ info(udev, "profile 0x%02x hddvd_rw\n", profile); ++ break; ++ default: ++ info(udev, "profile 0x%02x \n", profile); ++ break; ++ } ++ } ++ return 0; ++} ++ ++static int cd_profiles(struct udev *udev, int fd) ++{ ++ struct scsi_cmd sc; ++ unsigned char features[65530]; ++ unsigned int cur_profile = 0; ++ unsigned int len; ++ unsigned int i; ++ int err; ++ ++ scsi_cmd_init(udev, &sc, features, sizeof(features)); ++ scsi_cmd_set(udev, &sc, 0, 0x46); ++ scsi_cmd_set(udev, &sc, 7, (sizeof(features) >> 8) & 0xff); ++ scsi_cmd_set(udev, &sc, 8, sizeof(features) & 0xff); ++ scsi_cmd_set(udev, &sc, 9, 0); ++ err = scsi_cmd_run(udev, &sc, fd, features, sizeof(features)); ++ if ((err < 0)) { ++ info_scsi_cmd_err(udev, "GET CONFIGURATION", err); ++ return -1; ++ } ++ ++ len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; ++ info(udev, "GET CONFIGURATION: size of features buffer %i\n", len); ++ ++ if (len > sizeof(features)) { ++ info(udev, "can not get features in a single query, truncating\n"); ++ len = sizeof(features); ++ } ++ ++ /* device features */ ++ for (i = 8; i+4 < len; i += (4 + features[i+3])) { ++ unsigned int feature; ++ ++ feature = features[i] << 8 | features[i+1]; ++ ++ switch (feature) { ++ case 0x00: ++ info(udev, "GET CONFIGURATION: feature 'profiles', with %i entries\n", features[i+3] / 4); ++ feature_profiles(udev, &features[i]+4, features[i+3]); ++ ++ /* set current profile, if we got a profiles section */ ++ cur_profile = features[6] << 8 | features[7]; ++ info(udev, "current profile 0x%02x\n", cur_profile); + break; + default: ++ info(udev, "GET CONFIGURATION: feature %i , with %i bytes\n", feature, features[i+3]); + break; + } + } + +- /* current media profile */ +- cur_profile = header[6] << 8 | header[7]; +- info(udev, "current profile 0x%02x\n", cur_profile); + if (cur_profile == 0) { + info(udev, "no current profile, assuming no media\n"); + return -1; +@@ -443,7 +469,7 @@ static int cd_media_info(struct udev *udev, int fd) + }; + int err; + +- memset(header, 0, sizeof(header)); ++ scsi_cmd_init(udev, &sc, header, sizeof(header)); + scsi_cmd_set(udev, &sc, 0, 0x51); + scsi_cmd_set(udev, &sc, 8, sizeof(header)); + scsi_cmd_set(udev, &sc, 9, 0); +@@ -476,7 +502,7 @@ static int cd_media_toc(struct udev *udev, int fd) + unsigned char *p; + int err; + +- memset(header, 0, sizeof(header)); ++ scsi_cmd_init(udev, &sc, header, sizeof(header)); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 6, 1); + scsi_cmd_set(udev, &sc, 8, sizeof(header)); +@@ -498,7 +524,7 @@ static int cd_media_toc(struct udev *udev, int fd) + if (len < 8) + return 0; + +- memset(toc, 0, sizeof(toc)); ++ scsi_cmd_init(udev, &sc, toc, sizeof(toc)); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ + scsi_cmd_set(udev, &sc, 7, len >> 8); +@@ -526,7 +552,7 @@ static int cd_media_toc(struct udev *udev, int fd) + cd_media_track_count_audio++; + } + +- memset(header, 0, sizeof (header)); ++ scsi_cmd_init(udev, &sc, header, sizeof(header)); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ + scsi_cmd_set(udev, &sc, 8, 12); +-- +1.7.0.1 + diff --git a/0068-cdrom_id-print-more-debug-messages.patch b/0068-cdrom_id-print-more-debug-messages.patch new file mode 100644 index 0000000..672c1bc --- /dev/null +++ b/0068-cdrom_id-print-more-debug-messages.patch @@ -0,0 +1,121 @@ +From 2e9df1981833e1e029b7ce6c12a44dffb6aad0cb Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Thu, 15 Apr 2010 20:48:04 +0200 +Subject: [PATCH 068/110] cdrom_id: print more debug messages + +--- + extras/cdrom_id/cdrom_id.c | 28 +++++++++++++++++++++++----- + 1 files changed, 23 insertions(+), 5 deletions(-) + +diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c +index 3f9ca4c..d9b6fbd 100644 +--- a/extras/cdrom_id/cdrom_id.c ++++ b/extras/cdrom_id/cdrom_id.c +@@ -374,10 +374,6 @@ static int cd_profiles(struct udev *udev, int fd) + case 0x00: + info(udev, "GET CONFIGURATION: feature 'profiles', with %i entries\n", features[i+3] / 4); + feature_profiles(udev, &features[i]+4, features[i+3]); +- +- /* set current profile, if we got a profiles section */ +- cur_profile = features[6] << 8 | features[7]; +- info(udev, "current profile 0x%02x\n", cur_profile); + break; + default: + info(udev, "GET CONFIGURATION: feature %i , with %i bytes\n", feature, features[i+3]); +@@ -385,7 +381,10 @@ static int cd_profiles(struct udev *udev, int fd) + } + } + +- if (cur_profile == 0) { ++ cur_profile = features[6] << 8 | features[7]; ++ if (cur_profile > 0) { ++ info(udev, "current profile 0x%02x\n", cur_profile); ++ } else { + info(udev, "no current profile, assuming no media\n"); + return -1; + } +@@ -396,62 +395,81 @@ static int cd_profiles(struct udev *udev, int fd) + case 0x03: + case 0x04: + case 0x05: ++ info(udev, "profile 0x%02x \n", cur_profile); + cd_media_mo = 1; + break; + case 0x08: ++ info(udev, "profile 0x%02x media_cd_rom\n", cur_profile); + cd_media_cd_rom = 1; + break; + case 0x09: ++ info(udev, "profile 0x%02x media_cd_r\n", cur_profile); + cd_media_cd_r = 1; + break; + case 0x0a: ++ info(udev, "profile 0x%02x media_cd_rw\n", cur_profile); + cd_media_cd_rw = 1; + break; + case 0x10: ++ info(udev, "profile 0x%02x media_dvd_ro\n", cur_profile); + cd_media_dvd_rom = 1; + break; + case 0x11: ++ info(udev, "profile 0x%02x media_dvd_r\n", cur_profile); + cd_media_dvd_r = 1; + break; + case 0x12: ++ info(udev, "profile 0x%02x media_dvd_ram\n", cur_profile); + cd_media_dvd_ram = 1; + break; + case 0x13: + case 0x14: ++ info(udev, "profile 0x%02x media_dvd_rw\n", cur_profile); + cd_media_dvd_rw = 1; + break; + case 0x1B: ++ info(udev, "profile 0x%02x media_dvd_plus_r\n", cur_profile); + cd_media_dvd_plus_r = 1; + break; + case 0x1A: ++ info(udev, "profile 0x%02x media_dvd_plus_rw\n", cur_profile); + cd_media_dvd_plus_rw = 1; + break; + case 0x2A: ++ info(udev, "profile 0x%02x media_dvd_plus_rw_dl\n", cur_profile); + 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_dvd_plus_r_dl = 1; + break; + case 0x40: ++ info(udev, "profile 0x%02x media_bd\n", cur_profile); + cd_media_bd = 1; + break; + case 0x41: + case 0x42: ++ info(udev, "profile 0x%02x media_bd_r\n", cur_profile); + cd_media_bd_r = 1; + break; + case 0x43: ++ info(udev, "profile 0x%02x media_bd_re\n", cur_profile); + cd_media_bd_re = 1; + break; + case 0x50: ++ info(udev, "profile 0x%02x media_hddvd\n", cur_profile); + cd_media_hddvd = 1; + break; + case 0x51: ++ info(udev, "profile 0x%02x media_hddvd_r\n", cur_profile); + cd_media_hddvd_r = 1; + break; + case 0x52: ++ info(udev, "profile 0x%02x media_hddvd_rw\n", cur_profile); + cd_media_hddvd_rw = 1; + break; + default: ++ info(udev, "profile 0x%02x \n", cur_profile); + break; + } + return 0; +-- +1.7.0.1 + diff --git a/0069-cdrom_id-debug-print-feature-values-in-hex.patch b/0069-cdrom_id-debug-print-feature-values-in-hex.patch new file mode 100644 index 0000000..d34d52b --- /dev/null +++ b/0069-cdrom_id-debug-print-feature-values-in-hex.patch @@ -0,0 +1,25 @@ +From 140647ad1aec50e2f657e7838e893a87404ff83a Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Thu, 15 Apr 2010 21:18:21 +0200 +Subject: [PATCH 069/110] cdrom_id: debug - print feature values in hex + +--- + extras/cdrom_id/cdrom_id.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c +index d9b6fbd..b2c107b 100644 +--- a/extras/cdrom_id/cdrom_id.c ++++ b/extras/cdrom_id/cdrom_id.c +@@ -376,7 +376,7 @@ static int cd_profiles(struct udev *udev, int fd) + feature_profiles(udev, &features[i]+4, features[i+3]); + break; + default: +- info(udev, "GET CONFIGURATION: feature %i , with %i bytes\n", feature, features[i+3]); ++ info(udev, "GET CONFIGURATION: feature 0x%04x , with 0x%02x bytes\n", feature, features[i+3]); + break; + } + } +-- +1.7.0.1 + diff --git a/0070-cdrom_id-debug-print-feature-values-in-hex.patch b/0070-cdrom_id-debug-print-feature-values-in-hex.patch new file mode 100644 index 0000000..1ff0b25 --- /dev/null +++ b/0070-cdrom_id-debug-print-feature-values-in-hex.patch @@ -0,0 +1,25 @@ +From a60b077a465b19af2efd9bf0cb5f0f67117be780 Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Thu, 15 Apr 2010 21:22:38 +0200 +Subject: [PATCH 070/110] cdrom_id: debug - print feature values in hex + +--- + extras/cdrom_id/cdrom_id.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c +index b2c107b..16b1260 100644 +--- a/extras/cdrom_id/cdrom_id.c ++++ b/extras/cdrom_id/cdrom_id.c +@@ -357,7 +357,7 @@ static int cd_profiles(struct udev *udev, int fd) + } + + len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; +- info(udev, "GET CONFIGURATION: size of features buffer %i\n", len); ++ info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len); + + if (len > sizeof(features)) { + info(udev, "can not get features in a single query, truncating\n"); +-- +1.7.0.1 + diff --git a/0071-cdrom_id-Do-not-ignore-errors-from-scsi_cmd_run.patch b/0071-cdrom_id-Do-not-ignore-errors-from-scsi_cmd_run.patch new file mode 100644 index 0000000..b5543bf --- /dev/null +++ b/0071-cdrom_id-Do-not-ignore-errors-from-scsi_cmd_run.patch @@ -0,0 +1,79 @@ +From 58e178894bfc040834e1270c6fe9b9fdef513550 Mon Sep 17 00:00:00 2001 +From: Martin Pitt +Date: Thu, 15 Apr 2010 08:56:48 +0200 +Subject: [PATCH 071/110] cdrom_id: Do not ignore errors from scsi_cmd_run() + +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 for spotting this! + +https://launchpad.net/bugs/562978 +--- + extras/cdrom_id/cdrom_id.c | 12 ++++++------ + 1 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c +index 16b1260..37212e9 100644 +--- a/extras/cdrom_id/cdrom_id.c ++++ b/extras/cdrom_id/cdrom_id.c +@@ -245,7 +245,7 @@ static int cd_inquiry(struct udev *udev, int fd) { + scsi_cmd_set(udev, &sc, 4, 36); + scsi_cmd_set(udev, &sc, 5, 0); + err = scsi_cmd_run(udev, &sc, fd, inq, 36); +- if ((err < 0)) { ++ if ((err != 0)) { + info_scsi_cmd_err(udev, "INQUIRY", err); + return -1; + } +@@ -351,7 +351,7 @@ static int cd_profiles(struct udev *udev, int fd) + scsi_cmd_set(udev, &sc, 8, sizeof(features) & 0xff); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, features, sizeof(features)); +- if ((err < 0)) { ++ if ((err != 0)) { + info_scsi_cmd_err(udev, "GET CONFIGURATION", err); + return -1; + } +@@ -492,7 +492,7 @@ static int cd_media_info(struct udev *udev, int fd) + scsi_cmd_set(udev, &sc, 8, sizeof(header)); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); +- if ((err < 0)) { ++ if ((err != 0)) { + info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); + return -1; + }; +@@ -526,7 +526,7 @@ static int cd_media_toc(struct udev *udev, int fd) + scsi_cmd_set(udev, &sc, 8, sizeof(header)); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); +- if ((err < 0)) { ++ if ((err != 0)) { + info_scsi_cmd_err(udev, "READ TOC", err); + return -1; + } +@@ -549,7 +549,7 @@ static int cd_media_toc(struct udev *udev, int fd) + scsi_cmd_set(udev, &sc, 8, len); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, toc, len); +- if ((err < 0)) { ++ if ((err != 0)) { + info_scsi_cmd_err(udev, "READ TOC (tracks)", err); + return -1; + } +@@ -576,7 +576,7 @@ static int cd_media_toc(struct udev *udev, int fd) + scsi_cmd_set(udev, &sc, 8, 12); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); +- if ((err < 0)) { ++ if ((err != 0)) { + info_scsi_cmd_err(udev, "READ TOC (multi session)", err); + return -1; + } +-- +1.7.0.1 + diff --git a/0072-cdrom_id-Swap-media-state-and-TOC-info-probing.patch b/0072-cdrom_id-Swap-media-state-and-TOC-info-probing.patch new file mode 100644 index 0000000..2865983 --- /dev/null +++ b/0072-cdrom_id-Swap-media-state-and-TOC-info-probing.patch @@ -0,0 +1,38 @@ +From 30e3b1a0d3a3ec76f16736470dc656744848d941 Mon Sep 17 00:00:00 2001 +From: Martin Pitt +Date: Thu, 15 Apr 2010 21:25:57 +0200 +Subject: [PATCH 072/110] cdrom_id: Swap media state and TOC info probing + +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. +--- + extras/cdrom_id/cdrom_id.c | 8 ++++---- + 1 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c +index 37212e9..722b8f8 100644 +--- a/extras/cdrom_id/cdrom_id.c ++++ b/extras/cdrom_id/cdrom_id.c +@@ -681,14 +681,14 @@ int main(int argc, char *argv[]) + if (cd_profiles(udev, fd) < 0) + goto print; + +- /* get session/track info */ +- if (cd_media_toc(udev, fd) < 0) +- goto print; +- + /* get writable media state */ + if (cd_media_info(udev, fd) < 0) + goto print; + ++ /* get session/track info */ ++ if (cd_media_toc(udev, fd) < 0) ++ goto print; ++ + print: + printf("ID_CDROM=1\n"); + if (cd_cd_rom) +-- +1.7.0.1 + diff --git a/0074-cdrom_id-add-missing-profiles-to-feature_profiles.patch b/0074-cdrom_id-add-missing-profiles-to-feature_profiles.patch new file mode 100644 index 0000000..26e92b1 --- /dev/null +++ b/0074-cdrom_id-add-missing-profiles-to-feature_profiles.patch @@ -0,0 +1,36 @@ +From 7c07740ce7b0941844b15573449a730283d5bba5 Mon Sep 17 00:00:00 2001 +From: Mike Brudevold +Date: Thu, 15 Apr 2010 19:55:50 -0500 +Subject: [PATCH 074/110] cdrom_id: add missing profiles to feature_profiles + +Signed-off-by: Mike Brudevold +--- + extras/cdrom_id/cdrom_id.c | 12 ++++++++++++ + 1 files changed, 12 insertions(+), 0 deletions(-) + +diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c +index 722b8f8..da2785e 100644 +--- a/extras/cdrom_id/cdrom_id.c ++++ b/extras/cdrom_id/cdrom_id.c +@@ -274,6 +274,18 @@ static int feature_profiles(struct udev *udev, const unsigned char *profiles, si + info(udev, "profile 0x%02x mo\n", profile); + cd_mo = 1; + break; ++ case 0x08: ++ info(udev, "profile 0x%02x cd_rom\n", profile); ++ cd_cd_rom = 1; ++ break; ++ case 0x09: ++ info(udev, "profile 0x%02x cd_r\n", profile); ++ cd_cd_r = 1; ++ break; ++ case 0x0A: ++ info(udev, "profile 0x%02x cd_rw\n", profile); ++ cd_cd_rw = 1; ++ break; + case 0x10: + info(udev, "profile 0x%02x dvd_rom\n", profile); + cd_dvd_rom = 1; +-- +1.7.0.1 + diff --git a/0075-cdrom_id-set-ID_CDROM_MEDIA-1-only-for-known-media.patch b/0075-cdrom_id-set-ID_CDROM_MEDIA-1-only-for-known-media.patch new file mode 100644 index 0000000..091bba3 --- /dev/null +++ b/0075-cdrom_id-set-ID_CDROM_MEDIA-1-only-for-known-media.patch @@ -0,0 +1,183 @@ +From bc913ce47821ed030437ec9b25507b5dd52b59cb Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Sat, 17 Apr 2010 19:31:44 +0200 +Subject: [PATCH 075/110] cdrom_id: set ID_CDROM_MEDIA=1 only for known media + +On Sat, Apr 17, 2010 at 18:26, Mike Brudevold 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 +... + +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. +--- + extras/cdrom_id/cdrom_id.c | 33 +++++++++++++++++++++++++-------- + 1 files changed, 25 insertions(+), 8 deletions(-) + +diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c +index da2785e..935f117 100644 +--- a/extras/cdrom_id/cdrom_id.c ++++ b/extras/cdrom_id/cdrom_id.c +@@ -401,83 +401,99 @@ static int cd_profiles(struct udev *udev, int fd) + return -1; + } + +- cd_media = 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: + case 0x14: + info(udev, "profile 0x%02x media_dvd_rw\n", cur_profile); ++ cd_media = 1; + cd_media_dvd_rw = 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: +@@ -501,7 +517,7 @@ static int cd_media_info(struct udev *udev, int fd) + + scsi_cmd_init(udev, &sc, header, sizeof(header)); + scsi_cmd_set(udev, &sc, 0, 0x51); +- scsi_cmd_set(udev, &sc, 8, sizeof(header)); ++ scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); + if ((err != 0)) { +@@ -509,10 +525,11 @@ static int cd_media_info(struct udev *udev, int fd) + return -1; + }; + ++ cd_media = 1; + info(udev, "disk type %02x\n", header[8]); + + /* exclude plain CDROM, some fake cdroms return 0 for "blank" media here */ +- if (!cd_media_cd_rom && (header[2] & 3) < 4) ++ if (!cd_media_cd_rom) + cd_media_state = media_status[header[2] & 3]; + + if ((header[2] & 3) != 2) +@@ -535,7 +552,7 @@ static int cd_media_toc(struct udev *udev, int fd) + scsi_cmd_init(udev, &sc, header, sizeof(header)); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 6, 1); +- scsi_cmd_set(udev, &sc, 8, sizeof(header)); ++ scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); + if ((err != 0)) { +@@ -557,8 +574,8 @@ static int cd_media_toc(struct udev *udev, int fd) + scsi_cmd_init(udev, &sc, toc, sizeof(toc)); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ +- scsi_cmd_set(udev, &sc, 7, len >> 8); +- scsi_cmd_set(udev, &sc, 8, len); ++ scsi_cmd_set(udev, &sc, 7, (len >> 8) & 0xff); ++ scsi_cmd_set(udev, &sc, 8, len & 0xff); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, toc, len); + if ((err != 0)) { +@@ -585,7 +602,7 @@ static int cd_media_toc(struct udev *udev, int fd) + scsi_cmd_init(udev, &sc, header, sizeof(header)); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ +- scsi_cmd_set(udev, &sc, 8, 12); ++ scsi_cmd_set(udev, &sc, 8, sizeof(header)); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); + if ((err != 0)) { +-- +1.7.0.1 + diff --git a/0110-cdrom_id-only-mark-sr-0-9-as-ID_CDROM.patch b/0110-cdrom_id-only-mark-sr-0-9-as-ID_CDROM.patch new file mode 100644 index 0000000..cc4a088 --- /dev/null +++ b/0110-cdrom_id-only-mark-sr-0-9-as-ID_CDROM.patch @@ -0,0 +1,26 @@ +From 155e313bfda594b3d8e2a31d48f341765bdfa75d Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 27 Apr 2010 12:22:42 +0200 +Subject: [PATCH 110/110] cdrom_id: only mark sr[0-9]* as ID_CDROM + +we cannot be sure for xvd* +--- + extras/cdrom_id/60-cdrom_id.rules | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/extras/cdrom_id/60-cdrom_id.rules b/extras/cdrom_id/60-cdrom_id.rules +index 16b3af9..b3109f1 100644 +--- a/extras/cdrom_id/60-cdrom_id.rules ++++ b/extras/cdrom_id/60-cdrom_id.rules +@@ -5,7 +5,7 @@ SUBSYSTEM!="block", GOTO="cdrom_end" + KERNEL!="sr[0-9]*|xvd*", GOTO="cdrom_end" + ENV{DEVTYPE}!="disk", GOTO="cdrom_end" + +-ENV{ID_CDROM}="1" ++KERNEL=="sr[0-9]*", ENV{ID_CDROM}="1" + IMPORT{program}="cdrom_id --export $tempnode" + + LABEL="cdrom_end" +-- +1.7.0.1 + diff --git a/Makefile.git b/Makefile.git index ea5486a..d14c2d2 100644 --- a/Makefile.git +++ b/Makefile.git @@ -1,6 +1,6 @@ Patch: - @for i in 00*.patch; do n=$$[$$(echo $$i|cut -f 1 -d '-'|sed -e 's#^0*##')]; echo "Patch$$n: $$i";done + @for i in 0*.patch; do n=$$[$$(echo $$i|cut -f 1 -d '-'|sed -e 's#^0*##')]; echo "Patch$$n: $$i";done patch: - @for i in 00*.patch; do n=$$[$$(echo $$i|cut -f 1 -d '-'|sed -e 's#^0*##')]; echo "%patch$$n -p1 -b .git$$n";done + @for i in 0*.patch; do n=$$[$$(echo $$i|cut -f 1 -d '-'|sed -e 's#^0*##')]; echo "%patch$$n -p1 -b .git$$n";done diff --git a/udev.spec b/udev.spec index adf52fc..56dafb0 100644 --- a/udev.spec +++ b/udev.spec @@ -5,7 +5,7 @@ Summary: A userspace implementation of devfs Name: udev Version: 151 -Release: 8%{?dist} +Release: 9%{?dist} License: GPLv2 Group: System Environment/Base Provides: udev-persistent = %{version}-%{release} @@ -42,6 +42,17 @@ Patch50: 0050-cdrom_id-check-mount-state-in-retry-loop.patch Patch51: 0051-cdrom_id-always-set-ID_CDROM-regardless-if-we-can-ru.patch Patch62: 0062-cdrom_id-Fix-uninitialized-variables.patch Patch65: 0065-cdrom_id-Fix-uninitialized-buffers.patch +Patch66: 0066-cdrom_id.patch +Patch67: 0067-cdrom_id-rework-feature-profiles-buffer-parsing.patch +Patch68: 0068-cdrom_id-print-more-debug-messages.patch +Patch69: 0069-cdrom_id-debug-print-feature-values-in-hex.patch +Patch70: 0070-cdrom_id-debug-print-feature-values-in-hex.patch +Patch71: 0071-cdrom_id-Do-not-ignore-errors-from-scsi_cmd_run.patch +Patch72: 0072-cdrom_id-Swap-media-state-and-TOC-info-probing.patch +Patch74: 0074-cdrom_id-add-missing-profiles-to-feature_profiles.patch +Patch75: 0075-cdrom_id-set-ID_CDROM_MEDIA-1-only-for-known-media.patch +Patch110: 0110-cdrom_id-only-mark-sr-0-9-as-ID_CDROM.patch + Patch101: udev-151-rules.patch Patch102: udev-151-virtio.patch @@ -171,6 +182,16 @@ glib-based applications using libudev functionality. %patch51 -p1 -b .git51 %patch62 -p1 -b .git62 %patch65 -p1 -b .git65 +%patch66 -p1 -b .git66 +%patch67 -p1 -b .git67 +%patch68 -p1 -b .git68 +%patch69 -p1 -b .git69 +%patch70 -p1 -b .git70 +%patch71 -p1 -b .git71 +%patch72 -p1 -b .git72 +%patch74 -p1 -b .git74 +%patch75 -p1 -b .git75 +%patch110 -p1 -b .git110 %patch101 -p1 %patch102 -p1 @@ -411,6 +432,9 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_libdir}/pkgconfig/gudev-1.0* %changelog +* Tue Apr 27 2010 Harald Hoyer 151-9 +- more cdrom_id bugfixes to prevent autoclosing + * Tue Apr 13 2010 Harald Hoyer 151-8 - more cdrom_id bugfixes for buggy cdroms and CD burning (bug #577659) From c79a4d6abd80c20486cdf787b560ae5767a7c4f9 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 10 Jun 2010 13:08:14 +0000 Subject: [PATCH 12/24] - Revert patch for hid2hci rules, fixes keyboards not going into HCI (Bluetooth) mode after being plugged in (#595178) --- ...gitech-bluetooth-adapters-into-hci-m.patch | 29 ------------------- udev.spec | 8 +++-- 2 files changed, 5 insertions(+), 32 deletions(-) delete mode 100644 0031-Fix-switching-Logitech-bluetooth-adapters-into-hci-m.patch diff --git a/0031-Fix-switching-Logitech-bluetooth-adapters-into-hci-m.patch b/0031-Fix-switching-Logitech-bluetooth-adapters-into-hci-m.patch deleted file mode 100644 index a773b94..0000000 --- a/0031-Fix-switching-Logitech-bluetooth-adapters-into-hci-m.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 2b463cb050cbf77d9c6b51e0f5a9d89bf7eb1bc3 Mon Sep 17 00:00:00 2001 -From: Marco d'Itri -Date: Tue, 16 Mar 2010 12:47:42 +0100 -Subject: [PATCH 31/36] Fix switching Logitech bluetooth adapters into hci mode. - -http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=567237 -https://bugs.launchpad.net/ubuntu/+source/udev/+bug/444420 ---- - extras/hid2hci/70-hid2hci.rules | 4 ++-- - 1 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/extras/hid2hci/70-hid2hci.rules b/extras/hid2hci/70-hid2hci.rules -index e133afd..01ff30d 100644 ---- a/extras/hid2hci/70-hid2hci.rules -+++ b/extras/hid2hci/70-hid2hci.rules -@@ -10,8 +10,8 @@ ATTR{bInterfaceClass}=="03", ATTR{bInterfaceSubClass}=="01", ATTR{bInterfaceProt - ATTRS{bDeviceClass}=="00", ATTRS{idVendor}=="413c", ATTRS{bmAttributes}=="e0", \ - RUN+="hid2hci --method=dell --devpath=%p", ENV{HID2HCI_SWITCH}="1" - --# Logitech devices (hidraw) --KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[34bc]", \ -+# Logitech devices -+KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[34bc]", \ - RUN+="hid2hci --method=logitech-hid --devpath=%p" - - ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end" --- -1.6.6 - diff --git a/udev.spec b/udev.spec index 56dafb0..b4c6b1f 100644 --- a/udev.spec +++ b/udev.spec @@ -5,7 +5,7 @@ Summary: A userspace implementation of devfs Name: udev Version: 151 -Release: 9%{?dist} +Release: 10%{?dist} License: GPLv2 Group: System Environment/Base Provides: udev-persistent = %{version}-%{release} @@ -31,7 +31,6 @@ Patch21: 0021-input_id-Fix-linking.patch Patch22: 0022-replace-utimes-with-utimensat.patch Patch29: 0029-firmware-fix-possible-segfault-when-firmware-device-.patch Patch30: 0030-rules-input-create-by-path-links-for-pci-devices.patch -Patch31: 0031-Fix-switching-Logitech-bluetooth-adapters-into-hci-m.patch Patch32: 0032-do-not-reset-SELinux-context-when-the-node-was-not-t.patch Patch34: 0034-add-LGPL-COPYING-to-libudev-and-GUdev.patch Patch35: 0035-cdrom_id-open-non-mounted-optical-media-with-O_EXCL.patch @@ -171,7 +170,6 @@ glib-based applications using libudev functionality. %patch22 -p1 -b .git22 %patch29 -p1 -b .git29 %patch30 -p1 -b .git30 -%patch31 -p1 -b .git31 %patch32 -p1 -b .git32 %patch34 -p1 -b .git34 %patch35 -p1 -b .git35 @@ -432,6 +430,10 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_libdir}/pkgconfig/gudev-1.0* %changelog +* Thu Jun 10 2010 Bastien Nocera 151-10 +- Revert patch for hid2hci rules, fixes keyboards not going + into HCI (Bluetooth) mode after being plugged in (#595178) + * Tue Apr 27 2010 Harald Hoyer 151-9 - more cdrom_id bugfixes to prevent autoclosing From e4e1196b9f7f9cdb62010db4572bec141927ca2f Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 29 Jul 2010 14:37:42 +0000 Subject: [PATCH 13/24] dist-git conversion --- .cvsignore => .gitignore | 0 Makefile | 22 ---------------------- branch | 1 - 3 files changed, 23 deletions(-) rename .cvsignore => .gitignore (100%) delete mode 100644 Makefile delete mode 100644 branch diff --git a/.cvsignore b/.gitignore similarity index 100% rename from .cvsignore rename to .gitignore diff --git a/Makefile b/Makefile deleted file mode 100644 index c72f44b..0000000 --- a/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -# Makefile for source rpm: udev -# $Id: Makefile,v 1.3 2007/10/15 19:29:11 notting Exp $ -NAME := udev -SPECFILE = $(firstword $(wildcard *.spec)) -UPSTREAM_CHECKS = sign - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attempt a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) diff --git a/branch b/branch deleted file mode 100644 index baa94ef..0000000 --- a/branch +++ /dev/null @@ -1 +0,0 @@ -F-13 From b2bfe883963b5b7862ee1f29479939997ae1259b Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mon, 2 Aug 2010 18:50:58 +0200 Subject: [PATCH 14/24] * Mon Aug 02 2010 Harald Hoyer 151-11 - do not remove udev database Resolves: rhbz#610925 --- start_udev | 2 -- udev.spec | 6 +++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/start_udev b/start_udev index df6c41b..76c2649 100755 --- a/start_udev +++ b/start_udev @@ -261,8 +261,6 @@ LANG=C awk "\$2 == \"${udev_root%/}\" && ( \$3 == \"devtmpfs\" || \$3 == \"tmpfs make_extra_nodes kill_udevd > "$udev_root/null" 2>&1 -rm -fr $udev_root/.udev > "$udev_root/null" 2>&1 -mkdir -p $udev_root/.udev > "$udev_root/null" 2>&1 UDEV_OPTS="" if [ -f "/sys/class/tty/console/uevent" ]; then # trigger the sorted events diff --git a/udev.spec b/udev.spec index b4c6b1f..f809c07 100644 --- a/udev.spec +++ b/udev.spec @@ -5,7 +5,7 @@ Summary: A userspace implementation of devfs Name: udev Version: 151 -Release: 10%{?dist} +Release: 11%{?dist} License: GPLv2 Group: System Environment/Base Provides: udev-persistent = %{version}-%{release} @@ -430,6 +430,10 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_libdir}/pkgconfig/gudev-1.0* %changelog +* Mon Aug 02 2010 Harald Hoyer 151-11 +- do not remove udev database +Resolves: rhbz#610925 + * Thu Jun 10 2010 Bastien Nocera 151-10 - Revert patch for hid2hci rules, fixes keyboards not going into HCI (Bluetooth) mode after being plugged in (#595178) From f714968249ab53fcd19215d3d5095becae409b45 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mon, 2 Aug 2010 20:14:04 +0200 Subject: [PATCH 15/24] * Mon Aug 02 2010 Harald Hoyer 153-1 - version 153, because device-mapper needs IMPORT{db} - do not remove udev database Resolves: rhbz#610925 --- .gitignore | 2 + ...or-reporting-on-missing-firmware-fil.patch | 43 - ...eymap-Add-Dell-Inspiron-1011-Mini-10.patch | 26 - ...ix-brightness-keys-on-MSI-Wind-U-100.patch | 37 - ...ort-for-Gateway-AOA110-AOA150-clones.patch | 29 - 0005-keymap-Fix-LG-X110.patch | 64 - ...e-for-volume-keys-on-Dell-Studio-155.patch | 55 - 0007-keymap-Add-Toshiba-Satellite-M30X.patch | 55 - ...amsung-Q210-P210-force-release-quirk.patch | 30 - ...tsu-Amilo-1848-u-force-release-quirk.patch | 53 - ...er-size-when-advancing-past-NUL-byte.patch | 29 - ...ZE-not-UTIL_PATH_SIZE-to-truncate-pr.patch | 26 - ...se-UTIL_LINE_SIZE-from-2048-to-16384.patch | 37 - ...rts-rule-to-use-attr-instead-of-ATTR.patch | 29 - ...cl-Correctly-handle-ENV-ACL_MANAGE-0.patch | 47 - 0021-input_id-Fix-linking.patch | 27 - 0022-replace-utimes-with-utimensat.patch | 34 - ...sible-segfault-when-firmware-device-.patch | 40 - ...create-by-path-links-for-pci-devices.patch | 25 - ...inux-context-when-the-node-was-not-t.patch | 88 - ...on-mounted-optical-media-with-O_EXCL.patch | 58 - ...-into-tool-that-only-switches-Mobile.patch | 2142 ----------------- 0048-cdrom_id-remove-debugging-code.patch | 24 - ...id-retry-to-open-the-device-if-EBUSY.patch | 53 - ...m_id-check-mount-state-in-retry-loop.patch | 55 - ...set-ID_CDROM-regardless-if-we-can-ru.patch | 31 - ...cdrom_id-Fix-uninitialized-variables.patch | 131 - 0065-cdrom_id-Fix-uninitialized-buffers.patch | 82 - 0066-cdrom_id.patch | 88 - ...work-feature-profiles-buffer-parsing.patch | 277 --- 0068-cdrom_id-print-more-debug-messages.patch | 121 - ...id-debug-print-feature-values-in-hex.patch | 25 - ...id-debug-print-feature-values-in-hex.patch | 25 - ...-not-ignore-errors-from-scsi_cmd_run.patch | 79 - ...wap-media-state-and-TOC-info-probing.patch | 38 - ...missing-profiles-to-feature_profiles.patch | 36 - ...D_CDROM_MEDIA-1-only-for-known-media.patch | 183 -- 40-ia64.rules | 4 + 40-isdn.rules | 4 + 40-ppc.rules | 6 + 40-s390.rules | 4 + 64-device-mapper.rules | 4 + 64-md-raid.rules | 36 + sources | 3 +- udev.spec | 102 +- 45 files changed, 80 insertions(+), 4307 deletions(-) delete mode 100644 0001-firmware-fix-error-reporting-on-missing-firmware-fil.patch delete mode 100644 0002-keymap-Add-Dell-Inspiron-1011-Mini-10.patch delete mode 100644 0003-Fix-brightness-keys-on-MSI-Wind-U-100.patch delete mode 100644 0004-keymap-Add-support-for-Gateway-AOA110-AOA150-clones.patch delete mode 100644 0005-keymap-Fix-LG-X110.patch delete mode 100644 0006-Force-key-release-for-volume-keys-on-Dell-Studio-155.patch delete mode 100644 0007-keymap-Add-Toshiba-Satellite-M30X.patch delete mode 100644 0013-keymap-Add-Samsung-Q210-P210-force-release-quirk.patch delete mode 100644 0014-keymap-Add-Fujitsu-Amilo-1848-u-force-release-quirk.patch delete mode 100644 0015-Decrease-buffer-size-when-advancing-past-NUL-byte.patch delete mode 100644 0016-Use-UTIL_LINE_SIZE-not-UTIL_PATH_SIZE-to-truncate-pr.patch delete mode 100644 0017-Increase-UTIL_LINE_SIZE-from-2048-to-16384.patch delete mode 100644 0018-Fix-virtio-ports-rule-to-use-attr-instead-of-ATTR.patch delete mode 100644 0019-udev-acl-Correctly-handle-ENV-ACL_MANAGE-0.patch delete mode 100644 0021-input_id-Fix-linking.patch delete mode 100644 0022-replace-utimes-with-utimensat.patch delete mode 100644 0029-firmware-fix-possible-segfault-when-firmware-device-.patch delete mode 100644 0030-rules-input-create-by-path-links-for-pci-devices.patch delete mode 100644 0032-do-not-reset-SELinux-context-when-the-node-was-not-t.patch delete mode 100644 0035-cdrom_id-open-non-mounted-optical-media-with-O_EXCL.patch delete mode 100644 0036-modeswitch-morph-into-tool-that-only-switches-Mobile.patch delete mode 100644 0048-cdrom_id-remove-debugging-code.patch delete mode 100644 0049-cdrom_id-retry-to-open-the-device-if-EBUSY.patch delete mode 100644 0050-cdrom_id-check-mount-state-in-retry-loop.patch delete mode 100644 0051-cdrom_id-always-set-ID_CDROM-regardless-if-we-can-ru.patch delete mode 100644 0062-cdrom_id-Fix-uninitialized-variables.patch delete mode 100644 0065-cdrom_id-Fix-uninitialized-buffers.patch delete mode 100644 0066-cdrom_id.patch delete mode 100644 0067-cdrom_id-rework-feature-profiles-buffer-parsing.patch delete mode 100644 0068-cdrom_id-print-more-debug-messages.patch delete mode 100644 0069-cdrom_id-debug-print-feature-values-in-hex.patch delete mode 100644 0070-cdrom_id-debug-print-feature-values-in-hex.patch delete mode 100644 0071-cdrom_id-Do-not-ignore-errors-from-scsi_cmd_run.patch delete mode 100644 0072-cdrom_id-Swap-media-state-and-TOC-info-probing.patch delete mode 100644 0074-cdrom_id-add-missing-profiles-to-feature_profiles.patch delete mode 100644 0075-cdrom_id-set-ID_CDROM_MEDIA-1-only-for-known-media.patch create mode 100644 40-ia64.rules create mode 100644 40-isdn.rules create mode 100644 40-ppc.rules create mode 100644 40-s390.rules create mode 100644 64-device-mapper.rules create mode 100644 64-md-raid.rules diff --git a/.gitignore b/.gitignore index d05c54f..6c20107 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ udev-151.tar.bz2 +udev-153.tar.bz2 +udev-153.tar.bz2.sign diff --git a/0001-firmware-fix-error-reporting-on-missing-firmware-fil.patch b/0001-firmware-fix-error-reporting-on-missing-firmware-fil.patch deleted file mode 100644 index 933407f..0000000 --- a/0001-firmware-fix-error-reporting-on-missing-firmware-fil.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 86a7a2f853fe6022c5b0c1b415918047b65533be Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Thomas=20B=C3=A4chler?= -Date: Sun, 31 Jan 2010 13:49:02 +0100 -Subject: [PATCH 01/36] firmware: fix error reporting on missing firmware files - -The new firmware loader does not report an error to the kernel if a firmware file -is missing. This results in modprobe stalling for 60 seconds for each firmware -a module tries to load. ---- - extras/firmware/firmware.c | 3 ++- - 1 files changed, 2 insertions(+), 1 deletions(-) - -diff --git a/extras/firmware/firmware.c b/extras/firmware/firmware.c -index 8f70be4..16455de 100644 ---- a/extras/firmware/firmware.c -+++ b/extras/firmware/firmware.c -@@ -149,6 +149,7 @@ int main(int argc, char **argv) - - util_path_encode(firmware, fwencpath, sizeof(fwencpath)); - util_strscpyl(misspath, sizeof(misspath), udev_get_dev_path(udev), "/.udev/firmware-missing/", fwencpath, NULL); -+ util_strscpyl(loadpath, sizeof(loadpath), udev_get_sys_path(udev), devpath, "/loading", NULL); - - if (fwfile == NULL) { - int err; -@@ -166,6 +167,7 @@ int main(int argc, char **argv) - udev_selinux_resetfscreatecon(udev); - } while (err == -ENOENT); - rc = 2; -+ set_loading(udev, loadpath, "-1"); - goto exit; - } - -@@ -176,7 +178,6 @@ int main(int argc, char **argv) - if (unlink(misspath) == 0) - util_delete_path(udev, misspath); - -- util_strscpyl(loadpath, sizeof(loadpath), udev_get_sys_path(udev), devpath, "/loading", NULL); - set_loading(udev, loadpath, "1"); - - util_strscpyl(datapath, sizeof(datapath), udev_get_sys_path(udev), devpath, "/data", NULL); --- -1.6.6 - diff --git a/0002-keymap-Add-Dell-Inspiron-1011-Mini-10.patch b/0002-keymap-Add-Dell-Inspiron-1011-Mini-10.patch deleted file mode 100644 index 47cc9fa..0000000 --- a/0002-keymap-Add-Dell-Inspiron-1011-Mini-10.patch +++ /dev/null @@ -1,26 +0,0 @@ -From fc47e0b56779ceeaaa40d2dc3248fa002af63aaa Mon Sep 17 00:00:00 2001 -From: Martin Pitt -Date: Mon, 1 Feb 2010 15:27:46 -0800 -Subject: [PATCH 02/36] keymap: Add Dell Inspiron 1011 (Mini 10) - -This fixes the broken WLAN key. ---- - extras/keymap/95-keymap.rules | 2 ++ - 1 files changed, 2 insertions(+), 0 deletions(-) - -diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules -index 2b1c4bd..51c8c3b 100644 ---- a/extras/keymap/95-keymap.rules -+++ b/extras/keymap/95-keymap.rules -@@ -53,6 +53,8 @@ GOTO="keyboard_end" - LABEL="keyboard_vendorcheck" - - ENV{DMI_VENDOR}=="Dell*", RUN+="keymap $name dell" -+ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Inspiron 1011", RUN+="keymap $name 0x84 wlan" -+ - ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N*", RUN+="keymap $name compaq-e_evo" - - ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*3000*", RUN+="keymap $name lenovo-3000" --- -1.6.6 - diff --git a/0003-Fix-brightness-keys-on-MSI-Wind-U-100.patch b/0003-Fix-brightness-keys-on-MSI-Wind-U-100.patch deleted file mode 100644 index c00f51e..0000000 --- a/0003-Fix-brightness-keys-on-MSI-Wind-U-100.patch +++ /dev/null @@ -1,37 +0,0 @@ -From d7e2d38c1f0ead2239808dd117577a99a3ad3cde Mon Sep 17 00:00:00 2001 -From: Martin Pitt -Date: Tue, 9 Feb 2010 15:47:47 +0100 -Subject: [PATCH 03/36] Fix brightness keys on MSI Wind U-100 - -The MSI Wind 100 generates ACPI/input events on the LNXVIDEO input device. On -top of that, the video module/BIOS synthesize some extra event on atkbd as an -echo of actually changing the brightness. - -Ignore the wrong and useless atkbd ones, to avoid event loops. - -Many thanks to Hans de Goede for tracking this down! - -https://launchpad.net/bugs/415023 ---- - extras/keymap/95-keymap.rules | 5 +++++ - 1 files changed, 5 insertions(+), 0 deletions(-) - -diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules -index 51c8c3b..684619b 100644 ---- a/extras/keymap/95-keymap.rules -+++ b/extras/keymap/95-keymap.rules -@@ -98,6 +98,11 @@ ENV{DMI_VENDOR}=="MEDIONNB", ATTR{[dmi/id]product_name}=="A555*", RUN+="keymap $ - - ENV{DMI_VENDOR}=="MICRO-STAR*", RUN+="keymap $name micro-star" - -+# some MSI models generate ACPI/input events on the LNXVIDEO input devices, -+# plus some extra synthesized ones on atkbd as an echo of actually changing the -+# brightness; so ignore those atkbd ones, to avoid loops -+ENV{DMI_VENDOR}=="MICRO-STAR*", ATTR{[dmi/id]product_name}=="*U-100*|*U100*|*N033", RUN+="keymap $name 0xF7 reserved 0xF8 reserved" -+ - ENV{DMI_VENDOR}=="INVENTEC", ATTR{[dmi/id]product_name}=="SYMPHONY 6.0/7.0", RUN+="keymap $name inventec-symphony_6.0_7.0" - - ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keymap $name maxdata-pro_7000" --- -1.6.6 - diff --git a/0004-keymap-Add-support-for-Gateway-AOA110-AOA150-clones.patch b/0004-keymap-Add-support-for-Gateway-AOA110-AOA150-clones.patch deleted file mode 100644 index a7167c4..0000000 --- a/0004-keymap-Add-support-for-Gateway-AOA110-AOA150-clones.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 063985ef7dd6050f33920700777831426b221697 Mon Sep 17 00:00:00 2001 -From: Robert Hooker -Date: Sun, 7 Feb 2010 13:56:27 -0500 -Subject: [PATCH 04/36] keymap: Add support for Gateway AOA110/AOA150 clones. - -https://launchpad.net/bugs/518496 - -Signed-off-by: Martin Pitt ---- - extras/keymap/95-keymap.rules | 3 +++ - 1 files changed, 3 insertions(+), 0 deletions(-) - -diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules -index 684619b..d3690bb 100644 ---- a/extras/keymap/95-keymap.rules -+++ b/extras/keymap/95-keymap.rules -@@ -71,6 +71,9 @@ ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="Presario 2100*" - # HP Pavillion dv6315ea has empty DMI_VENDOR - ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dmi/id]board_version}=="65.2B", RUN+="keymap $name 0x88 media" # "quick play - -+# Gateway clone of Acer Aspire One AOA110/AOA150 -+ENV{DMI_VENDOR}=="Gateway*", ATTR{[dmi/id]product_name}=="*AOA1*", RUN+="keymap $name acer" -+ - ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" - ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" - ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C300*", RUN+="keymap $name acer-travelmate_c300" --- -1.6.6 - diff --git a/0005-keymap-Fix-LG-X110.patch b/0005-keymap-Fix-LG-X110.patch deleted file mode 100644 index 380ecf0..0000000 --- a/0005-keymap-Fix-LG-X110.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 4c514e31734a704ca58e543fa4330616ba584b39 Mon Sep 17 00:00:00 2001 -From: Martin Pitt -Date: Fri, 12 Feb 2010 19:25:47 +0100 -Subject: [PATCH 05/36] keymap: Fix LG X110 - -The LG X110 is not a perfect clone of the MSI Wind after all, and needs its own -keymap. Thanks to Konstantin Lavrov! - -https://launchpad.net/bugs/520650 ---- - Makefile.am | 1 + - extras/keymap/95-keymap.rules | 3 +-- - extras/keymap/keymaps/lg-x110 | 12 ++++++++++++ - 3 files changed, 14 insertions(+), 2 deletions(-) - create mode 100644 extras/keymap/keymaps/lg-x110 - -diff --git a/Makefile.am b/Makefile.am -index 728076a..069bf7f 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -518,6 +518,7 @@ dist_udevkeymap_DATA = \ - extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint \ - extras/keymap/keymaps/lenovo-thinkpad_x6_tablet \ - extras/keymap/keymaps/lenovo-thinkpad_x200_tablet \ -+ extras/keymap/keymaps/lg-x110 \ - extras/keymap/keymaps/logitech-wave \ - extras/keymap/keymaps/logitech-wave-cordless \ - extras/keymap/keymaps/maxdata-pro_7000 \ -diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules -index d3690bb..fcd42aa 100644 ---- a/extras/keymap/95-keymap.rules -+++ b/extras/keymap/95-keymap.rules -@@ -93,8 +93,7 @@ ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*Amilo Si 1520*", RUN+ - ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="AMILO*M*", RUN+="keymap $name 0x97 prog2 0x9F prog1" - ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="Amilo Li 1718", RUN+="keymap $name 0xD6 wlan" - --# MSI Wind clone --ENV{DMI_VENDOR}=="LG*", ATTR{[dmi/id]product_name}=="*X110*", RUN+="keymap $name micro-star" -+ENV{DMI_VENDOR}=="LG*", ATTR{[dmi/id]product_name}=="*X110*", RUN+="keymap $name lg-x110" - - ENV{DMI_VENDOR}=="MEDION*", ATTR{[dmi/id]product_name}=="*FID2060*", RUN+="keymap $name medion-fid2060" - ENV{DMI_VENDOR}=="MEDIONNB", ATTR{[dmi/id]product_name}=="A555*", RUN+="keymap $name medionnb-a555" -diff --git a/extras/keymap/keymaps/lg-x110 b/extras/keymap/keymaps/lg-x110 -new file mode 100644 -index 0000000..a61cf3d ---- /dev/null -+++ b/extras/keymap/keymaps/lg-x110 -@@ -0,0 +1,12 @@ -+0xA0 mute # Fn-F9 -+0xAE volumedown # Fn-Left -+0xAF search # Fn-F3 -+0xB0 volumeup # Fn-Right -+0xB1 battery # Fn-F10 Info -+0xB3 suspend # Fn-F12 -+0xDF sleep # Fn-F4 -+# 0xE2 bluetooth # satellite dish2 -+0xE4 f22 # Fn-F5 Touchpad disable -+0xF6 wlan # Fn-F6 -+0xF7 reserved # brightnessdown # Fn-Down -+0xF8 reserved # brightnessup # Fn-Up -\ No newline at end of file --- -1.6.6 - diff --git a/0006-Force-key-release-for-volume-keys-on-Dell-Studio-155.patch b/0006-Force-key-release-for-volume-keys-on-Dell-Studio-155.patch deleted file mode 100644 index 2f147fc..0000000 --- a/0006-Force-key-release-for-volume-keys-on-Dell-Studio-155.patch +++ /dev/null @@ -1,55 +0,0 @@ -From b15bb8019094797aee65f35e3e654354b61bfd7b Mon Sep 17 00:00:00 2001 -From: Jerone Young -Date: Fri, 12 Feb 2010 18:08:08 -0600 -Subject: [PATCH 06/36] Force key release for volume keys on Dell Studio 1557 - -Dell Studio 1557 does not generate a release code when the volume keys -are pressed, causing them to generate infinite key presses. This forces -key release of these keys. - -Signed-off-by: Jerone Young -Signed-off-by: Martin Pitt ---- - Makefile.am | 3 ++- - extras/keymap/95-keyboard-force-release.rules | 2 ++ - extras/keymap/force-release-maps/dell-studio-1557 | 3 +++ - 3 files changed, 7 insertions(+), 1 deletions(-) - create mode 100755 extras/keymap/force-release-maps/dell-studio-1557 - -diff --git a/Makefile.am b/Makefile.am -index 069bf7f..1b4e2ea 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -541,7 +541,8 @@ dist_udevkeymap_DATA = \ - - udevkeymapforcereldir = $(libexecdir)/keymaps/force-release - dist_udevkeymapforcerel_DATA = \ -- extras/keymap/force-release-maps/samsung-other -+ extras/keymap/force-release-maps/samsung-other \ -+ extras/keymap/force-release-maps/dell-studio-1557 - - extras/keymap/keys.txt: $(INCLUDE_PREFIX)/linux/input.h - mkdir -p extras/keymap -diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules -index 689afe9..659ee95 100644 ---- a/extras/keymap/95-keyboard-force-release.rules -+++ b/extras/keymap/95-keyboard-force-release.rules -@@ -21,4 +21,6 @@ ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" - - ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N130*|*N140*|*SR70S/SR71S*", RUN+="keyboard-force-release.sh $devpath samsung-other" - -+ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557", RUN+="keyboard-force-release.sh $devpath dell-studio-1557" -+ - LABEL="force_release_end" -diff --git a/extras/keymap/force-release-maps/dell-studio-1557 b/extras/keymap/force-release-maps/dell-studio-1557 -new file mode 100755 -index 0000000..1718673 ---- /dev/null -+++ b/extras/keymap/force-release-maps/dell-studio-1557 -@@ -0,0 +1,3 @@ -+0xa0 #mute -+0xae #volume up -+0xb0 #volume down --- -1.6.6 - diff --git a/0007-keymap-Add-Toshiba-Satellite-M30X.patch b/0007-keymap-Add-Toshiba-Satellite-M30X.patch deleted file mode 100644 index 4d17c00..0000000 --- a/0007-keymap-Add-Toshiba-Satellite-M30X.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 4ca91a04e8b727a079a973fdd9bc2b093e8315a5 Mon Sep 17 00:00:00 2001 -From: Martin Pitt -Date: Mon, 15 Feb 2010 13:15:25 +0100 -Subject: [PATCH 07/36] keymap: Add Toshiba Satellite M30X - -Thanks to Alessio Gaeta! - -https://launchpad.net/bugs/510019 ---- - Makefile.am | 1 + - extras/keymap/95-keymap.rules | 1 + - extras/keymap/keymaps/toshiba-satellite_m30x | 7 +++++++ - 3 files changed, 9 insertions(+), 0 deletions(-) - create mode 100644 extras/keymap/keymaps/toshiba-satellite_m30x - -diff --git a/Makefile.am b/Makefile.am -index 1b4e2ea..db23f16 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -537,6 +537,7 @@ dist_udevkeymap_DATA = \ - extras/keymap/keymaps/samsung-sx20s \ - extras/keymap/keymaps/toshiba-satellite_a100 \ - extras/keymap/keymaps/toshiba-satellite_a110 \ -+ extras/keymap/keymaps/toshiba-satellite_m30x \ - extras/keymap/keymaps/zepto-znote - - udevkeymapforcereldir = $(libexecdir)/keymaps/force-release -diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules -index fcd42aa..65b0d6e 100644 ---- a/extras/keymap/95-keymap.rules -+++ b/extras/keymap/95-keymap.rules -@@ -115,6 +115,7 @@ ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="S - - ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="SATELLITE A100", RUN+="keymap $name toshiba-satellite_a100" - ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite A110", RUN+="keymap $name toshiba-satellite_a110" -+ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite M30X", RUN+="keymap $name toshiba-satellite_m30x" - - ENV{DMI_VENDOR}=="OQO Inc.*", ATTR{[dmi/id]product_name}=="OQO Model 2*", RUN+="keymap $name oqo-model2" - -diff --git a/extras/keymap/keymaps/toshiba-satellite_m30x b/extras/keymap/keymaps/toshiba-satellite_m30x -new file mode 100644 -index 0000000..cf6d912 ---- /dev/null -+++ b/extras/keymap/keymaps/toshiba-satellite_m30x -@@ -0,0 +1,7 @@ -+0xef brightnessdown -+0xd9 brightnessup -+0xee screenlock -+0x93 media -+0x9e prog1 #touchpad_enable -+0x9f prog2 #touchpad_disable -+ --- -1.6.6 - diff --git a/0013-keymap-Add-Samsung-Q210-P210-force-release-quirk.patch b/0013-keymap-Add-Samsung-Q210-P210-force-release-quirk.patch deleted file mode 100644 index 328a2b4..0000000 --- a/0013-keymap-Add-Samsung-Q210-P210-force-release-quirk.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 20b48c3727eef1f266cbfd6bf5854b5c1419beb9 Mon Sep 17 00:00:00 2001 -From: Andy Whitcroft -Date: Tue, 2 Mar 2010 13:55:03 +0100 -Subject: [PATCH 13/36] keymap: Add Samsung Q210/P210 force-release quirk - -The Samsung Q210/P210 laptop also needs all of its function keys quirked. - -https://launchpad.net/bugs/530093 - -Signed-off-by: Martin Pitt ---- - extras/keymap/95-keyboard-force-release.rules | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules -index 659ee95..48b896d 100644 ---- a/extras/keymap/95-keyboard-force-release.rules -+++ b/extras/keymap/95-keyboard-force-release.rules -@@ -19,7 +19,7 @@ DRIVER!="atkbd", GOTO="force_release_end" - ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" - - --ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N130*|*N140*|*SR70S/SR71S*", RUN+="keyboard-force-release.sh $devpath samsung-other" -+ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N130*|*N140*|*SR70S/SR71S*|*Q210/P210*", RUN+="keyboard-force-release.sh $devpath samsung-other" - - ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557", RUN+="keyboard-force-release.sh $devpath dell-studio-1557" - --- -1.6.6 - diff --git a/0014-keymap-Add-Fujitsu-Amilo-1848-u-force-release-quirk.patch b/0014-keymap-Add-Fujitsu-Amilo-1848-u-force-release-quirk.patch deleted file mode 100644 index 9bedd1e..0000000 --- a/0014-keymap-Add-Fujitsu-Amilo-1848-u-force-release-quirk.patch +++ /dev/null @@ -1,53 +0,0 @@ -From da96a11b9c9164447bef206db47c405342ab8daa Mon Sep 17 00:00:00 2001 -From: Andy Whitcroft -Date: Tue, 2 Mar 2010 14:00:32 +0100 -Subject: [PATCH 14/36] keymap: Add Fujitsu Amilo 1848+u force-release quirk - -The Fujitsu Amilo Si 1848+u laptop requires the volume and mute keys -quirking. - -https://launchpad.net/bugs/530089 - -Signed-off-by: Martin Pitt ---- - Makefile.am | 1 + - extras/keymap/95-keyboard-force-release.rules | 2 ++ - .../keymap/force-release-maps/fujitsu-amilo-si1848 | 3 +++ - 3 files changed, 6 insertions(+), 0 deletions(-) - create mode 100644 extras/keymap/force-release-maps/fujitsu-amilo-si1848 - -diff --git a/Makefile.am b/Makefile.am -index 3780f50..471c5dd 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -543,6 +543,7 @@ dist_udevkeymap_DATA = \ - udevkeymapforcereldir = $(libexecdir)/keymaps/force-release - dist_udevkeymapforcerel_DATA = \ - extras/keymap/force-release-maps/samsung-other \ -+ extras/keymap/force-release-maps/fujitsu-amilo-si1848 \ - extras/keymap/force-release-maps/dell-studio-1557 - - extras/keymap/keys.txt: $(INCLUDE_PREFIX)/linux/input.h -diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules -index 48b896d..28639a5 100644 ---- a/extras/keymap/95-keyboard-force-release.rules -+++ b/extras/keymap/95-keyboard-force-release.rules -@@ -23,4 +23,6 @@ ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="* - - ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557", RUN+="keyboard-force-release.sh $devpath dell-studio-1557" - -+ENV{DMI_VENDOR}=="FUJITSU SIEMENS", ATTR{[dmi/id]product_name}=="AMILO Si 1848+u", RUN+="keyboard-force-release.sh $devpath fujitsu-amilo-si1848" -+ - LABEL="force_release_end" -diff --git a/extras/keymap/force-release-maps/fujitsu-amilo-si1848 b/extras/keymap/force-release-maps/fujitsu-amilo-si1848 -new file mode 100644 -index 0000000..1718673 ---- /dev/null -+++ b/extras/keymap/force-release-maps/fujitsu-amilo-si1848 -@@ -0,0 +1,3 @@ -+0xa0 #mute -+0xae #volume up -+0xb0 #volume down --- -1.6.6 - diff --git a/0015-Decrease-buffer-size-when-advancing-past-NUL-byte.patch b/0015-Decrease-buffer-size-when-advancing-past-NUL-byte.patch deleted file mode 100644 index 4ad5dce..0000000 --- a/0015-Decrease-buffer-size-when-advancing-past-NUL-byte.patch +++ /dev/null @@ -1,29 +0,0 @@ -From ecd42de2c56b4fcf0069b8b4a4d6607710e5de61 Mon Sep 17 00:00:00 2001 -From: David Zeuthen -Date: Tue, 2 Mar 2010 17:06:33 -0500 -Subject: [PATCH 15/36] Decrease buffer size when advancing past NUL byte - -Otherwise we'll overflow the buffer if space is tight. Also add a comment explaining this. - -Signed-off-by: David Zeuthen ---- - libudev/libudev-device.c | 2 ++ - 1 files changed, 2 insertions(+), 0 deletions(-) - -diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c -index 71fc775..4f42aa2 100644 ---- a/libudev/libudev-device.c -+++ b/libudev/libudev-device.c -@@ -1166,7 +1166,9 @@ static int update_envp_monitor_buf(struct udev_device *udev_device) - l = util_strpcpyl(&s, l, key, "=", udev_list_entry_get_value(list_entry), NULL); - if (l == 0) - return -EINVAL; -+ /* advance past the trailing '\0' that util_strpcpyl() guarantees */ - s++; -+ l--; - } - udev_device->envp[i] = NULL; - udev_device->monitor_buf_len = s - udev_device->monitor_buf; --- -1.6.6 - diff --git a/0016-Use-UTIL_LINE_SIZE-not-UTIL_PATH_SIZE-to-truncate-pr.patch b/0016-Use-UTIL_LINE_SIZE-not-UTIL_PATH_SIZE-to-truncate-pr.patch deleted file mode 100644 index 174767d..0000000 --- a/0016-Use-UTIL_LINE_SIZE-not-UTIL_PATH_SIZE-to-truncate-pr.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 3a19299202b5d34b89d5910fde25e8a4cfa2b31a Mon Sep 17 00:00:00 2001 -From: David Zeuthen -Date: Tue, 2 Mar 2010 17:07:14 -0500 -Subject: [PATCH 16/36] Use UTIL_LINE_SIZE, not UTIL_PATH_SIZE to truncate properties - -Signed-off-by: David Zeuthen ---- - libudev/libudev-device.c | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c -index 4f42aa2..b841745 100644 ---- a/libudev/libudev-device.c -+++ b/libudev/libudev-device.c -@@ -1089,7 +1089,7 @@ struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device - - struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property) - { -- char name[UTIL_PATH_SIZE]; -+ char name[UTIL_LINE_SIZE]; - char *val; - - util_strscpy(name, sizeof(name), property); --- -1.6.6 - diff --git a/0017-Increase-UTIL_LINE_SIZE-from-2048-to-16384.patch b/0017-Increase-UTIL_LINE_SIZE-from-2048-to-16384.patch deleted file mode 100644 index 802351e..0000000 --- a/0017-Increase-UTIL_LINE_SIZE-from-2048-to-16384.patch +++ /dev/null @@ -1,37 +0,0 @@ -From e32d5237ea045045c621edba7341631abd602d74 Mon Sep 17 00:00:00 2001 -From: David Zeuthen -Date: Tue, 2 Mar 2010 17:10:02 -0500 -Subject: [PATCH 17/36] Increase UTIL_LINE_SIZE from 2048 to 16384 - -Recent udisks versions, for LVM2 integration, ships with probers that -produce very long lines such as - -UDISKS_LVM2_PV_VG_PV_LIST= - uuid=98lyZl-Ya7U-p26Z-Ia7b-xf8u-xZqP-jc4njb;size=2000397795328;allocated_size=2000397795328 - uuid=iFs0cM-sxCF-ceQK-hZl1-kbwo-ZTjq-gSewQR;size=2000397795328;allocated_size=2000397795328 - [...] - -e.g. roughly 100 bytes per LVM2 physical volume for each LVM2 -PV encountered. - -Signed-off-by: David Zeuthen ---- - libudev/libudev-private.h | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h -index 0d28b80..e0c51dc 100644 ---- a/libudev/libudev-private.h -+++ b/libudev/libudev-private.h -@@ -187,7 +187,7 @@ int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, - /* libudev-util.c */ - #define UTIL_PATH_SIZE 1024 - #define UTIL_NAME_SIZE 512 --#define UTIL_LINE_SIZE 2048 -+#define UTIL_LINE_SIZE 16384 - #define UDEV_ALLOWED_CHARS_INPUT "/ $%?," - ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size); - ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size); --- -1.6.6 - diff --git a/0018-Fix-virtio-ports-rule-to-use-attr-instead-of-ATTR.patch b/0018-Fix-virtio-ports-rule-to-use-attr-instead-of-ATTR.patch deleted file mode 100644 index f02f3f0..0000000 --- a/0018-Fix-virtio-ports-rule-to-use-attr-instead-of-ATTR.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 3c4b1738a9d591d7ddce361ea184b76b253c4e87 Mon Sep 17 00:00:00 2001 -From: Amit Shah -Date: Fri, 26 Feb 2010 14:05:41 +0530 -Subject: [PATCH 18/36] Fix virtio-ports rule to use $attr instead of $ATTR - -Newer udev versions don't understand $ATTR. - -Signed-off-by: Amit Shah -Signed-off-by: Martin Pitt ---- - rules/rules.d/50-udev-default.rules | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules -index f8556d1..da1535f 100644 ---- a/rules/rules.d/50-udev-default.rules -+++ b/rules/rules.d/50-udev-default.rules -@@ -18,7 +18,7 @@ KERNEL=="mwave", GROUP="dialout" - KERNEL=="hvc*|hvsi*", GROUP="dialout" - - # virtio serial / console ports --KERNEL=="vport*", SYMLINK+="virtio-ports/$ATTR{name}" -+KERNEL=="vport*", SYMLINK+="virtio-ports/$attr{name}" - - # mem - KERNEL=="null|zero|full|random|urandom", MODE="0666" --- -1.6.6 - diff --git a/0019-udev-acl-Correctly-handle-ENV-ACL_MANAGE-0.patch b/0019-udev-acl-Correctly-handle-ENV-ACL_MANAGE-0.patch deleted file mode 100644 index 29f81f1..0000000 --- a/0019-udev-acl-Correctly-handle-ENV-ACL_MANAGE-0.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 5c3ebbf35a2c101e0212c7066f0d65e457fcf40c Mon Sep 17 00:00:00 2001 -From: Martin Pitt -Date: Thu, 4 Mar 2010 00:48:59 +0100 -Subject: [PATCH 19/36] udev-acl: Correctly handle ENV{ACL_MANAGE}==0 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When a custom rule sets ACL_MANAGE to 0 to disable ACL management for a -particular device, handle this as "disabled", by explicitly checking against -"1" instead of "nonempty". - -Thanks to RafaƂ Rzepecki for pointing this out. ---- - extras/udev-acl/70-acl.rules | 2 +- - extras/udev-acl/udev-acl.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules -index 8380f53..874667c 100644 ---- a/extras/udev-acl/70-acl.rules -+++ b/extras/udev-acl/70-acl.rules -@@ -69,7 +69,7 @@ SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0c02", ENV{ACL_MANAG - ENV{COLOR_MEASUREMENT_DEVICE}=="*?", ENV{ACL_MANAGE}="1" - - # apply ACL for all locally logged in users --LABEL="acl_apply", ENV{ACL_MANAGE}=="?*", TEST=="/var/run/ConsoleKit/database", \ -+LABEL="acl_apply", ENV{ACL_MANAGE}=="1", TEST=="/var/run/ConsoleKit/database", \ - RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}" - - LABEL="acl_end" -diff --git a/extras/udev-acl/udev-acl.c b/extras/udev-acl/udev-acl.c -index e670ce7..c070fcc 100644 ---- a/extras/udev-acl/udev-acl.c -+++ b/extras/udev-acl/udev-acl.c -@@ -289,7 +289,7 @@ static void apply_acl_to_devices(uid_t uid, int add) - /* iterate over all devices tagged with ACL_SET */ - udev = udev_new(); - enumerate = udev_enumerate_new(udev); -- udev_enumerate_add_match_property(enumerate, "ACL_MANAGE", "*"); -+ udev_enumerate_add_match_property(enumerate, "ACL_MANAGE", "1"); - udev_enumerate_scan_devices(enumerate); - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { - struct udev_device *device; --- -1.6.6 - diff --git a/0021-input_id-Fix-linking.patch b/0021-input_id-Fix-linking.patch deleted file mode 100644 index 2e822bc..0000000 --- a/0021-input_id-Fix-linking.patch +++ /dev/null @@ -1,27 +0,0 @@ -From a245a97b4e805c65ce22659742371550ccf002c1 Mon Sep 17 00:00:00 2001 -From: Martin Pitt -Date: Wed, 10 Mar 2010 12:17:03 +0100 -Subject: [PATCH 21/36] input_id: Fix linking - -Link against libudev-private.a instead of libudev.a, to avoid runtime -dependency to libudev. ---- - Makefile.am | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/Makefile.am b/Makefile.am -index 471c5dd..99a0133 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -239,7 +239,7 @@ dist_udevrules_DATA += extras/floppy/60-floppy.rules - # input_id - import input device class - # ------------------------------------------------------------------------------ - extras_input_id_input_id_SOURCES = extras/input_id/input_id.c --extras_input_id_input_id_LDADD = libudev/libudev.la -+extras_input_id_input_id_LDADD = libudev/libudev-private.la - libexec_PROGRAMS += extras/input_id/input_id - - # ------------------------------------------------------------------------------ --- -1.6.6 - diff --git a/0022-replace-utimes-with-utimensat.patch b/0022-replace-utimes-with-utimensat.patch deleted file mode 100644 index 7a42304..0000000 --- a/0022-replace-utimes-with-utimensat.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 455f792e4791e037eb0406005b92c345cf0baf56 Mon Sep 17 00:00:00 2001 -From: Kay Sievers -Date: Wed, 10 Mar 2010 14:43:07 +0100 -Subject: [PATCH 22/36] replace utimes() with utimensat() - ---- - udev/udev-node.c | 4 ++-- - 1 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/udev/udev-node.c b/udev/udev-node.c -index a70c147..307a76b 100644 ---- a/udev/udev-node.c -+++ b/udev/udev-node.c -@@ -57,7 +57,7 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod - preserve = 1; - udev_selinux_lsetfilecon(udev, file, mode); - /* update time stamp when we re-use the node, like on media change events */ -- utimes(file, NULL); -+ utimensat(AT_FDCWD, file, NULL, 0); - } else { - char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; - -@@ -178,7 +178,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) - info(udev, "preserve already existing symlink '%s' to '%s'\n", - slink, target); - udev_selinux_lsetfilecon(udev, slink, S_IFLNK); -- lutimes(slink, NULL); -+ utimensat(AT_FDCWD, slink, NULL, AT_SYMLINK_NOFOLLOW); - goto exit; - } - } --- -1.6.6 - diff --git a/0029-firmware-fix-possible-segfault-when-firmware-device-.patch b/0029-firmware-fix-possible-segfault-when-firmware-device-.patch deleted file mode 100644 index 05c1939..0000000 --- a/0029-firmware-fix-possible-segfault-when-firmware-device-.patch +++ /dev/null @@ -1,40 +0,0 @@ -From d44c27c5ab71dbbcfcf4745977027502309dd795 Mon Sep 17 00:00:00 2001 -From: Kay Sievers -Date: Tue, 16 Mar 2010 10:57:44 +0100 -Subject: [PATCH 29/36] firmware: fix possible segfault when firmware device goes away while loading - -Thanks to Ruediger Oertel. ---- - extras/firmware/firmware.c | 9 ++++++--- - 1 files changed, 6 insertions(+), 3 deletions(-) - -diff --git a/extras/firmware/firmware.c b/extras/firmware/firmware.c -index 16455de..92f0918 100644 ---- a/extras/firmware/firmware.c -+++ b/extras/firmware/firmware.c -@@ -63,8 +63,10 @@ static bool copy_firmware(struct udev *udev, const char *source, const char *tar - if (fwrite(buf, size, 1, ftarget) == 1) - ret = true; - exit: -- fclose(ftarget); -- fclose(fsource); -+ if (ftarget != NULL) -+ fclose(ftarget); -+ if (fsource != NULL) -+ fclose(fsource); - free(buf); - return ret; - } -@@ -178,7 +180,8 @@ int main(int argc, char **argv) - if (unlink(misspath) == 0) - util_delete_path(udev, misspath); - -- set_loading(udev, loadpath, "1"); -+ if (!set_loading(udev, loadpath, "1")) -+ goto exit; - - util_strscpyl(datapath, sizeof(datapath), udev_get_sys_path(udev), devpath, "/data", NULL); - if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) { --- -1.6.6 - diff --git a/0030-rules-input-create-by-path-links-for-pci-devices.patch b/0030-rules-input-create-by-path-links-for-pci-devices.patch deleted file mode 100644 index c35bd60..0000000 --- a/0030-rules-input-create-by-path-links-for-pci-devices.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 6b32e8192934619f787c3b5b6f0fe40c32d7d94a Mon Sep 17 00:00:00 2001 -From: Marco d'Itri -Date: Tue, 16 Mar 2010 12:44:43 +0100 -Subject: [PATCH 30/36] rules: input - create by-path/ links for pci devices - ---- - rules/rules.d/60-persistent-input.rules | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules -index e4675ae..1ea4431 100644 ---- a/rules/rules.d/60-persistent-input.rules -+++ b/rules/rules.d/60-persistent-input.rules -@@ -27,7 +27,7 @@ SUBSYSTEMS=="usb", ENV{ID_BUS}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="", A - SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-if$attr{bInterfaceNumber}" - - # by-path --SUBSYSTEMS=="usb|platform", IMPORT{program}="path_id %p" -+SUBSYSTEMS=="pci|usb|platform", IMPORT{program}="path_id %p" - ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{.INPUT_CLASS}" - ENV{ID_PATH}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{.INPUT_CLASS}" - # allow empty class for platform and usb devices; platform supports only a single interface that way --- -1.6.6 - diff --git a/0032-do-not-reset-SELinux-context-when-the-node-was-not-t.patch b/0032-do-not-reset-SELinux-context-when-the-node-was-not-t.patch deleted file mode 100644 index ca136bd..0000000 --- a/0032-do-not-reset-SELinux-context-when-the-node-was-not-t.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 578cc8a8085a47c963b5940459e475ac5f07219c Mon Sep 17 00:00:00 2001 -From: Kay Sievers -Date: Wed, 17 Mar 2010 09:15:18 +0100 -Subject: [PATCH 32/36] do not reset SELinux context when the node was not touched - ---- - udev/udev-node.c | 42 +++++++++++++++++------------------------- - 1 files changed, 17 insertions(+), 25 deletions(-) - -diff --git a/udev/udev-node.c b/udev/udev-node.c -index 4314cce..3aee15b 100644 ---- a/udev/udev-node.c -+++ b/udev/udev-node.c -@@ -37,7 +37,6 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod - { - struct udev *udev = udev_device_get_udev(dev); - struct stat stats; -- int preserve = 0; - int err = 0; - - if (major(devnum) == 0) -@@ -54,9 +53,15 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod - if (lstat(file, &stats) == 0) { - if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) && (stats.st_rdev == devnum)) { - info(udev, "preserve file '%s', because it has correct dev_t\n", file); -- preserve = 1; -- udev_selinux_lsetfilecon(udev, file, mode); -- /* update time stamp when we re-use the node, like on media change events */ -+ if (stats.st_mode != mode || stats.st_uid != uid || stats.st_gid != gid) { -+ info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); -+ chmod(file, mode); -+ chown(file, uid, gid); -+ udev_selinux_lsetfilecon(udev, file, mode); -+ } else { -+ info(udev, "preserve permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); -+ } -+ /* always update timestamp when we re-use the node, like on media change events */ - utimensat(AT_FDCWD, file, NULL, 0); - } else { - char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; -@@ -76,7 +81,11 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod - if (err != 0) { - err(udev, "rename(%s, %s) failed: %m\n", file_tmp, file); - unlink(file_tmp); -+ goto exit; - } -+ info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); -+ chmod(file, mode); -+ chown(file, uid, gid); - } - } else { - info(udev, "mknod(%s, %#o, (%u,%u))\n", file, mode, major(devnum), minor(devnum)); -@@ -90,28 +99,11 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod - err = -errno; - udev_selinux_resetfscreatecon(udev); - } while (err == -ENOENT); -- if (err != 0) { -+ if (err != 0) - err(udev, "mknod(%s, %#o, (%u,%u) failed: %m\n", file, mode, major(devnum), minor(devnum)); -- goto exit; -- } -- } -- -- if (!preserve || stats.st_mode != mode) { -- info(udev, "chmod(%s, %#o)\n", file, mode); -- err = chmod(file, mode); -- if (err != 0) { -- err(udev, "chmod(%s, %#o) failed: %m\n", file, mode); -- goto exit; -- } -- } -- -- if (!preserve || stats.st_uid != uid || stats.st_gid != gid) { -- info(udev, "chown(%s, %u, %u)\n", file, uid, gid); -- err = chown(file, uid, gid); -- if (err != 0) { -- err(udev, "chown(%s, %u, %u) failed: %m\n", file, uid, gid); -- goto exit; -- } -+ info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); -+ chmod(file, mode); -+ chown(file, uid, gid); - } - exit: - return err; --- -1.6.6 - diff --git a/0035-cdrom_id-open-non-mounted-optical-media-with-O_EXCL.patch b/0035-cdrom_id-open-non-mounted-optical-media-with-O_EXCL.patch deleted file mode 100644 index e21cb4d..0000000 --- a/0035-cdrom_id-open-non-mounted-optical-media-with-O_EXCL.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 38a3cde11bc77af49a96245b8a8a0f2b583a344c Mon Sep 17 00:00:00 2001 -From: Kay Sievers -Date: Thu, 18 Mar 2010 11:14:32 +0100 -Subject: [PATCH 035/110] cdrom_id: open non-mounted optical media with O_EXCL - -This should prevent confusing drives during CD burning sessions. Based -on a patch from Harald Hoyer. ---- - extras/cdrom_id/cdrom_id.c | 26 +++++++++++++++++++++++++- - 1 files changed, 25 insertions(+), 1 deletions(-) - -diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c -index 2380b15..e485768 100644 ---- a/extras/cdrom_id/cdrom_id.c -+++ b/extras/cdrom_id/cdrom_id.c -@@ -112,6 +112,30 @@ static unsigned long long int cd_media_session_last_offset; - #define ASC(errcode) (((errcode) >> 8) & 0xFF) - #define ASCQ(errcode) ((errcode) & 0xFF) - -+static int is_mounted(const char *device) -+{ -+ struct stat statbuf; -+ FILE *fp; -+ int maj, min; -+ int mounted = 0; -+ -+ if (stat(device, &statbuf) < 0) -+ return -ENODEV; -+ -+ fp = fopen("/proc/self/mountinfo", "r"); -+ if (fp == NULL) -+ return -ENOSYS; -+ while (fscanf(fp, "%*s %*s %i:%i %*[^\n]", &maj, &min) == 2) { -+ printf("got %u %u\n", maj, min); -+ if (makedev(maj, min) == statbuf.st_rdev) { -+ mounted = 1; -+ break; -+ } -+ } -+ fclose(fp); -+ return mounted; -+} -+ - static void info_scsi_cmd_err(struct udev *udev, char *cmd, int err) - { - if (err == -1) { -@@ -568,7 +592,7 @@ int main(int argc, char *argv[]) - goto exit; - } - -- fd = open(node, O_RDONLY | O_NONBLOCK); -+ fd = open(node, O_RDONLY|O_NONBLOCK|(is_mounted(node) ? 0 : O_EXCL)); - if (fd < 0) { - info(udev, "unable to open '%s'\n", node); - fprintf(stderr, "unable to open '%s'\n", node); --- -1.7.0.1 - diff --git a/0036-modeswitch-morph-into-tool-that-only-switches-Mobile.patch b/0036-modeswitch-morph-into-tool-that-only-switches-Mobile.patch deleted file mode 100644 index 45f1397..0000000 --- a/0036-modeswitch-morph-into-tool-that-only-switches-Mobile.patch +++ /dev/null @@ -1,2142 +0,0 @@ -From 4dd9b291354e76f34b0d6d7b5c3b28d03a624418 Mon Sep 17 00:00:00 2001 -From: Dan Williams -Date: Thu, 18 Mar 2010 17:13:59 -0700 -Subject: [PATCH 36/36] modeswitch: morph into tool that only switches Mobile Action cables - -Remove option modeswitching code; use usb_modeswitch already, people. ---- - Makefile.am | 27 +- - extras/mobile-action-modeswitch/.gitignore | 1 + - .../61-mobile-action.rules | 15 + - extras/mobile-action-modeswitch/ma8280p_us.c | 462 ++++++++++++++++++++ - extras/mobile-action-modeswitch/ma8280p_us.h | 24 + - .../mobile-action-modeswitch.c | 262 +++++++++++ - extras/mobile-action-modeswitch/utils.c | 83 ++++ - extras/mobile-action-modeswitch/utils.h | 32 ++ - extras/modem-modeswitch/.gitignore | 1 - - extras/modem-modeswitch/61-mobile-action.rules | 15 - - .../61-option-modem-modeswitch.rules | 44 -- - extras/modem-modeswitch/ma8280p_us.c | 462 -------------------- - extras/modem-modeswitch/ma8280p_us.h | 24 - - extras/modem-modeswitch/modem-modeswitch.c | 266 ----------- - extras/modem-modeswitch/option.c | 131 ------ - extras/modem-modeswitch/option.h | 29 -- - extras/modem-modeswitch/utils.c | 83 ---- - extras/modem-modeswitch/utils.h | 32 -- - 18 files changed, 891 insertions(+), 1102 deletions(-) - create mode 100644 extras/mobile-action-modeswitch/.gitignore - create mode 100644 extras/mobile-action-modeswitch/61-mobile-action.rules - create mode 100644 extras/mobile-action-modeswitch/ma8280p_us.c - create mode 100644 extras/mobile-action-modeswitch/ma8280p_us.h - create mode 100644 extras/mobile-action-modeswitch/mobile-action-modeswitch.c - create mode 100644 extras/mobile-action-modeswitch/utils.c - create mode 100644 extras/mobile-action-modeswitch/utils.h - delete mode 100644 extras/modem-modeswitch/.gitignore - delete mode 100644 extras/modem-modeswitch/61-mobile-action.rules - delete mode 100644 extras/modem-modeswitch/61-option-modem-modeswitch.rules - delete mode 100644 extras/modem-modeswitch/ma8280p_us.c - delete mode 100644 extras/modem-modeswitch/ma8280p_us.h - delete mode 100644 extras/modem-modeswitch/modem-modeswitch.c - delete mode 100644 extras/modem-modeswitch/option.c - delete mode 100644 extras/modem-modeswitch/option.h - delete mode 100644 extras/modem-modeswitch/utils.c - delete mode 100644 extras/modem-modeswitch/utils.h - -diff --git a/Makefile.am b/Makefile.am -index 99a0133..68a68d9 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -448,24 +448,21 @@ extras_usb_db_pci_db_LDADD = libudev/libudev-private.la - libexec_PROGRAMS += extras/usb-db/pci-db - - # ------------------------------------------------------------------------------ --# modem-modeswitch - magic config switch for 3G modems --# ------------------------------------------------------------------------------ --extras_modem_modeswitch_modem_modeswitch_SOURCES =\ -- extras/modem-modeswitch/modem-modeswitch.c \ -- extras/modem-modeswitch/utils.c \ -- extras/modem-modeswitch/utils.h \ -- extras/modem-modeswitch/ma8280p_us.c \ -- extras/modem-modeswitch/ma8280p_us.h \ -- extras/modem-modeswitch/option.c \ -- extras/modem-modeswitch/option.h --extras_modem_modeswitch_modem_modeswitch_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) --extras_modem_modeswitch_modem_modeswitch_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) -+# mobile-action-modeswitch - switch Mobile Action cables into serial mode -+# ------------------------------------------------------------------------------ -+extras_mobile_action_modeswitch_mobile_action_modeswitch_SOURCES =\ -+ extras/mobile-action-modeswitch/mobile-action-modeswitch.c \ -+ extras/mobile-action-modeswitch/utils.c \ -+ extras/mobile-action-modeswitch/utils.h \ -+ extras/mobile-action-modeswitch/ma8280p_us.c \ -+ extras/mobile-action-modeswitch/ma8280p_us.h -+extras_mobile_action_modeswitch_mobile_action_modeswitch_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) -+extras_mobile_action_modeswitch_mobile_action_modeswitch_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) - - dist_udevrules_DATA += \ -- extras/modem-modeswitch/61-option-modem-modeswitch.rules \ -- extras/modem-modeswitch/61-mobile-action.rules -+ extras/mobile-action-modeswitch/61-mobile-action.rules - --libexec_PROGRAMS += extras/modem-modeswitch/modem-modeswitch -+libexec_PROGRAMS += extras/mobile-action-modeswitch/mobile-action-modeswitch - - # ------------------------------------------------------------------------------ - # keymap - map custom hardware's multimedia keys -diff --git a/extras/mobile-action-modeswitch/61-mobile-action.rules b/extras/mobile-action-modeswitch/61-mobile-action.rules -new file mode 100644 -index 0000000..0af27a5 ---- /dev/null -+++ b/extras/mobile-action-modeswitch/61-mobile-action.rules -@@ -0,0 +1,15 @@ -+ACTION!="add", GOTO="mobile_action_end" -+ -+# ATTENTION: DO NOT USE THIS FILE FOR ANYTHING EXCEPT -+# MOBILE ACTION CABLES. DO NOT USE IT FOR 3G DEVICES! -+ -+SUBSYSTEM=="usb", ATTR{bDeviceClass}=="00|ff", ATTR{bDeviceSubClass}=="00|ff", ENV{DEVTYPE}=="usb_device", GOTO="mobile_action_switch" -+GOTO="mobile_action_end" -+ -+LABEL="mobile_action_switch" -+ -+# Mobile Action cables like the 8280p and 8230p -+ATTRS{idVendor}=="0df7", ATTRS{idProduct}=="0800", RUN+="mobile-action-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t mobile-action-8280p" -+ -+LABEL="mobile_action_end" -+ -diff --git a/extras/mobile-action-modeswitch/ma8280p_us.c b/extras/mobile-action-modeswitch/ma8280p_us.c -new file mode 100644 -index 0000000..d7cf4f4 ---- /dev/null -+++ b/extras/mobile-action-modeswitch/ma8280p_us.c -@@ -0,0 +1,462 @@ -+/* http://www.natox.be/ma8280p/ -+ * http://www.leopold.dk/~martin/ma-8230p.html -+ * http://figvam.blogspot.com/2007/01/mobile-action-8730p-usb-cable-and-linux.html -+ */ -+ -+/* -+ * -+ * Code by davy hollevoet. This is simply an adaptation of code -+ * generated by usbsnoop2libusb. (http://iki.fi/lindi/usb/usbsnoop2libusb.pl) -+ * -+ * This code is released under both the GPL version 2 and BSD licenses. -+ * Either license may be used. -+ * -+ * GPLv2 -+ * ******** -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * as published by the Free Software Foundation; either version 2 -+ * of the License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * In addition: -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. The name of the author may not be used to endorse or promote -+ * products derived from this software without specific prior written -+ * permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -+ * POSSIBILITY OF SUCH DAMAGE. -+ * -+ * BSD -+ * ****** -+ * Copyright (c) 1998, Regents of the University of California -+ * All rights reserved. -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are met: -+ * -+ * * Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * * Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * * Neither the name of the University of California, Berkeley nor the -+ * names of its contributors may be used to endorse or promote products -+ * derived from this software without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND ANY -+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+ * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY -+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ */ -+ -+/* This file is (mostly) generated with usbsnoop2libusb.pl from a usbsnoop log file. */ -+/* Latest version of the script should be in http://iki.fi/lindi/usb/usbsnoop2libusb.pl */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "utils.h" -+#include "ma8280p_us.h" -+ -+static void msleep(long msec) -+{ -+ struct timespec duration = { 0, msec * 1000 * 1000 }; -+ -+ nanosleep(&duration, NULL); -+} -+ -+int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev) -+{ -+ int ret = 1; -+ char *buf = NULL; -+ -+ buf = malloc (65535); -+ if (!buf) { -+ error ("%s: not enough memory", dev->filename, ret); -+ return -1; -+ } -+ -+ usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); -+ msleep(6); -+ usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); -+ msleep(6); -+ usb_get_descriptor(devh, 0x0000002, 0x0000000, buf, 0x0000400); -+ msleep(10); -+ ret = usb_release_interface(devh, 0); -+ if (ret != 0) -+ debug ("%s: failed to release interface before set_configuration: %d", dev->filename, ret); -+ usb_set_configuration(devh, 0x0000001); -+ ret = usb_claim_interface(devh, 0); -+ if (ret != 0) -+ debug ("%s: claim after set_configuration failed with error %d", dev->filename, ret); -+ //usb_set_altinterface(devh, 0); -+ //msleep(33); -+ usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE + USB_ENDPOINT_IN, 0x0000001, 0x0000300, 0x0000000, buf, 0x0000008, 1000); -+ msleep(5); -+ memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); -+ usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); -+ msleep(4); -+ memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); -+ usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); -+ msleep(4); -+ -+ msleep(4); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(6); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(1); -+ //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped -+ msleep(4); -+ memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); -+ usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); -+ msleep(3); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(1); -+ memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); -+ usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); -+ msleep(7); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(1); -+ memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); -+ usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); -+ msleep(7); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(2); -+ //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped -+ msleep(4); -+ memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); -+ usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); -+ msleep(2); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(1); -+ memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); -+ usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); -+ msleep(7); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(1); -+ memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); -+ usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); -+ msleep(7); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(8); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(1); -+ //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped -+ msleep(4); -+ memcpy(buf, "\x33\x04\xfe\x00\xf4\x6c\x1f\xf0", 0x0000008); -+ usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); -+ msleep(3); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ msleep(1); -+ //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped -+ msleep(4); -+ memcpy(buf, "\x32\x07\xfe\xf0\x29\xb9\x3a\xf0", 0x0000008); -+ usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); -+ msleep(3); -+ usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -+ -+ if (buf) -+ free (buf); -+ return 0; -+} -diff --git a/extras/mobile-action-modeswitch/ma8280p_us.h b/extras/mobile-action-modeswitch/ma8280p_us.h -new file mode 100644 -index 0000000..bf0e304 ---- /dev/null -+++ b/extras/mobile-action-modeswitch/ma8280p_us.h -@@ -0,0 +1,24 @@ -+/* -+ * Modem mode switcher -+ * -+ * Copyright (C) 2009 Dan Williams -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details: -+ */ -+ -+#ifndef __MA8280P_H__ -+#define __MA8280P_H__ -+ -+#include -+ -+int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev); -+ -+#endif /* __MA8280P_H__ */ -diff --git a/extras/mobile-action-modeswitch/mobile-action-modeswitch.c b/extras/mobile-action-modeswitch/mobile-action-modeswitch.c -new file mode 100644 -index 0000000..36d7d81 ---- /dev/null -+++ b/extras/mobile-action-modeswitch/mobile-action-modeswitch.c -@@ -0,0 +1,262 @@ -+/* -+ * Mobile action cable mode switcher -+ * -+ * Copyright (C) 2008 - 2010 Dan Williams -+ * Copyright (C) 2008 Peter Henn -+ * -+ * Heavily based on the 'ozerocdoff' tool by Peter Henn. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details: -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#include "utils.h" -+ -+#include "ma8280p_us.h" -+ -+struct usb_dev_handle *handle = NULL; -+ -+typedef struct usb_device * (*FindFunc) (int vid, int pid); -+typedef int (*SwitchFunc) (struct usb_dev_handle *dh, struct usb_device *dev); -+ -+typedef enum { -+ ST_UNKNOWN = 0, -+ ST_MA8280P -+} SwitchType; -+ -+typedef struct SwitchEntry { -+ SwitchType st; -+ const char *clopt; -+ FindFunc find_func; -+ SwitchFunc switch_func; -+} SwitchEntry; -+ -+static SwitchEntry switch_types[] = { -+ { ST_MA8280P, "mobile-action-8280p", NULL, ma8280p_switch }, -+ { ST_UNKNOWN, NULL, NULL } -+}; -+ -+static struct usb_device * -+generic_find (int vid, int pid) -+{ -+ struct usb_bus *bus; -+ struct usb_device *dev; -+ -+ for (bus = usb_get_busses(); bus; bus = bus->next) { -+ for (dev = bus->devices; dev; dev = dev->next) { -+ if (dev->descriptor.idVendor == vid && dev->descriptor.idProduct == pid) { -+ debug ("Found device '%s'", dev->filename); -+ return dev; -+ } -+ } -+ } -+ return NULL; -+} -+ -+static void -+release_usb_device (int param) -+{ -+ usb_release_interface (handle, 0); -+ usb_close (handle); -+} -+ -+static void -+print_usage (void) -+{ -+ printf ("Usage: mobile-action-modeswitch [-hdq] [-l ] -v -p -t \n" -+ " -h, --help show this help message\n" -+ " -v, --vendor target USB vendor ID\n" -+ " -p, --product target USB product ID\n" -+ " -t, --type type of switch to attempt, varies by device:\n" -+ " mobile-action-8280p - For Mobile Action 8xxxP USB cables\n" -+ " -l, --log log output to a file\n" -+ " -q, --quiet don't print anything to stdout\n" -+ " -d, --debug display debugging messages\n\n" -+ "Examples:\n" -+ " mobile-action-modeswitch -v 0x0df7 -p 0x8000 -t mobile-action-8280p\n"); -+} -+ -+static SwitchEntry * -+parse_type (const char *s) -+{ -+ SwitchEntry *entry = &switch_types[0]; -+ -+ while (entry->clopt) { -+ if (!strcmp (entry->clopt, s)) -+ return entry; -+ entry++; -+ } -+ -+ return NULL; -+} -+ -+static void -+do_exit (int val) -+{ -+ log_shutdown (); -+ exit (val); -+} -+ -+int main(int argc, char **argv) -+{ -+ static struct option options[] = { -+ { "help", no_argument, NULL, 'h' }, -+ { "vendor", required_argument, NULL, 'v' }, -+ { "product", required_argument, NULL, 'p' }, -+ { "type", required_argument, NULL, 't' }, -+ { "log", required_argument, NULL, 'l' }, -+ { "debug", no_argument, NULL, 'd' }, -+ { "quiet", no_argument, NULL, 'q' }, -+ { NULL, 0, NULL, 0} -+ }; -+ -+ struct usb_device *dev; -+ int vid = 0, pid = 0; -+ const char *logpath = NULL; -+ char buffer[256]; -+ int ret, quiet = 0, debug = 0; -+ SwitchEntry *sentry = NULL; -+ -+ while (1) { -+ int option; -+ -+ option = getopt_long(argc, argv, "hv:p:l:t:dq", options, NULL); -+ if (option == -1) -+ break; -+ -+ switch (option) { -+ case 'v': -+ vid = strtol (optarg, NULL, 0); -+ break; -+ case 'p': -+ pid = strtol (optarg, NULL, 0); -+ break; -+ case 't': -+ sentry = parse_type (optarg); -+ if (!sentry) { -+ error ("unknown switch type '%s'", optarg); -+ print_usage (); -+ exit (1); -+ } -+ break; -+ case 'l': -+ logpath = optarg; -+ break; -+ case 'q': -+ quiet = 1; -+ break; -+ case 'd': -+ debug = 1; -+ break; -+ case 'h': -+ default: -+ print_usage (); -+ exit (1); -+ } -+ } -+ -+ if (log_startup (logpath, debug, quiet)) { -+ fprintf (stderr, "Couldn't open/create logfile %s", logpath); -+ exit (2); -+ } -+ -+ if (!sentry) { -+ if (!quiet) -+ print_usage (); -+ else -+ error ("missing device switch type."); -+ do_exit (3); -+ } -+ -+ if (!vid || !pid) { -+ if (!quiet) -+ print_usage (); -+ else -+ error ("missing vendor and device IDs."); -+ do_exit (3); -+ } -+ -+ usb_init(); -+ -+ if (usb_find_busses() < 0) { -+ error ("no USB busses found."); -+ do_exit (4); -+ } -+ -+ if (usb_find_devices() < 0) { -+ error ("no USB devices found."); -+ do_exit (4); -+ } -+ -+ if (sentry->find_func) -+ dev = (*sentry->find_func) (vid, pid); -+ else -+ dev = generic_find (vid, pid); -+ if (dev == NULL) { -+ error ("no device found."); -+ do_exit (5); -+ } -+ -+ handle = usb_open (dev); -+ if (handle == NULL) { -+ error ("%s: could not access the device.", -+ dev->filename); -+ do_exit (6); -+ } -+ -+ /* detach running default driver */ -+ signal (SIGTERM, release_usb_device); -+ ret = usb_get_driver_np (handle, 0, buffer, sizeof (buffer)); -+ if (ret == 0) { -+ debug ("%s: found already attached driver '%s'", dev->filename, buffer); -+ -+ ret = usb_detach_kernel_driver_np (handle, 0); -+ if (ret != 0) { -+ debug ("%s: error: unable to detach current driver.", dev->filename); -+ usb_close (handle); -+ do_exit (7); -+ } -+ } -+ -+ ret = usb_claim_interface (handle, 0); -+ if (ret != 0) { -+ debug ("%s: couldn't claim device's USB interface: %d.", -+ dev->filename, ret); -+ usb_close (handle); -+ do_exit (8); -+ } -+ -+ ret = (*sentry->switch_func) (handle, dev); -+ if (ret < 0) { -+ debug ("%s: failed to switch device to serial mode.", dev->filename); -+ usb_release_interface (handle, 0); -+ usb_close (handle); -+ do_exit(9); -+ } -+ -+ usb_release_interface (handle, 0); -+ -+ ret = usb_close (handle); -+ if (ret < 0) -+ debug ("%s: failed to close the device.", dev->filename); -+ -+ do_exit (0); -+ return 0; -+} -diff --git a/extras/mobile-action-modeswitch/utils.c b/extras/mobile-action-modeswitch/utils.c -new file mode 100644 -index 0000000..37d0df4 ---- /dev/null -+++ b/extras/mobile-action-modeswitch/utils.c -@@ -0,0 +1,83 @@ -+/* -+ * Modem mode switcher -+ * -+ * Copyright (C) 2009 Dan Williams -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details: -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "utils.h" -+ -+static int debug_on = 0; -+static int quiet = 0; -+FILE *logfile = NULL; -+ -+void -+do_log (int level, const char *fmt, ...) -+{ -+ va_list args; -+ char buffer[1024]; -+ char tag = 'L'; -+ -+ if (level >= LOG_DBG && !debug_on) -+ return; -+ -+ va_start (args, fmt); -+ vsnprintf (buffer, sizeof (buffer), fmt, args); -+ va_end (args); -+ -+ if (level == LOG_ERR) -+ tag = 'E'; -+ else if (level == LOG_MSG) -+ tag = 'L'; -+ else if (level == LOG_DBG) -+ tag = 'D'; -+ -+ if (logfile) -+ fprintf (logfile, "%c: %s\n", tag, buffer); -+ if (!quiet) -+ fprintf ((level == LOG_ERR) ? stderr : stdout, "%c: %s\n", tag, buffer); -+} -+ -+int -+log_startup (const char *path, int do_debug, int be_quiet) -+{ -+ time_t t; -+ -+ quiet = be_quiet; -+ debug_on = do_debug; -+ -+ if (!path) -+ return 0; -+ -+ logfile = fopen (path, "a+"); -+ if (!logfile) -+ return 1; -+ -+ t = time (NULL); -+ message ("\n**** Started: %s\n", ctime (&t)); -+ return 0; -+} -+ -+void -+log_shutdown (void) -+{ -+ if (logfile) -+ fclose (logfile); -+} -+ -diff --git a/extras/mobile-action-modeswitch/utils.h b/extras/mobile-action-modeswitch/utils.h -new file mode 100644 -index 0000000..1ef557a ---- /dev/null -+++ b/extras/mobile-action-modeswitch/utils.h -@@ -0,0 +1,32 @@ -+/* -+ * Modem mode switcher -+ * -+ * Copyright (C) 2009 Dan Williams -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details: -+ */ -+ -+#ifndef __UTILS_H__ -+#define __UTILS_H__ -+ -+#define LOG_ERR 0 -+#define LOG_MSG 1 -+#define LOG_DBG 2 -+ -+#define message(fmt, args...) do_log (LOG_MSG, fmt, ##args); -+#define error(fmt, args...) do_log (LOG_ERR, fmt, ##args); -+#define debug(fmt, args...) do_log (LOG_DBG, fmt, ##args); -+ -+void do_log (int level, const char *fmt, ...); -+int log_startup (const char *path, int do_debug, int be_quiet); -+void log_shutdown (void); -+ -+#endif /* __UTILS_H__ */ -diff --git a/extras/modem-modeswitch/61-mobile-action.rules b/extras/modem-modeswitch/61-mobile-action.rules -deleted file mode 100644 -index 29d460d..0000000 ---- a/extras/modem-modeswitch/61-mobile-action.rules -+++ /dev/null -@@ -1,15 +0,0 @@ --ACTION!="add", GOTO="mobile_action_end" -- --SUBSYSTEM=="usb", ATTR{bDeviceClass}=="00|ff", ATTR{bDeviceSubClass}=="00|ff", ENV{DEVTYPE}=="usb_device", GOTO="mobile_action_switch" --GOTO="mobile_action_end" -- --LABEL="mobile_action_switch" --ATTRS{idVendor}=="0df7", ATTRS{idProduct}=="0800", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t mobile-action-8280p" -- --LABEL="mobile_action_end" -- --# modem-modeswitch does not work with these devices, the fake CD-ROM needs to be ejected -- --# ZTE MF6xx --ACTION=="add", ENV{ID_CDROM}=="1", ENV{ID_VENDOR_ID}=="19d2", ENV{ID_MODEL_ID}=="2000", RUN+="/usr/bin/eject %k" -- -diff --git a/extras/modem-modeswitch/61-option-modem-modeswitch.rules b/extras/modem-modeswitch/61-option-modem-modeswitch.rules -deleted file mode 100644 -index 053733e..0000000 ---- a/extras/modem-modeswitch/61-option-modem-modeswitch.rules -+++ /dev/null -@@ -1,44 +0,0 @@ --# NOTE: only for devices manufactured by Option NV --# DO NOT add devices that are not manufactured by Option NV -- --ACTION!="add", GOTO="option_zerocd_end" -- --SUBSYSTEM=="usb", ATTR{bDeviceClass}!="ff", ENV{DEVTYPE}=="usb_device", GOTO="option_zerocd_disable" --SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", GOTO="option_zerocd_disable" --GOTO="option_zerocd_end" -- --LABEL="option_zerocd_disable" --ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="1000", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6711", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6711", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6731", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6751", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6771", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6791", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6811", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6911", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6951", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6971", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7011", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7031", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7051", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7071", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7111", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7211", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7251", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7271", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7311", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="c031", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="d031", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="d033", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7301", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7361", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7401", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7501", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7601", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" --ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7901", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -- --# NOTE: only for devices manufactured by Option NV --# DO NOT add devices that are not manufactured by Option NV -- --LABEL="option_zerocd_end" -diff --git a/extras/modem-modeswitch/ma8280p_us.c b/extras/modem-modeswitch/ma8280p_us.c -deleted file mode 100644 -index d7cf4f4..0000000 ---- a/extras/modem-modeswitch/ma8280p_us.c -+++ /dev/null -@@ -1,462 +0,0 @@ --/* http://www.natox.be/ma8280p/ -- * http://www.leopold.dk/~martin/ma-8230p.html -- * http://figvam.blogspot.com/2007/01/mobile-action-8730p-usb-cable-and-linux.html -- */ -- --/* -- * -- * Code by davy hollevoet. This is simply an adaptation of code -- * generated by usbsnoop2libusb. (http://iki.fi/lindi/usb/usbsnoop2libusb.pl) -- * -- * This code is released under both the GPL version 2 and BSD licenses. -- * Either license may be used. -- * -- * GPLv2 -- * ******** -- * This program is free software; you can redistribute it and/or -- * modify it under the terms of the GNU General Public License -- * as published by the Free Software Foundation; either version 2 -- * of the License, or (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * In addition: -- * -- * Redistribution and use in source and binary forms, with or without -- * modification, are permitted provided that the following conditions -- * are met: -- * -- * 1. Redistributions of source code must retain the above copyright -- * notice, this list of conditions and the following disclaimer. -- * 2. Redistributions in binary form must reproduce the above copyright -- * notice, this list of conditions and the following disclaimer in the -- * documentation and/or other materials provided with the distribution. -- * 3. The name of the author may not be used to endorse or promote -- * products derived from this software without specific prior written -- * permission. -- * -- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, -- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- * POSSIBILITY OF SUCH DAMAGE. -- * -- * BSD -- * ****** -- * Copyright (c) 1998, Regents of the University of California -- * All rights reserved. -- * Redistribution and use in source and binary forms, with or without -- * modification, are permitted provided that the following conditions are met: -- * -- * * Redistributions of source code must retain the above copyright -- * notice, this list of conditions and the following disclaimer. -- * * Redistributions in binary form must reproduce the above copyright -- * notice, this list of conditions and the following disclaimer in the -- * documentation and/or other materials provided with the distribution. -- * * Neither the name of the University of California, Berkeley nor the -- * names of its contributors may be used to endorse or promote products -- * derived from this software without specific prior written permission. -- * -- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND ANY -- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY -- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- * -- */ -- --/* This file is (mostly) generated with usbsnoop2libusb.pl from a usbsnoop log file. */ --/* Latest version of the script should be in http://iki.fi/lindi/usb/usbsnoop2libusb.pl */ --#include --#include --#include --#include --#include --#include --#include --#include -- --#include "utils.h" --#include "ma8280p_us.h" -- --static void msleep(long msec) --{ -- struct timespec duration = { 0, msec * 1000 * 1000 }; -- -- nanosleep(&duration, NULL); --} -- --int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev) --{ -- int ret = 1; -- char *buf = NULL; -- -- buf = malloc (65535); -- if (!buf) { -- error ("%s: not enough memory", dev->filename, ret); -- return -1; -- } -- -- usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); -- msleep(6); -- usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); -- msleep(6); -- usb_get_descriptor(devh, 0x0000002, 0x0000000, buf, 0x0000400); -- msleep(10); -- ret = usb_release_interface(devh, 0); -- if (ret != 0) -- debug ("%s: failed to release interface before set_configuration: %d", dev->filename, ret); -- usb_set_configuration(devh, 0x0000001); -- ret = usb_claim_interface(devh, 0); -- if (ret != 0) -- debug ("%s: claim after set_configuration failed with error %d", dev->filename, ret); -- //usb_set_altinterface(devh, 0); -- //msleep(33); -- usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE + USB_ENDPOINT_IN, 0x0000001, 0x0000300, 0x0000000, buf, 0x0000008, 1000); -- msleep(5); -- memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); -- usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); -- msleep(4); -- memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); -- usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); -- msleep(4); -- -- msleep(4); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(6); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(1); -- //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped -- msleep(4); -- memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); -- usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); -- msleep(3); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(1); -- memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); -- usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); -- msleep(7); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(1); -- memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); -- usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); -- msleep(7); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(2); -- //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped -- msleep(4); -- memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); -- usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); -- msleep(2); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(1); -- memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); -- usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); -- msleep(7); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(1); -- memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); -- usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); -- msleep(7); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(8); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(1); -- //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped -- msleep(4); -- memcpy(buf, "\x33\x04\xfe\x00\xf4\x6c\x1f\xf0", 0x0000008); -- usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); -- msleep(3); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- msleep(1); -- //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped -- msleep(4); -- memcpy(buf, "\x32\x07\xfe\xf0\x29\xb9\x3a\xf0", 0x0000008); -- usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); -- msleep(3); -- usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); -- -- if (buf) -- free (buf); -- return 0; --} -diff --git a/extras/modem-modeswitch/ma8280p_us.h b/extras/modem-modeswitch/ma8280p_us.h -deleted file mode 100644 -index bf0e304..0000000 ---- a/extras/modem-modeswitch/ma8280p_us.h -+++ /dev/null -@@ -1,24 +0,0 @@ --/* -- * Modem mode switcher -- * -- * Copyright (C) 2009 Dan Williams -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details: -- */ -- --#ifndef __MA8280P_H__ --#define __MA8280P_H__ -- --#include -- --int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev); -- --#endif /* __MA8280P_H__ */ -diff --git a/extras/modem-modeswitch/modem-modeswitch.c b/extras/modem-modeswitch/modem-modeswitch.c -deleted file mode 100644 -index a60ce7a..0000000 ---- a/extras/modem-modeswitch/modem-modeswitch.c -+++ /dev/null -@@ -1,266 +0,0 @@ --/* -- * Modem mode switcher -- * -- * Copyright (C) 2008 Dan Williams -- * Copyright (C) 2008 Peter Henn -- * -- * Heavily based on the 'ozerocdoff' tool by Peter Henn. -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details: -- */ -- --#include --#include --#include --#include --#include --#include --#include -- --#include -- --#include "utils.h" -- --#include "ma8280p_us.h" --#include "option.h" -- --struct usb_dev_handle *handle = NULL; -- --typedef struct usb_device * (*FindFunc) (int vid, int pid); --typedef int (*SwitchFunc) (struct usb_dev_handle *dh, struct usb_device *dev); -- --typedef enum { -- ST_UNKNOWN = 0, -- ST_OPTION_ZEROCD, -- ST_MA8280P --} SwitchType; -- --typedef struct SwitchEntry { -- SwitchType st; -- const char *clopt; -- FindFunc find_func; -- SwitchFunc switch_func; --} SwitchEntry; -- --static SwitchEntry switch_types[] = { -- { ST_OPTION_ZEROCD, "option-zerocd", option_zerocd_find, option_zerocd_switch }, -- { ST_MA8280P, "mobile-action-8280p", NULL, ma8280p_switch }, -- { ST_UNKNOWN, NULL, NULL } --}; -- --static struct usb_device * --generic_find (int vid, int pid) --{ -- struct usb_bus *bus; -- struct usb_device *dev; -- -- for (bus = usb_get_busses(); bus; bus = bus->next) { -- for (dev = bus->devices; dev; dev = dev->next) { -- if (dev->descriptor.idVendor == vid && dev->descriptor.idProduct == pid) { -- debug ("Found device '%s'", dev->filename); -- return dev; -- } -- } -- } -- return NULL; --} -- --static void --release_usb_device (int param) --{ -- usb_release_interface (handle, 0); -- usb_close (handle); --} -- --static void --print_usage (void) --{ -- printf ("Usage: modem-modeswitch [-hdq] [-l ] -v -p -t \n" -- " -h, --help show this help message\n" -- " -v, --vendor target USB vendor ID\n" -- " -p, --product target USB product ID\n" -- " -t, --type type of switch to attempt, varies by device:\n" -- " option-zerocd - For many newer Option N.V. devices\n" -- " mobile-action-8280p - For Mobile Action 8xxxP USB cables\n" -- " -l, --log log output to a file\n" -- " -q, --quiet don't print anything to stdout\n" -- " -d, --debug display debugging messages\n\n" -- "Examples:\n" -- " modem-modeswitch -v 0x0af0 -p 0xc031 -t option-zerocd\n"); --} -- --static SwitchEntry * --parse_type (const char *s) --{ -- SwitchEntry *entry = &switch_types[0]; -- -- while (entry->clopt) { -- if (!strcmp (entry->clopt, s)) -- return entry; -- entry++; -- } -- -- return NULL; --} -- --static void --do_exit (int val) --{ -- log_shutdown (); -- exit (val); --} -- --int main(int argc, char **argv) --{ -- static struct option options[] = { -- { "help", no_argument, NULL, 'h' }, -- { "vendor", required_argument, NULL, 'v' }, -- { "product", required_argument, NULL, 'p' }, -- { "type", required_argument, NULL, 't' }, -- { "log", required_argument, NULL, 'l' }, -- { "debug", no_argument, NULL, 'd' }, -- { "quiet", no_argument, NULL, 'q' }, -- { NULL, 0, NULL, 0} -- }; -- -- struct usb_device *dev; -- int vid = 0, pid = 0; -- const char *logpath = NULL; -- char buffer[256]; -- int ret, quiet = 0, debug = 0; -- SwitchEntry *sentry = NULL; -- -- while (1) { -- int option; -- -- option = getopt_long(argc, argv, "hv:p:l:t:dq", options, NULL); -- if (option == -1) -- break; -- -- switch (option) { -- case 'v': -- vid = strtol (optarg, NULL, 0); -- break; -- case 'p': -- pid = strtol (optarg, NULL, 0); -- break; -- case 't': -- sentry = parse_type (optarg); -- if (!sentry) { -- error ("unknown switch type '%s'", optarg); -- print_usage (); -- exit (1); -- } -- break; -- case 'l': -- logpath = optarg; -- break; -- case 'q': -- quiet = 1; -- break; -- case 'd': -- debug = 1; -- break; -- case 'h': -- default: -- print_usage (); -- exit (1); -- } -- } -- -- if (log_startup (logpath, debug, quiet)) { -- fprintf (stderr, "Couldn't open/create logfile %s", logpath); -- exit (2); -- } -- -- if (!sentry) { -- if (!quiet) -- print_usage (); -- else -- error ("missing device switch type."); -- do_exit (3); -- } -- -- if (!vid || !pid) { -- if (!quiet) -- print_usage (); -- else -- error ("missing vendor and device IDs."); -- do_exit (3); -- } -- -- usb_init(); -- -- if (usb_find_busses() < 0) { -- error ("no USB busses found."); -- do_exit (4); -- } -- -- if (usb_find_devices() < 0) { -- error ("no USB devices found."); -- do_exit (4); -- } -- -- if (sentry->find_func) -- dev = (*sentry->find_func) (vid, pid); -- else -- dev = generic_find (vid, pid); -- if (dev == NULL) { -- error ("no device found."); -- do_exit (5); -- } -- -- handle = usb_open (dev); -- if (handle == NULL) { -- error ("%s: could not access the device.", -- dev->filename); -- do_exit (6); -- } -- -- /* detach running default driver */ -- signal (SIGTERM, release_usb_device); -- ret = usb_get_driver_np (handle, 0, buffer, sizeof (buffer)); -- if (ret == 0) { -- debug ("%s: found already attached driver '%s'", dev->filename, buffer); -- -- ret = usb_detach_kernel_driver_np (handle, 0); -- if (ret != 0) { -- debug ("%s: error: unable to detach current driver.", dev->filename); -- usb_close (handle); -- do_exit (7); -- } -- } -- -- ret = usb_claim_interface (handle, 0); -- if (ret != 0) { -- debug ("%s: couldn't claim device's USB interface: %d.", -- dev->filename, ret); -- usb_close (handle); -- do_exit (8); -- } -- -- ret = (*sentry->switch_func) (handle, dev); -- if (ret < 0) { -- debug ("%s: failed to switch device to modem mode.", dev->filename); -- usb_release_interface (handle, 0); -- usb_close (handle); -- do_exit(9); -- } -- -- usb_release_interface (handle, 0); -- -- ret = usb_close (handle); -- if (ret < 0) -- debug ("%s: failed to close the device.", dev->filename); -- -- do_exit (0); -- return 0; --} -diff --git a/extras/modem-modeswitch/option.c b/extras/modem-modeswitch/option.c -deleted file mode 100644 -index 5b299fd..0000000 ---- a/extras/modem-modeswitch/option.c -+++ /dev/null -@@ -1,131 +0,0 @@ --/* -- * Modem mode switcher -- * -- * Copyright (C) 2008 Dan Williams -- * Copyright (C) 2008 Peter Henn -- * -- * Heavily based on the 'ozerocdoff' tool by Peter Henn. -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details: -- */ -- --#include -- --#include "utils.h" --#include "option.h" -- --/* Borrowed from /usr/include/linux/usb/ch9.h */ --#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */ --#define USB_ENDPOINT_XFER_BULK 2 --#define USB_ENDPOINT_DIR_MASK 0x80 --#define USB_DIR_OUT 0 /* to device */ --#define USB_DIR_IN 0x80 /* to host */ -- --struct usb_device * --option_zerocd_find (int vid, int pid) --{ -- struct usb_bus *bus; -- struct usb_device *dev; -- -- for (bus = usb_get_busses(); bus; bus = bus->next) { -- for (dev = bus->devices; dev; dev = dev->next) { -- if (dev->descriptor.idVendor == vid && dev->descriptor.idProduct == pid) { -- debug ("Found mass storage device:"); -- debug (" Endpoints: %d", dev->config[0].interface[0].altsetting[0].bNumEndpoints); -- debug (" Class: 0x%X", dev->config[0].interface[0].altsetting[0].bInterfaceClass); -- debug (" SubClass: 0x%X", dev->config[0].interface[0].altsetting[0].bInterfaceSubClass); -- debug (" Protocol: 0x%X", dev->config[0].interface[0].altsetting[0].bInterfaceProtocol); -- -- if ( (dev->config[0].interface[0].altsetting[0].bNumEndpoints == 2) -- && (dev->config[0].interface[0].altsetting[0].bInterfaceClass == 0x08) -- && (dev->config[0].interface[0].altsetting[0].bInterfaceSubClass == 0x06) -- && (dev->config[0].interface[0].altsetting[0].bInterfaceProtocol == 0x50) ) { -- debug ("Found modem mass storage device '%s'", dev->filename); -- return dev; -- } -- } -- } -- } -- return NULL; --} -- --static int --find_endpoints (struct usb_device *dev, int *in_ep, int *out_ep) --{ -- int i; -- -- for (i = 0; i < dev->config[0].interface[0].altsetting[0].bNumEndpoints; i++) { -- struct usb_endpoint_descriptor *ep = &(dev->config[0].interface[0].altsetting[0].endpoint[i]); -- -- if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK) { -- unsigned int direction = ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK; -- -- if (!*out_ep && (direction == USB_DIR_OUT)) -- *out_ep = ep->bEndpointAddress; -- else if (!*in_ep && (direction == USB_DIR_IN)) -- *in_ep = ep->bEndpointAddress; -- } -- -- if (*in_ep && *out_ep) -- return 0; -- } -- -- return -1; --} -- --int --option_zerocd_switch (struct usb_dev_handle *dh, struct usb_device *dev) --{ -- const char const rezero_cbw[] = { -- 0x55, 0x53, 0x42, 0x43, /* bulk command signature (LE) */ -- 0x78, 0x56, 0x34, 0x12, /* bulk command host tag */ -- 0x01, 0x00, 0x00, 0x00, /* bulk command data transfer length (LE) */ -- 0x80, /* flags: direction data-in */ -- 0x00, /* LUN */ -- 0x06, /* SCSI command length */ -- 0x01, /* SCSI command: REZERO */ -- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* filler */ -- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -- }; -- -- int ret = -1, ep_in = 0, ep_out = 0; -- char buffer[256]; -- -- /* Find the device's bulk in and out endpoints */ -- if (find_endpoints (dev, &ep_in, &ep_out) < 0) { -- debug ("%s: couldn't find correct USB endpoints.", dev->filename); -- goto out; -- } -- -- usb_clear_halt (dh, ep_out); -- ret = usb_set_altinterface (dh, 0); -- if (ret != 0) { -- debug ("%s: couldn't set device alternate interface.", dev->filename); -- goto out; -- } -- -- /* Let the mass storage device settle */ -- sleep (1); -- -- /* Send the modeswitch command */ -- ret = usb_bulk_write (dh, ep_out, (char *) rezero_cbw, sizeof (rezero_cbw), 1000); -- if (ret < 0) -- return ret; -- -- debug ("%s: REZERO command sent.", dev->filename); -- -- /* Some devices need to be read from */ -- ret = usb_bulk_read (dh, ep_in, buffer, sizeof (buffer), 1000); -- --out: -- return ret; --} -- -diff --git a/extras/modem-modeswitch/option.h b/extras/modem-modeswitch/option.h -deleted file mode 100644 -index e00dabf..0000000 ---- a/extras/modem-modeswitch/option.h -+++ /dev/null -@@ -1,29 +0,0 @@ --/* -- * Modem mode switcher -- * -- * Copyright (C) 2008 Dan Williams -- * Copyright (C) 2008 Peter Henn -- * -- * Heavily based on the 'ozerocdoff' tool by Peter Henn. -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details: -- */ -- --#ifndef __OPTION_H__ --#define __OPTION_H__ -- --#include -- --struct usb_device *option_zerocd_find (int vid, int pid); -- --int option_zerocd_switch (struct usb_dev_handle *dh, struct usb_device *dev); -- --#endif /* __OPTION_H__ */ -diff --git a/extras/modem-modeswitch/utils.c b/extras/modem-modeswitch/utils.c -deleted file mode 100644 -index 37d0df4..0000000 ---- a/extras/modem-modeswitch/utils.c -+++ /dev/null -@@ -1,83 +0,0 @@ --/* -- * Modem mode switcher -- * -- * Copyright (C) 2009 Dan Williams -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details: -- */ -- --#include --#include --#include --#include --#include --#include -- --#include "utils.h" -- --static int debug_on = 0; --static int quiet = 0; --FILE *logfile = NULL; -- --void --do_log (int level, const char *fmt, ...) --{ -- va_list args; -- char buffer[1024]; -- char tag = 'L'; -- -- if (level >= LOG_DBG && !debug_on) -- return; -- -- va_start (args, fmt); -- vsnprintf (buffer, sizeof (buffer), fmt, args); -- va_end (args); -- -- if (level == LOG_ERR) -- tag = 'E'; -- else if (level == LOG_MSG) -- tag = 'L'; -- else if (level == LOG_DBG) -- tag = 'D'; -- -- if (logfile) -- fprintf (logfile, "%c: %s\n", tag, buffer); -- if (!quiet) -- fprintf ((level == LOG_ERR) ? stderr : stdout, "%c: %s\n", tag, buffer); --} -- --int --log_startup (const char *path, int do_debug, int be_quiet) --{ -- time_t t; -- -- quiet = be_quiet; -- debug_on = do_debug; -- -- if (!path) -- return 0; -- -- logfile = fopen (path, "a+"); -- if (!logfile) -- return 1; -- -- t = time (NULL); -- message ("\n**** Started: %s\n", ctime (&t)); -- return 0; --} -- --void --log_shutdown (void) --{ -- if (logfile) -- fclose (logfile); --} -- -diff --git a/extras/modem-modeswitch/utils.h b/extras/modem-modeswitch/utils.h -deleted file mode 100644 -index 1ef557a..0000000 ---- a/extras/modem-modeswitch/utils.h -+++ /dev/null -@@ -1,32 +0,0 @@ --/* -- * Modem mode switcher -- * -- * Copyright (C) 2009 Dan Williams -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details: -- */ -- --#ifndef __UTILS_H__ --#define __UTILS_H__ -- --#define LOG_ERR 0 --#define LOG_MSG 1 --#define LOG_DBG 2 -- --#define message(fmt, args...) do_log (LOG_MSG, fmt, ##args); --#define error(fmt, args...) do_log (LOG_ERR, fmt, ##args); --#define debug(fmt, args...) do_log (LOG_DBG, fmt, ##args); -- --void do_log (int level, const char *fmt, ...); --int log_startup (const char *path, int do_debug, int be_quiet); --void log_shutdown (void); -- --#endif /* __UTILS_H__ */ --- -1.6.6 - diff --git a/0048-cdrom_id-remove-debugging-code.patch b/0048-cdrom_id-remove-debugging-code.patch deleted file mode 100644 index d1043ce..0000000 --- a/0048-cdrom_id-remove-debugging-code.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 36a07a8c34a4cff5ad2bbb6e0fdfed49e8191661 Mon Sep 17 00:00:00 2001 -From: Harald Hoyer -Date: Wed, 7 Apr 2010 09:23:46 +0200 -Subject: [PATCH 048/110] cdrom_id: remove debugging code - ---- - extras/cdrom_id/cdrom_id.c | 1 - - 1 files changed, 0 insertions(+), 1 deletions(-) - -diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c -index e485768..036ef28 100644 ---- a/extras/cdrom_id/cdrom_id.c -+++ b/extras/cdrom_id/cdrom_id.c -@@ -126,7 +126,6 @@ static int is_mounted(const char *device) - if (fp == NULL) - return -ENOSYS; - while (fscanf(fp, "%*s %*s %i:%i %*[^\n]", &maj, &min) == 2) { -- printf("got %u %u\n", maj, min); - if (makedev(maj, min) == statbuf.st_rdev) { - mounted = 1; - break; --- -1.7.0.1 - diff --git a/0049-cdrom_id-retry-to-open-the-device-if-EBUSY.patch b/0049-cdrom_id-retry-to-open-the-device-if-EBUSY.patch deleted file mode 100644 index 2f94c4d..0000000 --- a/0049-cdrom_id-retry-to-open-the-device-if-EBUSY.patch +++ /dev/null @@ -1,53 +0,0 @@ -From cccfffbe04c01be12fb42cb12f3f7aa5e2a22dd4 Mon Sep 17 00:00:00 2001 -From: Kay Sievers -Date: Wed, 7 Apr 2010 09:24:25 +0200 -Subject: [PATCH 049/110] cdrom_id: retry to open the device, if EBUSY - -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. ---- - extras/cdrom_id/cdrom_id.c | 18 +++++++++++++++++- - 1 files changed, 17 insertions(+), 1 deletions(-) - -diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c -index 036ef28..7c9f8cc 100644 ---- a/extras/cdrom_id/cdrom_id.c -+++ b/extras/cdrom_id/cdrom_id.c -@@ -30,6 +30,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -591,7 +592,22 @@ int main(int argc, char *argv[]) - goto exit; - } - -- fd = open(node, O_RDONLY|O_NONBLOCK|(is_mounted(node) ? 0 : O_EXCL)); -+ if (is_mounted(node)) { -+ fd = open(node, O_RDONLY|O_NONBLOCK); -+ } else { -+ int cnt; -+ struct timespec duration; -+ -+ srand((unsigned int)getpid()); -+ for (cnt = 40; cnt > 0; cnt--) { -+ fd = open(node, O_RDONLY|O_NONBLOCK|O_EXCL); -+ if (fd >= 0 || errno != EBUSY) -+ break; -+ duration.tv_sec = 0; -+ duration.tv_nsec = (100 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); -+ nanosleep(&duration, NULL); -+ } -+ } - if (fd < 0) { - info(udev, "unable to open '%s'\n", node); - fprintf(stderr, "unable to open '%s'\n", node); --- -1.7.0.1 - diff --git a/0050-cdrom_id-check-mount-state-in-retry-loop.patch b/0050-cdrom_id-check-mount-state-in-retry-loop.patch deleted file mode 100644 index e9c3cfd..0000000 --- a/0050-cdrom_id-check-mount-state-in-retry-loop.patch +++ /dev/null @@ -1,55 +0,0 @@ -From d45c8c8b01c99180f15e24b22f7cf81eaf3cdd1b Mon Sep 17 00:00:00 2001 -From: Kay Sievers -Date: Wed, 7 Apr 2010 11:32:22 +0200 -Subject: [PATCH 050/110] cdrom_id: check mount state in retry loop - -Based on a patch from Harald Hoyer. ---- - extras/cdrom_id/cdrom_id.c | 22 +++++++++------------- - 1 files changed, 9 insertions(+), 13 deletions(-) - -diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c -index 7c9f8cc..894a890 100644 ---- a/extras/cdrom_id/cdrom_id.c -+++ b/extras/cdrom_id/cdrom_id.c -@@ -547,6 +547,7 @@ int main(int argc, char *argv[]) - const char *node = NULL; - int export = 0; - int fd = -1; -+ int cnt; - int rc = 0; - - udev = udev_new(); -@@ -592,21 +593,16 @@ int main(int argc, char *argv[]) - goto exit; - } - -- if (is_mounted(node)) { -- fd = open(node, O_RDONLY|O_NONBLOCK); -- } else { -- int cnt; -+ srand((unsigned int)getpid()); -+ for (cnt = 20; cnt > 0; cnt--) { - struct timespec duration; - -- srand((unsigned int)getpid()); -- for (cnt = 40; cnt > 0; cnt--) { -- fd = open(node, O_RDONLY|O_NONBLOCK|O_EXCL); -- if (fd >= 0 || errno != EBUSY) -- break; -- duration.tv_sec = 0; -- duration.tv_nsec = (100 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); -- nanosleep(&duration, NULL); -- } -+ fd = open(node, O_RDONLY|O_NONBLOCK|(is_mounted(node) ? 0 : O_EXCL)); -+ if (fd >= 0 || errno != EBUSY) -+ break; -+ duration.tv_sec = 0; -+ duration.tv_nsec = (100 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); -+ nanosleep(&duration, NULL); - } - if (fd < 0) { - info(udev, "unable to open '%s'\n", node); --- -1.7.0.1 - diff --git a/0051-cdrom_id-always-set-ID_CDROM-regardless-if-we-can-ru.patch b/0051-cdrom_id-always-set-ID_CDROM-regardless-if-we-can-ru.patch deleted file mode 100644 index a9bc162..0000000 --- a/0051-cdrom_id-always-set-ID_CDROM-regardless-if-we-can-ru.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 5c5ebde711c4560ae0560e87c33fe477b5add354 Mon Sep 17 00:00:00 2001 -From: Kay Sievers -Date: Mon, 12 Apr 2010 01:12:23 +0200 -Subject: [PATCH 051/110] cdrom_id: always set ID_CDROM regardless if we can run cdrom_id - ---- - extras/cdrom_id/60-cdrom_id.rules | 12 +++++++++--- - 1 files changed, 9 insertions(+), 3 deletions(-) - -diff --git a/extras/cdrom_id/60-cdrom_id.rules b/extras/cdrom_id/60-cdrom_id.rules -index 132a680..811c4aa 100644 ---- a/extras/cdrom_id/60-cdrom_id.rules -+++ b/extras/cdrom_id/60-cdrom_id.rules -@@ -1,5 +1,11 @@ - # do not edit this file, it will be overwritten on update - --# import optical drive properties --ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", \ -- KERNEL=="sr[0-9]*|xvd*", IMPORT{program}="cdrom_id --export $tempnode" -+ACTION!="add|change", GOTO="cdrom_end" -+SUBSYSTEM!="block", GOTO="cdrom_end" -+KERNEL!="sr[0-9]*|xvd*", GOTO="cdrom_end" -+ENV{DEVTYPE}!="disk", GOTO="cdrom_end" -+ -+ENV{ID_CDROM}="1" -+IMPORT{program}="cdrom_id --export $tempnode" -+ -+LABEL="cdrom_end" --- -1.7.0.1 - diff --git a/0062-cdrom_id-Fix-uninitialized-variables.patch b/0062-cdrom_id-Fix-uninitialized-variables.patch deleted file mode 100644 index b53056a..0000000 --- a/0062-cdrom_id-Fix-uninitialized-variables.patch +++ /dev/null @@ -1,131 +0,0 @@ -From 816e6bf0fb0849d03696a4b4ec2334e35e819425 Mon Sep 17 00:00:00 2001 -From: Martin Pitt -Date: Tue, 13 Apr 2010 10:49:24 +0200 -Subject: [PATCH 062/110] cdrom_id: Fix uninitialized variables - -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 ---- - extras/cdrom_id/cdrom_id.c | 96 ++++++++++++++++++++++---------------------- - 1 files changed, 48 insertions(+), 48 deletions(-) - -diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c -index 894a890..db3867c 100644 ---- a/extras/cdrom_id/cdrom_id.c -+++ b/extras/cdrom_id/cdrom_id.c -@@ -56,57 +56,57 @@ static void log_fn(struct udev *udev, int priority, - } - - /* device info */ --static unsigned int cd_cd_rom; --static unsigned int cd_cd_r; --static unsigned int cd_cd_rw; --static unsigned int cd_dvd_rom; --static unsigned int cd_dvd_r; --static unsigned int cd_dvd_rw; --static unsigned int cd_dvd_ram; --static unsigned int cd_dvd_plus_r; --static unsigned int cd_dvd_plus_rw; --static unsigned int cd_dvd_plus_r_dl; --static unsigned int cd_dvd_plus_rw_dl; --static unsigned int cd_bd; --static unsigned int cd_bd_r; --static unsigned int cd_bd_re; --static unsigned int cd_hddvd; --static unsigned int cd_hddvd_r; --static unsigned int cd_hddvd_rw; --static unsigned int cd_mo; --static unsigned int cd_mrw; --static unsigned int cd_mrw_w; -+static unsigned int cd_cd_rom = 0; -+static unsigned int cd_cd_r = 0; -+static unsigned int cd_cd_rw = 0; -+static unsigned int cd_dvd_rom = 0; -+static unsigned int cd_dvd_r = 0; -+static unsigned int cd_dvd_rw = 0; -+static unsigned int cd_dvd_ram = 0; -+static unsigned int cd_dvd_plus_r = 0; -+static unsigned int cd_dvd_plus_rw = 0; -+static unsigned int cd_dvd_plus_r_dl = 0; -+static unsigned int cd_dvd_plus_rw_dl = 0; -+static unsigned int cd_bd = 0; -+static unsigned int cd_bd_r = 0; -+static unsigned int cd_bd_re = 0; -+static unsigned int cd_hddvd = 0; -+static unsigned int cd_hddvd_r = 0; -+static unsigned int cd_hddvd_rw = 0; -+static unsigned int cd_mo = 0; -+static unsigned int cd_mrw = 0; -+static unsigned int cd_mrw_w = 0; - - /* 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; --static unsigned int cd_media_dvd_rom; --static unsigned int cd_media_dvd_r; --static unsigned int cd_media_dvd_rw; --static unsigned int cd_media_dvd_ram; --static unsigned int cd_media_dvd_plus_r; --static unsigned int cd_media_dvd_plus_rw; --static unsigned int cd_media_dvd_plus_r_dl; --static unsigned int cd_media_dvd_plus_rw_dl; --static unsigned int cd_media_bd; --static unsigned int cd_media_bd_r; --static unsigned int cd_media_bd_re; --static unsigned int cd_media_hddvd; --static unsigned int cd_media_hddvd_r; --static unsigned int cd_media_hddvd_rw; --static unsigned int cd_media_mo; --static unsigned int cd_media_mrw; --static unsigned int cd_media_mrw_w; -- --static const char *cd_media_state; --static unsigned int cd_media_session_next; --static unsigned int cd_media_session_count; --static unsigned int cd_media_track_count; --static unsigned int cd_media_track_count_data; --static unsigned int cd_media_track_count_audio; --static unsigned long long int cd_media_session_last_offset; -+static unsigned int cd_media = 0; -+static unsigned int cd_media_cd_rom = 0; -+static unsigned int cd_media_cd_r = 0; -+static unsigned int cd_media_cd_rw = 0; -+static unsigned int cd_media_dvd_rom = 0; -+static unsigned int cd_media_dvd_r = 0; -+static unsigned int cd_media_dvd_rw = 0; -+static unsigned int cd_media_dvd_ram = 0; -+static unsigned int cd_media_dvd_plus_r = 0; -+static unsigned int cd_media_dvd_plus_rw = 0; -+static unsigned int cd_media_dvd_plus_r_dl = 0; -+static unsigned int cd_media_dvd_plus_rw_dl = 0; -+static unsigned int cd_media_bd = 0; -+static unsigned int cd_media_bd_r = 0; -+static unsigned int cd_media_bd_re = 0; -+static unsigned int cd_media_hddvd = 0; -+static unsigned int cd_media_hddvd_r = 0; -+static unsigned int cd_media_hddvd_rw = 0; -+static unsigned int cd_media_mo = 0; -+static unsigned int cd_media_mrw = 0; -+static unsigned int cd_media_mrw_w = 0; -+ -+static const char *cd_media_state = NULL; -+static unsigned int cd_media_session_next = 0; -+static unsigned int cd_media_session_count = 0; -+static unsigned int cd_media_track_count = 0; -+static unsigned int cd_media_track_count_data = 0; -+static unsigned int cd_media_track_count_audio = 0; -+static unsigned long long int cd_media_session_last_offset = 0; - - #define ERRCODE(s) ((((s)[2] & 0x0F) << 16) | ((s)[12] << 8) | ((s)[13])) - #define SK(errcode) (((errcode) >> 16) & 0xF) --- -1.7.0.1 - diff --git a/0065-cdrom_id-Fix-uninitialized-buffers.patch b/0065-cdrom_id-Fix-uninitialized-buffers.patch deleted file mode 100644 index e0f3eb2..0000000 --- a/0065-cdrom_id-Fix-uninitialized-buffers.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 2b861dc92757b9a3214c2b8e9d8b1c3f3c162391 Mon Sep 17 00:00:00 2001 -From: Martin Pitt -Date: Tue, 13 Apr 2010 15:25:48 +0200 -Subject: [PATCH 065/110] cdrom_id: Fix uninitialized buffers - -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 ---- - extras/cdrom_id/cdrom_id.c | 7 +++++++ - 1 files changed, 7 insertions(+), 0 deletions(-) - -diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c -index db3867c..b6797cd 100644 ---- a/extras/cdrom_id/cdrom_id.c -+++ b/extras/cdrom_id/cdrom_id.c -@@ -237,6 +237,7 @@ static int cd_inquiry(struct udev *udev, int fd) { - unsigned char inq[128]; - int err; - -+ memset (inq, 0, sizeof (inq)); - scsi_cmd_set(udev, &sc, 0, 0x12); - scsi_cmd_set(udev, &sc, 4, 36); - scsi_cmd_set(udev, &sc, 5, 0); -@@ -265,6 +266,7 @@ static int cd_profiles(struct udev *udev, int fd) - unsigned int i; - int err; - -+ memset (header, 0, sizeof (header)); - scsi_cmd_set(udev, &sc, 0, 0x46); - scsi_cmd_set(udev, &sc, 1, 0); - scsi_cmd_set(udev, &sc, 8, sizeof(header)); -@@ -282,6 +284,7 @@ static int cd_profiles(struct udev *udev, int fd) - return -1; - } - -+ memset (profiles, 0, sizeof (profiles)); - scsi_cmd_set(udev, &sc, 0, 0x46); - scsi_cmd_set(udev, &sc, 1, 1); - scsi_cmd_set(udev, &sc, 6, len >> 16); -@@ -440,6 +443,7 @@ static int cd_media_info(struct udev *udev, int fd) - }; - int err; - -+ memset (header, 0, sizeof (header)); - scsi_cmd_set(udev, &sc, 0, 0x51); - scsi_cmd_set(udev, &sc, 8, sizeof(header)); - scsi_cmd_set(udev, &sc, 9, 0); -@@ -472,6 +476,7 @@ static int cd_media_toc(struct udev *udev, int fd) - unsigned char *p; - int err; - -+ memset (header, 0, sizeof (header)); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 6, 1); - scsi_cmd_set(udev, &sc, 8, sizeof(header)); -@@ -493,6 +498,7 @@ static int cd_media_toc(struct udev *udev, int fd) - if (len < 8) - return 0; - -+ memset (toc, 0, sizeof (toc)); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ - scsi_cmd_set(udev, &sc, 7, len >> 8); -@@ -520,6 +526,7 @@ static int cd_media_toc(struct udev *udev, int fd) - cd_media_track_count_audio++; - } - -+ memset (header, 0, sizeof (header)); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ - scsi_cmd_set(udev, &sc, 8, 12); --- -1.7.0.1 - diff --git a/0066-cdrom_id.patch b/0066-cdrom_id.patch deleted file mode 100644 index 2ff817c..0000000 --- a/0066-cdrom_id.patch +++ /dev/null @@ -1,88 +0,0 @@ -diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c -index b6797cd..afb481d 100644 ---- a/extras/cdrom_id/cdrom_id.c -+++ b/extras/cdrom_id/cdrom_id.c -@@ -1,7 +1,7 @@ - /* - * cdrom_id - optical drive and media information prober - * -- * Copyright (C) 2008 Kay Sievers -+ * Copyright (C) 2008-2010 Kay Sievers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by -@@ -157,7 +157,7 @@ struct scsi_cmd { - static void scsi_cmd_set(struct udev *udev, struct scsi_cmd *cmd, size_t i, int arg) - { - if (i == 0) { -- memset(cmd, 0x00, sizeof(struct scsi_cmd)); -+ memset(cmd, 0, sizeof(struct scsi_cmd)); - cmd->cgc.quiet = 1; - cmd->cgc.sense = &cmd->_sense.s; - memset(&cmd->sg_io, 0, sizeof(cmd->sg_io)); -@@ -237,7 +237,7 @@ static int cd_inquiry(struct udev *udev, int fd) { - unsigned char inq[128]; - int err; - -- memset (inq, 0, sizeof (inq)); -+ memset(inq, 0, sizeof(inq)); - scsi_cmd_set(udev, &sc, 0, 0x12); - scsi_cmd_set(udev, &sc, 4, 36); - scsi_cmd_set(udev, &sc, 5, 0); -@@ -266,7 +266,7 @@ static int cd_profiles(struct udev *udev, int fd) - unsigned int i; - int err; - -- memset (header, 0, sizeof (header)); -+ memset(header, 0, sizeof(header)); - scsi_cmd_set(udev, &sc, 0, 0x46); - scsi_cmd_set(udev, &sc, 1, 0); - scsi_cmd_set(udev, &sc, 8, sizeof(header)); -@@ -284,7 +284,7 @@ static int cd_profiles(struct udev *udev, int fd) - return -1; - } - -- memset (profiles, 0, sizeof (profiles)); -+ memset(profiles, 0, sizeof(profiles)); - scsi_cmd_set(udev, &sc, 0, 0x46); - scsi_cmd_set(udev, &sc, 1, 1); - scsi_cmd_set(udev, &sc, 6, len >> 16); -@@ -443,7 +443,7 @@ static int cd_media_info(struct udev *udev, int fd) - }; - int err; - -- memset (header, 0, sizeof (header)); -+ memset(header, 0, sizeof(header)); - scsi_cmd_set(udev, &sc, 0, 0x51); - scsi_cmd_set(udev, &sc, 8, sizeof(header)); - scsi_cmd_set(udev, &sc, 9, 0); -@@ -476,7 +476,7 @@ static int cd_media_toc(struct udev *udev, int fd) - unsigned char *p; - int err; - -- memset (header, 0, sizeof (header)); -+ memset(header, 0, sizeof(header)); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 6, 1); - scsi_cmd_set(udev, &sc, 8, sizeof(header)); -@@ -498,7 +498,7 @@ static int cd_media_toc(struct udev *udev, int fd) - if (len < 8) - return 0; - -- memset (toc, 0, sizeof (toc)); -+ memset(toc, 0, sizeof(toc)); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ - scsi_cmd_set(udev, &sc, 7, len >> 8); -@@ -526,7 +526,7 @@ static int cd_media_toc(struct udev *udev, int fd) - cd_media_track_count_audio++; - } - -- memset (header, 0, sizeof (header)); -+ memset(header, 0, sizeof (header)); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ - scsi_cmd_set(udev, &sc, 8, 12); --- -1.7.0.1 - diff --git a/0067-cdrom_id-rework-feature-profiles-buffer-parsing.patch b/0067-cdrom_id-rework-feature-profiles-buffer-parsing.patch deleted file mode 100644 index 8f96622..0000000 --- a/0067-cdrom_id-rework-feature-profiles-buffer-parsing.patch +++ /dev/null @@ -1,277 +0,0 @@ -From 0413a47ebfcd46ae43cb56ad508b2484bc97ff14 Mon Sep 17 00:00:00 2001 -From: Kay Sievers -Date: Thu, 15 Apr 2010 20:07:07 +0200 -Subject: [PATCH 067/110] cdrom_id: rework feature/profiles buffer parsing - ---- - extras/cdrom_id/cdrom_id.c | 156 +++++++++++++++++++++++++------------------ - 1 files changed, 91 insertions(+), 65 deletions(-) - -diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c -index afb481d..3f9ca4c 100644 ---- a/extras/cdrom_id/cdrom_id.c -+++ b/extras/cdrom_id/cdrom_id.c -@@ -154,19 +154,22 @@ struct scsi_cmd { - struct sg_io_hdr sg_io; - }; - --static void scsi_cmd_set(struct udev *udev, struct scsi_cmd *cmd, size_t i, int arg) -+static void scsi_cmd_init(struct udev *udev, struct scsi_cmd *cmd, unsigned char *buf, size_t bufsize) -+{ -+ memset(cmd, 0x00, sizeof(struct scsi_cmd)); -+ memset(buf, 0x00, bufsize); -+ cmd->cgc.quiet = 1; -+ cmd->cgc.sense = &cmd->_sense.s; -+ memset(&cmd->sg_io, 0, sizeof(cmd->sg_io)); -+ cmd->sg_io.interface_id = 'S'; -+ cmd->sg_io.mx_sb_len = sizeof(cmd->_sense); -+ cmd->sg_io.cmdp = cmd->cgc.cmd; -+ cmd->sg_io.sbp = cmd->_sense.u; -+ cmd->sg_io.flags = SG_FLAG_LUN_INHIBIT | SG_FLAG_DIRECT_IO; -+} -+ -+static void scsi_cmd_set(struct udev *udev, struct scsi_cmd *cmd, size_t i, unsigned char arg) - { -- if (i == 0) { -- memset(cmd, 0, sizeof(struct scsi_cmd)); -- cmd->cgc.quiet = 1; -- cmd->cgc.sense = &cmd->_sense.s; -- memset(&cmd->sg_io, 0, sizeof(cmd->sg_io)); -- cmd->sg_io.interface_id = 'S'; -- cmd->sg_io.mx_sb_len = sizeof(cmd->_sense); -- cmd->sg_io.cmdp = cmd->cgc.cmd; -- cmd->sg_io.sbp = cmd->_sense.u; -- cmd->sg_io.flags = SG_FLAG_LUN_INHIBIT | SG_FLAG_DIRECT_IO; -- } - cmd->sg_io.cmd_len = i + 1; - cmd->cgc.cmd[i] = arg; - } -@@ -237,7 +240,7 @@ static int cd_inquiry(struct udev *udev, int fd) { - unsigned char inq[128]; - int err; - -- memset(inq, 0, sizeof(inq)); -+ scsi_cmd_init(udev, &sc, inq, sizeof(inq)); - scsi_cmd_set(udev, &sc, 0, 0x12); - scsi_cmd_set(udev, &sc, 4, 36); - scsi_cmd_set(udev, &sc, 5, 0); -@@ -256,109 +259,132 @@ static int cd_inquiry(struct udev *udev, int fd) { - return 0; - } - --static int cd_profiles(struct udev *udev, int fd) -+static int feature_profiles(struct udev *udev, const unsigned char *profiles, size_t size) - { -- struct scsi_cmd sc; -- unsigned char header[8]; -- unsigned char profiles[512]; -- unsigned int cur_profile; -- unsigned int len; - unsigned int i; -- int err; -- -- memset(header, 0, sizeof(header)); -- scsi_cmd_set(udev, &sc, 0, 0x46); -- scsi_cmd_set(udev, &sc, 1, 0); -- scsi_cmd_set(udev, &sc, 8, sizeof(header)); -- scsi_cmd_set(udev, &sc, 9, 0); -- err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); -- if ((err < 0)) { -- info_scsi_cmd_err(udev, "GET CONFIGURATION", err); -- return -1; -- } - -- len = 4 + (header[0] << 24 | header[1] << 16 | header[2] << 8 | header[3]); -- info(udev, "GET CONFIGURATION: number of profiles %i\n", len); -- if (len > sizeof(profiles)) { -- info(udev, "invalid number of profiles\n"); -- return -1; -- } -- -- memset(profiles, 0, sizeof(profiles)); -- scsi_cmd_set(udev, &sc, 0, 0x46); -- scsi_cmd_set(udev, &sc, 1, 1); -- scsi_cmd_set(udev, &sc, 6, len >> 16); -- scsi_cmd_set(udev, &sc, 7, len >> 8); -- scsi_cmd_set(udev, &sc, 8, len); -- scsi_cmd_set(udev, &sc, 9, 0); -- err = scsi_cmd_run(udev, &sc, fd, profiles, len); -- if ((err < 0)) { -- info_scsi_cmd_err(udev, "GET CONFIGURATION", err); -- return -1; -- } -- -- /* device profiles */ -- for (i = 12; i < profiles[11]; i += 4) { -- unsigned int profile = (profiles[i] << 8 | profiles[i + 1]); -- if (profile == 0) -- continue; -- info(udev, "profile 0x%02x\n", profile); -+ for (i = 0; i+4 <= size; i += 4) { -+ int profile; - -+ profile = profiles[i] << 8 | profiles[i+1]; - switch (profile) { - case 0x03: - case 0x04: - case 0x05: -+ info(udev, "profile 0x%02x mo\n", profile); - cd_mo = 1; -- break; -+ break; - case 0x10: -+ info(udev, "profile 0x%02x dvd_rom\n", profile); - cd_dvd_rom = 1; - break; - case 0x12: -+ info(udev, "profile 0x%02x dvd_ram\n", profile); - cd_dvd_ram = 1; - break; - case 0x13: - case 0x14: -+ info(udev, "profile 0x%02x dvd_rw\n", profile); - cd_dvd_rw = 1; - break; - case 0x1B: -+ info(udev, "profile 0x%02x dvd_plus_r\n", profile); - cd_dvd_plus_r = 1; - break; - case 0x1A: -+ info(udev, "profile 0x%02x dvd_plus_rw\n", profile); - cd_dvd_plus_rw = 1; - break; - case 0x2A: -+ info(udev, "profile 0x%02x dvd_plus_rw_dl\n", profile); - cd_dvd_plus_rw_dl = 1; - break; - case 0x2B: -+ info(udev, "profile 0x%02x dvd_plus_r_dl\n", profile); - cd_dvd_plus_r_dl = 1; - break; - case 0x40: - cd_bd = 1; -+ info(udev, "profile 0x%02x bd\n", profile); - break; - case 0x41: - case 0x42: - cd_bd_r = 1; -+ info(udev, "profile 0x%02x bd_r\n", profile); - break; - case 0x43: - cd_bd_re = 1; -+ info(udev, "profile 0x%02x bd_re\n", profile); - break; - case 0x50: - cd_hddvd = 1; -+ info(udev, "profile 0x%02x hddvd\n", profile); - break; - case 0x51: - cd_hddvd_r = 1; -+ info(udev, "profile 0x%02x hddvd_r\n", profile); - break; - case 0x52: - cd_hddvd_rw = 1; -+ info(udev, "profile 0x%02x hddvd_rw\n", profile); -+ break; -+ default: -+ info(udev, "profile 0x%02x \n", profile); -+ break; -+ } -+ } -+ return 0; -+} -+ -+static int cd_profiles(struct udev *udev, int fd) -+{ -+ struct scsi_cmd sc; -+ unsigned char features[65530]; -+ unsigned int cur_profile = 0; -+ unsigned int len; -+ unsigned int i; -+ int err; -+ -+ scsi_cmd_init(udev, &sc, features, sizeof(features)); -+ scsi_cmd_set(udev, &sc, 0, 0x46); -+ scsi_cmd_set(udev, &sc, 7, (sizeof(features) >> 8) & 0xff); -+ scsi_cmd_set(udev, &sc, 8, sizeof(features) & 0xff); -+ scsi_cmd_set(udev, &sc, 9, 0); -+ err = scsi_cmd_run(udev, &sc, fd, features, sizeof(features)); -+ if ((err < 0)) { -+ info_scsi_cmd_err(udev, "GET CONFIGURATION", err); -+ return -1; -+ } -+ -+ len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; -+ info(udev, "GET CONFIGURATION: size of features buffer %i\n", len); -+ -+ if (len > sizeof(features)) { -+ info(udev, "can not get features in a single query, truncating\n"); -+ len = sizeof(features); -+ } -+ -+ /* device features */ -+ for (i = 8; i+4 < len; i += (4 + features[i+3])) { -+ unsigned int feature; -+ -+ feature = features[i] << 8 | features[i+1]; -+ -+ switch (feature) { -+ case 0x00: -+ info(udev, "GET CONFIGURATION: feature 'profiles', with %i entries\n", features[i+3] / 4); -+ feature_profiles(udev, &features[i]+4, features[i+3]); -+ -+ /* set current profile, if we got a profiles section */ -+ cur_profile = features[6] << 8 | features[7]; -+ info(udev, "current profile 0x%02x\n", cur_profile); - break; - default: -+ info(udev, "GET CONFIGURATION: feature %i , with %i bytes\n", feature, features[i+3]); - break; - } - } - -- /* current media profile */ -- cur_profile = header[6] << 8 | header[7]; -- info(udev, "current profile 0x%02x\n", cur_profile); - if (cur_profile == 0) { - info(udev, "no current profile, assuming no media\n"); - return -1; -@@ -443,7 +469,7 @@ static int cd_media_info(struct udev *udev, int fd) - }; - int err; - -- memset(header, 0, sizeof(header)); -+ scsi_cmd_init(udev, &sc, header, sizeof(header)); - scsi_cmd_set(udev, &sc, 0, 0x51); - scsi_cmd_set(udev, &sc, 8, sizeof(header)); - scsi_cmd_set(udev, &sc, 9, 0); -@@ -476,7 +502,7 @@ static int cd_media_toc(struct udev *udev, int fd) - unsigned char *p; - int err; - -- memset(header, 0, sizeof(header)); -+ scsi_cmd_init(udev, &sc, header, sizeof(header)); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 6, 1); - scsi_cmd_set(udev, &sc, 8, sizeof(header)); -@@ -498,7 +524,7 @@ static int cd_media_toc(struct udev *udev, int fd) - if (len < 8) - return 0; - -- memset(toc, 0, sizeof(toc)); -+ scsi_cmd_init(udev, &sc, toc, sizeof(toc)); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ - scsi_cmd_set(udev, &sc, 7, len >> 8); -@@ -526,7 +552,7 @@ static int cd_media_toc(struct udev *udev, int fd) - cd_media_track_count_audio++; - } - -- memset(header, 0, sizeof (header)); -+ scsi_cmd_init(udev, &sc, header, sizeof(header)); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ - scsi_cmd_set(udev, &sc, 8, 12); --- -1.7.0.1 - diff --git a/0068-cdrom_id-print-more-debug-messages.patch b/0068-cdrom_id-print-more-debug-messages.patch deleted file mode 100644 index 672c1bc..0000000 --- a/0068-cdrom_id-print-more-debug-messages.patch +++ /dev/null @@ -1,121 +0,0 @@ -From 2e9df1981833e1e029b7ce6c12a44dffb6aad0cb Mon Sep 17 00:00:00 2001 -From: Kay Sievers -Date: Thu, 15 Apr 2010 20:48:04 +0200 -Subject: [PATCH 068/110] cdrom_id: print more debug messages - ---- - extras/cdrom_id/cdrom_id.c | 28 +++++++++++++++++++++++----- - 1 files changed, 23 insertions(+), 5 deletions(-) - -diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c -index 3f9ca4c..d9b6fbd 100644 ---- a/extras/cdrom_id/cdrom_id.c -+++ b/extras/cdrom_id/cdrom_id.c -@@ -374,10 +374,6 @@ static int cd_profiles(struct udev *udev, int fd) - case 0x00: - info(udev, "GET CONFIGURATION: feature 'profiles', with %i entries\n", features[i+3] / 4); - feature_profiles(udev, &features[i]+4, features[i+3]); -- -- /* set current profile, if we got a profiles section */ -- cur_profile = features[6] << 8 | features[7]; -- info(udev, "current profile 0x%02x\n", cur_profile); - break; - default: - info(udev, "GET CONFIGURATION: feature %i , with %i bytes\n", feature, features[i+3]); -@@ -385,7 +381,10 @@ static int cd_profiles(struct udev *udev, int fd) - } - } - -- if (cur_profile == 0) { -+ cur_profile = features[6] << 8 | features[7]; -+ if (cur_profile > 0) { -+ info(udev, "current profile 0x%02x\n", cur_profile); -+ } else { - info(udev, "no current profile, assuming no media\n"); - return -1; - } -@@ -396,62 +395,81 @@ static int cd_profiles(struct udev *udev, int fd) - case 0x03: - case 0x04: - case 0x05: -+ info(udev, "profile 0x%02x \n", cur_profile); - cd_media_mo = 1; - break; - case 0x08: -+ info(udev, "profile 0x%02x media_cd_rom\n", cur_profile); - cd_media_cd_rom = 1; - break; - case 0x09: -+ info(udev, "profile 0x%02x media_cd_r\n", cur_profile); - cd_media_cd_r = 1; - break; - case 0x0a: -+ info(udev, "profile 0x%02x media_cd_rw\n", cur_profile); - cd_media_cd_rw = 1; - break; - case 0x10: -+ info(udev, "profile 0x%02x media_dvd_ro\n", cur_profile); - cd_media_dvd_rom = 1; - break; - case 0x11: -+ info(udev, "profile 0x%02x media_dvd_r\n", cur_profile); - cd_media_dvd_r = 1; - break; - case 0x12: -+ info(udev, "profile 0x%02x media_dvd_ram\n", cur_profile); - cd_media_dvd_ram = 1; - break; - case 0x13: - case 0x14: -+ info(udev, "profile 0x%02x media_dvd_rw\n", cur_profile); - cd_media_dvd_rw = 1; - break; - case 0x1B: -+ info(udev, "profile 0x%02x media_dvd_plus_r\n", cur_profile); - cd_media_dvd_plus_r = 1; - break; - case 0x1A: -+ info(udev, "profile 0x%02x media_dvd_plus_rw\n", cur_profile); - cd_media_dvd_plus_rw = 1; - break; - case 0x2A: -+ info(udev, "profile 0x%02x media_dvd_plus_rw_dl\n", cur_profile); - 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_dvd_plus_r_dl = 1; - break; - case 0x40: -+ info(udev, "profile 0x%02x media_bd\n", cur_profile); - cd_media_bd = 1; - break; - case 0x41: - case 0x42: -+ info(udev, "profile 0x%02x media_bd_r\n", cur_profile); - cd_media_bd_r = 1; - break; - case 0x43: -+ info(udev, "profile 0x%02x media_bd_re\n", cur_profile); - cd_media_bd_re = 1; - break; - case 0x50: -+ info(udev, "profile 0x%02x media_hddvd\n", cur_profile); - cd_media_hddvd = 1; - break; - case 0x51: -+ info(udev, "profile 0x%02x media_hddvd_r\n", cur_profile); - cd_media_hddvd_r = 1; - break; - case 0x52: -+ info(udev, "profile 0x%02x media_hddvd_rw\n", cur_profile); - cd_media_hddvd_rw = 1; - break; - default: -+ info(udev, "profile 0x%02x \n", cur_profile); - break; - } - return 0; --- -1.7.0.1 - diff --git a/0069-cdrom_id-debug-print-feature-values-in-hex.patch b/0069-cdrom_id-debug-print-feature-values-in-hex.patch deleted file mode 100644 index d34d52b..0000000 --- a/0069-cdrom_id-debug-print-feature-values-in-hex.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 140647ad1aec50e2f657e7838e893a87404ff83a Mon Sep 17 00:00:00 2001 -From: Kay Sievers -Date: Thu, 15 Apr 2010 21:18:21 +0200 -Subject: [PATCH 069/110] cdrom_id: debug - print feature values in hex - ---- - extras/cdrom_id/cdrom_id.c | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c -index d9b6fbd..b2c107b 100644 ---- a/extras/cdrom_id/cdrom_id.c -+++ b/extras/cdrom_id/cdrom_id.c -@@ -376,7 +376,7 @@ static int cd_profiles(struct udev *udev, int fd) - feature_profiles(udev, &features[i]+4, features[i+3]); - break; - default: -- info(udev, "GET CONFIGURATION: feature %i , with %i bytes\n", feature, features[i+3]); -+ info(udev, "GET CONFIGURATION: feature 0x%04x , with 0x%02x bytes\n", feature, features[i+3]); - break; - } - } --- -1.7.0.1 - diff --git a/0070-cdrom_id-debug-print-feature-values-in-hex.patch b/0070-cdrom_id-debug-print-feature-values-in-hex.patch deleted file mode 100644 index 1ff0b25..0000000 --- a/0070-cdrom_id-debug-print-feature-values-in-hex.patch +++ /dev/null @@ -1,25 +0,0 @@ -From a60b077a465b19af2efd9bf0cb5f0f67117be780 Mon Sep 17 00:00:00 2001 -From: Kay Sievers -Date: Thu, 15 Apr 2010 21:22:38 +0200 -Subject: [PATCH 070/110] cdrom_id: debug - print feature values in hex - ---- - extras/cdrom_id/cdrom_id.c | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c -index b2c107b..16b1260 100644 ---- a/extras/cdrom_id/cdrom_id.c -+++ b/extras/cdrom_id/cdrom_id.c -@@ -357,7 +357,7 @@ static int cd_profiles(struct udev *udev, int fd) - } - - len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; -- info(udev, "GET CONFIGURATION: size of features buffer %i\n", len); -+ info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len); - - if (len > sizeof(features)) { - info(udev, "can not get features in a single query, truncating\n"); --- -1.7.0.1 - diff --git a/0071-cdrom_id-Do-not-ignore-errors-from-scsi_cmd_run.patch b/0071-cdrom_id-Do-not-ignore-errors-from-scsi_cmd_run.patch deleted file mode 100644 index b5543bf..0000000 --- a/0071-cdrom_id-Do-not-ignore-errors-from-scsi_cmd_run.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 58e178894bfc040834e1270c6fe9b9fdef513550 Mon Sep 17 00:00:00 2001 -From: Martin Pitt -Date: Thu, 15 Apr 2010 08:56:48 +0200 -Subject: [PATCH 071/110] cdrom_id: Do not ignore errors from scsi_cmd_run() - -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 for spotting this! - -https://launchpad.net/bugs/562978 ---- - extras/cdrom_id/cdrom_id.c | 12 ++++++------ - 1 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c -index 16b1260..37212e9 100644 ---- a/extras/cdrom_id/cdrom_id.c -+++ b/extras/cdrom_id/cdrom_id.c -@@ -245,7 +245,7 @@ static int cd_inquiry(struct udev *udev, int fd) { - scsi_cmd_set(udev, &sc, 4, 36); - scsi_cmd_set(udev, &sc, 5, 0); - err = scsi_cmd_run(udev, &sc, fd, inq, 36); -- if ((err < 0)) { -+ if ((err != 0)) { - info_scsi_cmd_err(udev, "INQUIRY", err); - return -1; - } -@@ -351,7 +351,7 @@ static int cd_profiles(struct udev *udev, int fd) - scsi_cmd_set(udev, &sc, 8, sizeof(features) & 0xff); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, features, sizeof(features)); -- if ((err < 0)) { -+ if ((err != 0)) { - info_scsi_cmd_err(udev, "GET CONFIGURATION", err); - return -1; - } -@@ -492,7 +492,7 @@ static int cd_media_info(struct udev *udev, int fd) - scsi_cmd_set(udev, &sc, 8, sizeof(header)); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); -- if ((err < 0)) { -+ if ((err != 0)) { - info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); - return -1; - }; -@@ -526,7 +526,7 @@ static int cd_media_toc(struct udev *udev, int fd) - scsi_cmd_set(udev, &sc, 8, sizeof(header)); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); -- if ((err < 0)) { -+ if ((err != 0)) { - info_scsi_cmd_err(udev, "READ TOC", err); - return -1; - } -@@ -549,7 +549,7 @@ static int cd_media_toc(struct udev *udev, int fd) - scsi_cmd_set(udev, &sc, 8, len); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, toc, len); -- if ((err < 0)) { -+ if ((err != 0)) { - info_scsi_cmd_err(udev, "READ TOC (tracks)", err); - return -1; - } -@@ -576,7 +576,7 @@ static int cd_media_toc(struct udev *udev, int fd) - scsi_cmd_set(udev, &sc, 8, 12); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); -- if ((err < 0)) { -+ if ((err != 0)) { - info_scsi_cmd_err(udev, "READ TOC (multi session)", err); - return -1; - } --- -1.7.0.1 - diff --git a/0072-cdrom_id-Swap-media-state-and-TOC-info-probing.patch b/0072-cdrom_id-Swap-media-state-and-TOC-info-probing.patch deleted file mode 100644 index 2865983..0000000 --- a/0072-cdrom_id-Swap-media-state-and-TOC-info-probing.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 30e3b1a0d3a3ec76f16736470dc656744848d941 Mon Sep 17 00:00:00 2001 -From: Martin Pitt -Date: Thu, 15 Apr 2010 21:25:57 +0200 -Subject: [PATCH 072/110] cdrom_id: Swap media state and TOC info probing - -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. ---- - extras/cdrom_id/cdrom_id.c | 8 ++++---- - 1 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c -index 37212e9..722b8f8 100644 ---- a/extras/cdrom_id/cdrom_id.c -+++ b/extras/cdrom_id/cdrom_id.c -@@ -681,14 +681,14 @@ int main(int argc, char *argv[]) - if (cd_profiles(udev, fd) < 0) - goto print; - -- /* get session/track info */ -- if (cd_media_toc(udev, fd) < 0) -- goto print; -- - /* get writable media state */ - if (cd_media_info(udev, fd) < 0) - goto print; - -+ /* get session/track info */ -+ if (cd_media_toc(udev, fd) < 0) -+ goto print; -+ - print: - printf("ID_CDROM=1\n"); - if (cd_cd_rom) --- -1.7.0.1 - diff --git a/0074-cdrom_id-add-missing-profiles-to-feature_profiles.patch b/0074-cdrom_id-add-missing-profiles-to-feature_profiles.patch deleted file mode 100644 index 26e92b1..0000000 --- a/0074-cdrom_id-add-missing-profiles-to-feature_profiles.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 7c07740ce7b0941844b15573449a730283d5bba5 Mon Sep 17 00:00:00 2001 -From: Mike Brudevold -Date: Thu, 15 Apr 2010 19:55:50 -0500 -Subject: [PATCH 074/110] cdrom_id: add missing profiles to feature_profiles - -Signed-off-by: Mike Brudevold ---- - extras/cdrom_id/cdrom_id.c | 12 ++++++++++++ - 1 files changed, 12 insertions(+), 0 deletions(-) - -diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c -index 722b8f8..da2785e 100644 ---- a/extras/cdrom_id/cdrom_id.c -+++ b/extras/cdrom_id/cdrom_id.c -@@ -274,6 +274,18 @@ static int feature_profiles(struct udev *udev, const unsigned char *profiles, si - info(udev, "profile 0x%02x mo\n", profile); - cd_mo = 1; - break; -+ case 0x08: -+ info(udev, "profile 0x%02x cd_rom\n", profile); -+ cd_cd_rom = 1; -+ break; -+ case 0x09: -+ info(udev, "profile 0x%02x cd_r\n", profile); -+ cd_cd_r = 1; -+ break; -+ case 0x0A: -+ info(udev, "profile 0x%02x cd_rw\n", profile); -+ cd_cd_rw = 1; -+ break; - case 0x10: - info(udev, "profile 0x%02x dvd_rom\n", profile); - cd_dvd_rom = 1; --- -1.7.0.1 - diff --git a/0075-cdrom_id-set-ID_CDROM_MEDIA-1-only-for-known-media.patch b/0075-cdrom_id-set-ID_CDROM_MEDIA-1-only-for-known-media.patch deleted file mode 100644 index 091bba3..0000000 --- a/0075-cdrom_id-set-ID_CDROM_MEDIA-1-only-for-known-media.patch +++ /dev/null @@ -1,183 +0,0 @@ -From bc913ce47821ed030437ec9b25507b5dd52b59cb Mon Sep 17 00:00:00 2001 -From: Kay Sievers -Date: Sat, 17 Apr 2010 19:31:44 +0200 -Subject: [PATCH 075/110] cdrom_id: set ID_CDROM_MEDIA=1 only for known media - -On Sat, Apr 17, 2010 at 18:26, Mike Brudevold 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 -... - -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. ---- - extras/cdrom_id/cdrom_id.c | 33 +++++++++++++++++++++++++-------- - 1 files changed, 25 insertions(+), 8 deletions(-) - -diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c -index da2785e..935f117 100644 ---- a/extras/cdrom_id/cdrom_id.c -+++ b/extras/cdrom_id/cdrom_id.c -@@ -401,83 +401,99 @@ static int cd_profiles(struct udev *udev, int fd) - return -1; - } - -- cd_media = 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: - case 0x14: - info(udev, "profile 0x%02x media_dvd_rw\n", cur_profile); -+ cd_media = 1; - cd_media_dvd_rw = 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: -@@ -501,7 +517,7 @@ static int cd_media_info(struct udev *udev, int fd) - - scsi_cmd_init(udev, &sc, header, sizeof(header)); - scsi_cmd_set(udev, &sc, 0, 0x51); -- scsi_cmd_set(udev, &sc, 8, sizeof(header)); -+ scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); - if ((err != 0)) { -@@ -509,10 +525,11 @@ static int cd_media_info(struct udev *udev, int fd) - return -1; - }; - -+ cd_media = 1; - info(udev, "disk type %02x\n", header[8]); - - /* exclude plain CDROM, some fake cdroms return 0 for "blank" media here */ -- if (!cd_media_cd_rom && (header[2] & 3) < 4) -+ if (!cd_media_cd_rom) - cd_media_state = media_status[header[2] & 3]; - - if ((header[2] & 3) != 2) -@@ -535,7 +552,7 @@ static int cd_media_toc(struct udev *udev, int fd) - scsi_cmd_init(udev, &sc, header, sizeof(header)); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 6, 1); -- scsi_cmd_set(udev, &sc, 8, sizeof(header)); -+ scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); - if ((err != 0)) { -@@ -557,8 +574,8 @@ static int cd_media_toc(struct udev *udev, int fd) - scsi_cmd_init(udev, &sc, toc, sizeof(toc)); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ -- scsi_cmd_set(udev, &sc, 7, len >> 8); -- scsi_cmd_set(udev, &sc, 8, len); -+ scsi_cmd_set(udev, &sc, 7, (len >> 8) & 0xff); -+ scsi_cmd_set(udev, &sc, 8, len & 0xff); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, toc, len); - if ((err != 0)) { -@@ -585,7 +602,7 @@ static int cd_media_toc(struct udev *udev, int fd) - scsi_cmd_init(udev, &sc, header, sizeof(header)); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ -- scsi_cmd_set(udev, &sc, 8, 12); -+ scsi_cmd_set(udev, &sc, 8, sizeof(header)); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); - if ((err != 0)) { --- -1.7.0.1 - diff --git a/40-ia64.rules b/40-ia64.rules new file mode 100644 index 0000000..5846f88 --- /dev/null +++ b/40-ia64.rules @@ -0,0 +1,4 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="sgi_*", MODE="0666" + diff --git a/40-isdn.rules b/40-isdn.rules new file mode 100644 index 0000000..1a31cb6 --- /dev/null +++ b/40-isdn.rules @@ -0,0 +1,4 @@ +# do not edit this file, it will be overwritten on update + +SUBSYSTEM=="capi", KERNEL=="capi", NAME="capi20", GROUP="dialout" +SUBSYSTEM=="tty", KERNEL=="capi[0-9]*", NAME="capi/%n" diff --git a/40-ppc.rules b/40-ppc.rules new file mode 100644 index 0000000..90c15f0 --- /dev/null +++ b/40-ppc.rules @@ -0,0 +1,6 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="iseries/ibmsis*", GROUP="disk" +KERNEL=="iseries/nvt*", GROUP="disk" +KERNEL=="iseries/vt*", GROUP="disk" +KERNEL=="iseries/vtty*, GROUP="dialout" diff --git a/40-s390.rules b/40-s390.rules new file mode 100644 index 0000000..43035db --- /dev/null +++ b/40-s390.rules @@ -0,0 +1,4 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="z90crypt", MODE="0666" + diff --git a/64-device-mapper.rules b/64-device-mapper.rules new file mode 100644 index 0000000..8154ef3 --- /dev/null +++ b/64-device-mapper.rules @@ -0,0 +1,4 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="device-mapper", NAME="mapper/control" + diff --git a/64-md-raid.rules b/64-md-raid.rules new file mode 100644 index 0000000..6ba93b6 --- /dev/null +++ b/64-md-raid.rules @@ -0,0 +1,36 @@ +# do not edit this file, it will be overwritten on update + +SUBSYSTEM!="block", GOTO="md_end" +ACTION!="add|change", GOTO="md_end" + +# import data from a raid member and activate it +#ENV{ID_FS_TYPE}=="linux_raid_member", IMPORT{program}="/sbin/mdadm --examine --export $tempnode", RUN+="/sbin/mdadm --incremental $env{DEVNAME}" +# import data from a raid set +KERNEL!="md*", GOTO="md_end" + +# partitions have no md/{array_state,metadata_version} +ENV{DEVTYPE}=="partition", GOTO="md_ignore_state" + +# container devices have a metadata version of e.g. 'external:ddf' and +# never leave state 'inactive' +ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state" +TEST!="md/array_state", GOTO="md_end" +ATTR{md/array_state}=="|clear|inactive", GOTO="md_end" +LABEL="md_ignore_state" + +IMPORT{program}="/sbin/mdadm --detail --export $tempnode" +ENV{DEVTYPE}=="disk", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}", OPTIONS+="string_escape=replace" +ENV{DEVTYPE}=="disk", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}" +ENV{DEVTYPE}=="disk", ENV{MD_DEVNAME}=="?*", SYMLINK+="md/$env{MD_DEVNAME}" +ENV{DEVTYPE}=="partition", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}-part%n", OPTIONS+="string_escape=replace" +ENV{DEVTYPE}=="partition", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}-part%n" +ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[^0-9]", SYMLINK+="md/$env{MD_DEVNAME}%n" +ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[0-9]", SYMLINK+="md/$env{MD_DEVNAME}p%n" + +IMPORT{program}="/sbin/blkid -o udev -p $tempnode" +OPTIONS+="link_priority=100" +OPTIONS+="watch" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" + +LABEL="md_end" diff --git a/sources b/sources index 3161bc7..c94ae06 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ -aeae0e6273dcbec246c3c1b9868ebed1 udev-151.tar.bz2 +76d12a9d97c3409e9ef60a4288227e8f udev-153.tar.bz2 +962e6d9b7fcf45432b361e3116923a3a udev-153.tar.bz2.sign diff --git a/udev.spec b/udev.spec index f809c07..112f891 100644 --- a/udev.spec +++ b/udev.spec @@ -4,8 +4,8 @@ Summary: A userspace implementation of devfs Name: udev -Version: 151 -Release: 11%{?dist} +Version: 153 +Release: 1%{?dist} License: GPLv2 Group: System Environment/Base Provides: udev-persistent = %{version}-%{release} @@ -13,48 +13,11 @@ Obsoletes: udev-persistent < 0:030-5 Obsoletes: udev-extras < 20090618 Provides: udev-extras = 20090618-1 Source: ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/%{name}-%{version}.tar.bz2 -Patch1: 0001-firmware-fix-error-reporting-on-missing-firmware-fil.patch -Patch2: 0002-keymap-Add-Dell-Inspiron-1011-Mini-10.patch -Patch3: 0003-Fix-brightness-keys-on-MSI-Wind-U-100.patch -Patch4: 0004-keymap-Add-support-for-Gateway-AOA110-AOA150-clones.patch -Patch5: 0005-keymap-Fix-LG-X110.patch -Patch6: 0006-Force-key-release-for-volume-keys-on-Dell-Studio-155.patch -Patch7: 0007-keymap-Add-Toshiba-Satellite-M30X.patch -Patch13: 0013-keymap-Add-Samsung-Q210-P210-force-release-quirk.patch -Patch14: 0014-keymap-Add-Fujitsu-Amilo-1848-u-force-release-quirk.patch -Patch15: 0015-Decrease-buffer-size-when-advancing-past-NUL-byte.patch -Patch16: 0016-Use-UTIL_LINE_SIZE-not-UTIL_PATH_SIZE-to-truncate-pr.patch -Patch17: 0017-Increase-UTIL_LINE_SIZE-from-2048-to-16384.patch -Patch18: 0018-Fix-virtio-ports-rule-to-use-attr-instead-of-ATTR.patch -Patch19: 0019-udev-acl-Correctly-handle-ENV-ACL_MANAGE-0.patch -Patch21: 0021-input_id-Fix-linking.patch -Patch22: 0022-replace-utimes-with-utimensat.patch -Patch29: 0029-firmware-fix-possible-segfault-when-firmware-device-.patch -Patch30: 0030-rules-input-create-by-path-links-for-pci-devices.patch -Patch32: 0032-do-not-reset-SELinux-context-when-the-node-was-not-t.patch + Patch34: 0034-add-LGPL-COPYING-to-libudev-and-GUdev.patch -Patch35: 0035-cdrom_id-open-non-mounted-optical-media-with-O_EXCL.patch -Patch36: 0036-modeswitch-morph-into-tool-that-only-switches-Mobile.patch -Patch48: 0048-cdrom_id-remove-debugging-code.patch -Patch49: 0049-cdrom_id-retry-to-open-the-device-if-EBUSY.patch -Patch50: 0050-cdrom_id-check-mount-state-in-retry-loop.patch -Patch51: 0051-cdrom_id-always-set-ID_CDROM-regardless-if-we-can-ru.patch -Patch62: 0062-cdrom_id-Fix-uninitialized-variables.patch -Patch65: 0065-cdrom_id-Fix-uninitialized-buffers.patch -Patch66: 0066-cdrom_id.patch -Patch67: 0067-cdrom_id-rework-feature-profiles-buffer-parsing.patch -Patch68: 0068-cdrom_id-print-more-debug-messages.patch -Patch69: 0069-cdrom_id-debug-print-feature-values-in-hex.patch -Patch70: 0070-cdrom_id-debug-print-feature-values-in-hex.patch -Patch71: 0071-cdrom_id-Do-not-ignore-errors-from-scsi_cmd_run.patch -Patch72: 0072-cdrom_id-Swap-media-state-and-TOC-info-probing.patch -Patch74: 0074-cdrom_id-add-missing-profiles-to-feature_profiles.patch -Patch75: 0075-cdrom_id-set-ID_CDROM_MEDIA-1-only-for-known-media.patch Patch110: 0110-cdrom_id-only-mark-sr-0-9-as-ID_CDROM.patch - Patch101: udev-151-rules.patch -Patch102: udev-151-virtio.patch Patch103: udev-151-gperf.patch Source1: start_udev @@ -62,6 +25,13 @@ Source3: udev-post.init Source4: fw_unit_symlinks.sh Source5: udev.sysconfig +Source12: 40-isdn.rules +Source13: 64-md-raid.rules +Source14: 64-device-mapper.rules +Source15: 40-ia64.rules +Source16: 40-s390.rules +Source17: 40-ppc.rules + ExclusiveOS: Linux URL: http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -152,47 +122,10 @@ glib-based applications using libudev functionality. %prep %setup -q -%patch1 -p1 -b .git1 -%patch2 -p1 -b .git2 -%patch3 -p1 -b .git3 -%patch4 -p1 -b .git4 -%patch5 -p1 -b .git5 -%patch6 -p1 -b .git6 -%patch7 -p1 -b .git7 -%patch13 -p1 -b .git13 -%patch14 -p1 -b .git14 -%patch15 -p1 -b .git15 -%patch16 -p1 -b .git16 -%patch17 -p1 -b .git17 -%patch18 -p1 -b .git18 -%patch19 -p1 -b .git19 -%patch21 -p1 -b .git21 -%patch22 -p1 -b .git22 -%patch29 -p1 -b .git29 -%patch30 -p1 -b .git30 -%patch32 -p1 -b .git32 %patch34 -p1 -b .git34 -%patch35 -p1 -b .git35 -%patch36 -p1 -b .git36 -%patch48 -p1 -b .git48 -%patch49 -p1 -b .git49 -%patch50 -p1 -b .git50 -%patch51 -p1 -b .git51 -%patch62 -p1 -b .git62 -%patch65 -p1 -b .git65 -%patch66 -p1 -b .git66 -%patch67 -p1 -b .git67 -%patch68 -p1 -b .git68 -%patch69 -p1 -b .git69 -%patch70 -p1 -b .git70 -%patch71 -p1 -b .git71 -%patch72 -p1 -b .git72 -%patch74 -p1 -b .git74 -%patch75 -p1 -b .git75 %patch110 -p1 -b .git110 %patch101 -p1 -%patch102 -p1 %patch103 -p1 %build @@ -230,17 +163,17 @@ ln -sf ..%{udev_scriptdir}/scsi_id $RPM_BUILD_ROOT/sbin/scsi_id for i in \ rules/redhat/40-redhat.rules \ %ifarch ia64 - rules/packages/40-ia64.rules \ + %{SOURCE15} \ %endif %ifarch ppc ppc64 - rules/packages/40-ppc.rules \ + %{SOURCE17} \ %endif %ifarch s390 s390x - rules/packages/40-s390.rules \ + %{SOURCE16} \ %endif - rules/packages/40-isdn.rules \ - rules/packages/64-md-raid.rules \ - rules/packages/64-device-mapper.rules \ + %{SOURCE12} \ + %{SOURCE13} \ + %{SOURCE14} \ ; do install -m 0644 "$i" "$RPM_BUILD_ROOT%{udev_scriptdir}/rules.d/${i##*/}" done @@ -430,7 +363,8 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_libdir}/pkgconfig/gudev-1.0* %changelog -* Mon Aug 02 2010 Harald Hoyer 151-11 +* Mon Aug 02 2010 Harald Hoyer 153-1 +- version 153, because device-mapper needs IMPORT{db} - do not remove udev database Resolves: rhbz#610925 From 57475b85360644726946638849556d616aeab10a Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 4 Aug 2010 14:59:43 +0200 Subject: [PATCH 16/24] start_udev: trigger with action==add --- start_udev | 2 +- udev.spec | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/start_udev b/start_udev index 76c2649..3193de8 100755 --- a/start_udev +++ b/start_udev @@ -310,7 +310,7 @@ if [ -f "/sys/class/tty/console/uevent" ]; then echo "Triggering Rest" fi - /sbin/udevadm trigger + /sbin/udevadm trigger --action=add ret=$[$ret + $?] wait_for_queue $udevtimeout ret=$[$ret + $?] diff --git a/udev.spec b/udev.spec index 112f891..112df2f 100644 --- a/udev.spec +++ b/udev.spec @@ -363,6 +363,8 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_libdir}/pkgconfig/gudev-1.0* %changelog +- trigger with action==add + * Mon Aug 02 2010 Harald Hoyer 153-1 - version 153, because device-mapper needs IMPORT{db} - do not remove udev database From 3e4cfcfce041711466bef756f5974a0e6331fc0a Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 4 Aug 2010 15:00:53 +0200 Subject: [PATCH 17/24] start_udev: add rd_NO_MDIMSM on noiswmd kernel cmdline option --- start_udev | 3 +++ udev.spec | 2 ++ 2 files changed, 5 insertions(+) diff --git a/start_udev b/start_udev index 3193de8..ba9b10c 100755 --- a/start_udev +++ b/start_udev @@ -293,6 +293,9 @@ if [ -f "/sys/class/tty/console/uevent" ]; then if strstr "$cmdline" udevchilds; then /sbin/udevadm control --max-childs=$(getval udevchilds $cmdline) fi + if strstr "$cmdline" noiswmd; then + /sbin/udevadm control --env=rd_NO_MDIMSM=1 + fi /sbin/udevadm control --env=STARTUP=1 diff --git a/udev.spec b/udev.spec index 112df2f..45c7919 100644 --- a/udev.spec +++ b/udev.spec @@ -364,6 +364,8 @@ rm -rf $RPM_BUILD_ROOT %changelog - trigger with action==add +- add rd_NO_MDIMSM on noiswmd kernel cmdline option +Resolves: rhbz#589774 * Mon Aug 02 2010 Harald Hoyer 153-1 - version 153, because device-mapper needs IMPORT{db} From 90c26960fb0ba123fa556645ce27d28fcf39ac38 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 4 Aug 2010 15:02:15 +0200 Subject: [PATCH 18/24] fix console switching and ACLs --- udev.spec | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/udev.spec b/udev.spec index 45c7919..b58da0d 100644 --- a/udev.spec +++ b/udev.spec @@ -14,6 +14,8 @@ Obsoletes: udev-extras < 20090618 Provides: udev-extras = 20090618-1 Source: ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/%{name}-%{version}.tar.bz2 +Patch17: 0017-udev-acl-properly-handle-CK-change-events-for-root-u.patch +Patch18: 0018-udev-acl-really-fix-ACL-assignment-in-CK-events.patch Patch34: 0034-add-LGPL-COPYING-to-libudev-and-GUdev.patch Patch110: 0110-cdrom_id-only-mark-sr-0-9-as-ID_CDROM.patch @@ -122,7 +124,10 @@ glib-based applications using libudev functionality. %prep %setup -q +%patch17 -p1 -b .git17 +%patch18 -p1 -b .git18 %patch34 -p1 -b .git34 + %patch110 -p1 -b .git110 %patch101 -p1 @@ -366,6 +371,8 @@ rm -rf $RPM_BUILD_ROOT - trigger with action==add - add rd_NO_MDIMSM on noiswmd kernel cmdline option Resolves: rhbz#589774 +- fix console switching and ACLs +Resolves: rhbz#608712 * Mon Aug 02 2010 Harald Hoyer 153-1 - version 153, because device-mapper needs IMPORT{db} From 24924749eab13ec72ca99f49fe04f589ee800a9b Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 4 Aug 2010 15:42:31 +0200 Subject: [PATCH 19/24] * Wed Aug 04 2010 Harald Hoyer 153-1.0.test.1 - trigger with action==add - add rd_NO_MDIMSM on noiswmd kernel cmdline option Resolves: rhbz#589774 - fix console switching and ACLs Resolves: rhbz#608712 - fix key mapping for Samsung N210 Resolves: rhbz#606302 - fix for blank or audio CDs Resolves: rhbz#606285 - fix for scsi changer Resolves: rhbz#600983 --- ...y-handle-CK-change-events-for-root-u.patch | 52 ++++++++ ...ally-fix-ACL-assignment-in-CK-events.patch | 125 ++++++++++++++++++ udev-153-changer.patch | 25 ++++ ...1b2d11b9b89418589d885a625e647881933b.patch | 27 ++++ ...e7acdb741c8a67511c4c458efa93835e18a7.patch | 36 +++++ udev.spec | 15 ++- 6 files changed, 279 insertions(+), 1 deletion(-) create mode 100644 0017-udev-acl-properly-handle-CK-change-events-for-root-u.patch create mode 100644 0018-udev-acl-really-fix-ACL-assignment-in-CK-events.patch create mode 100644 udev-153-changer.patch create mode 100644 udev-git484e1b2d11b9b89418589d885a625e647881933b.patch create mode 100644 udev-giteb2de7acdb741c8a67511c4c458efa93835e18a7.patch diff --git a/0017-udev-acl-properly-handle-CK-change-events-for-root-u.patch b/0017-udev-acl-properly-handle-CK-change-events-for-root-u.patch new file mode 100644 index 0000000..fc32c06 --- /dev/null +++ b/0017-udev-acl-properly-handle-CK-change-events-for-root-u.patch @@ -0,0 +1,52 @@ +From 939cc18afc49ee8479572c14c7fa777646fd4add Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Tue, 3 Aug 2010 15:09:46 +0200 +Subject: [PATCH 17/18] udev-acl: properly handle CK change events for root user + +mschmidt@redhat.com writes: +> since root is treated specially, it does not do anything! +> udev-acl may want to prevent removing ACLs from root, but +> it must not stop the ACLs being granted to the user of the +> new session. + +https://bugzilla.redhat.com/show_bug.cgi?id=608712 +--- + extras/udev-acl/udev-acl.c | 7 +------ + 1 files changed, 1 insertions(+), 6 deletions(-) + +diff --git a/extras/udev-acl/udev-acl.c b/extras/udev-acl/udev-acl.c +index ff04ec6..f2b5005 100644 +--- a/extras/udev-acl/udev-acl.c ++++ b/extras/udev-acl/udev-acl.c +@@ -224,14 +224,10 @@ static int consolekit_called(const char *ck_action, uid_t *uid, uid_t *uid2, con + if (s == NULL) + return -1; + u = strtoul(s, NULL, 10); +- if (u == 0) +- return 0; + s = getenv("CK_SEAT_SESSION_USER_UID"); + if (s == NULL) + return -1; + u2 = strtoul(s, NULL, 10); +- if (u2 == 0) +- return 0; + + s = getenv("CK_SEAT_OLD_SESSION_IS_LOCAL"); + s2 = getenv("CK_SEAT_SESSION_IS_LOCAL"); +@@ -263,12 +259,11 @@ static int consolekit_called(const char *ck_action, uid_t *uid, uid_t *uid2, con + a = ACTION_ADD; + u = u2; + } +- + break; + case ACTION_NONE: + break; + default: +- g_assert_not_reached (); ++ g_assert_not_reached(); + break; + } + +-- +1.7.2 + diff --git a/0018-udev-acl-really-fix-ACL-assignment-in-CK-events.patch b/0018-udev-acl-really-fix-ACL-assignment-in-CK-events.patch new file mode 100644 index 0000000..9187554 --- /dev/null +++ b/0018-udev-acl-really-fix-ACL-assignment-in-CK-events.patch @@ -0,0 +1,125 @@ +From 9ac90ae153accdfcb56c24c5748690933ad219b2 Mon Sep 17 00:00:00 2001 +From: Michal Schmidt +Date: Wed, 4 Aug 2010 11:53:25 +0200 +Subject: [PATCH 18/18] udev-acl: really fix ACL assignment in CK events + +The previous fix for udev-acl was incomplete. The ACL were not properly +assigned to the new user when switching from root's session because of +the test for 'uid != 0'. + +Centralize the special handling of root to a single place (in set_facl). + +https://bugzilla.redhat.com/show_bug.cgi?id=608712 +--- + extras/udev-acl/udev-acl.c | 37 +++++++++++++++++++------------------ + 1 files changed, 19 insertions(+), 18 deletions(-) + +diff --git a/extras/udev-acl/udev-acl.c b/extras/udev-acl/udev-acl.c +index f2b5005..31e9991 100644 +--- a/extras/udev-acl/udev-acl.c ++++ b/extras/udev-acl/udev-acl.c +@@ -12,20 +12,18 @@ + * General Public License for more details: + */ + +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include ++#include ++#include + #include + #include +-#include + #include +-#include ++#include + #include ++#include ++#include ++#include ++#include ++#include + + static int debug; + +@@ -45,6 +43,10 @@ static int set_facl(const char* filename, uid_t uid, int add) + acl_permset_t permset; + int ret; + ++ /* don't touch ACLs for root */ ++ if (uid == 0) ++ return 0; ++ + /* read current record */ + acl = acl_get_file(filename, ACL_TYPE_ACCESS); + if (!acl) +@@ -190,8 +192,6 @@ static int consolekit_called(const char *ck_action, uid_t *uid, uid_t *uid2, con + if (s == NULL) + return -1; + u = strtoul(s, NULL, 10); +- if (u == 0) +- return 0; + + s = getenv("CK_SEAT_SESSION_IS_LOCAL"); + if (s == NULL) +@@ -205,8 +205,6 @@ static int consolekit_called(const char *ck_action, uid_t *uid, uid_t *uid2, con + if (s == NULL) + return -1; + u = strtoul(s, NULL, 10); +- if (u == 0) +- return 0; + + s = getenv("CK_SEAT_OLD_SESSION_IS_LOCAL"); + if (s == NULL) +@@ -331,6 +329,7 @@ int main (int argc, char* argv[]) + }; + int action = -1; + const char *device = NULL; ++ bool uid_given = false; + uid_t uid = 0; + uid_t uid2 = 0; + const char* remove_session_id = NULL; +@@ -357,6 +356,7 @@ int main (int argc, char* argv[]) + device = optarg; + break; + case 'u': ++ uid_given = true; + uid = strtoul(optarg, NULL, 10); + break; + case 'd': +@@ -369,8 +369,9 @@ int main (int argc, char* argv[]) + } + } + +- if (action < 0 && device == NULL && uid == 0) +- consolekit_called(argv[optind], &uid, &uid2, &remove_session_id, &action); ++ if (action < 0 && device == NULL && !uid_given) ++ if (!consolekit_called(argv[optind], &uid, &uid2, &remove_session_id, &action)) ++ uid_given = true; + + if (action < 0) { + fprintf(stderr, "missing action\n\n"); +@@ -378,13 +379,13 @@ int main (int argc, char* argv[]) + goto out; + } + +- if (device != NULL && uid != 0) { ++ if (device != NULL && uid_given) { + fprintf(stderr, "only one option, --device=DEVICEFILE or --user=UID expected\n\n"); + rc = 3; + goto out; + } + +- if (uid != 0) { ++ if (uid_given) { + switch (action) { + case ACTION_ADD: + /* Add ACL for given uid to all matching devices. */ +-- +1.7.2 + diff --git a/udev-153-changer.patch b/udev-153-changer.patch new file mode 100644 index 0000000..a80888c --- /dev/null +++ b/udev-153-changer.patch @@ -0,0 +1,25 @@ +diff -up udev-153/rules/redhat/40-redhat.rules.changer udev-153/rules/redhat/40-redhat.rules +--- udev-153/rules/redhat/40-redhat.rules.changer 2010-08-04 15:32:00.000000000 +0200 ++++ udev-153/rules/redhat/40-redhat.rules 2010-08-04 15:35:27.000000000 +0200 +@@ -5,17 +5,17 @@ KERNEL=="hd*[0-9]", ATTRS{media}=="flopp + + KERNEL=="fw*", PROGRAM="fw_unit_symlinks.sh %k %n", SYMLINK+="$result" + +-ACTION=="add", KERNEL=="sg[0-9]*", SUBSYSTEM=="scsi_device", ATTRS{type}=="3|6", SYMLINK+="scanner scanner-%k", MODE="0660" ++ACTION=="add", KERNEL=="sg[0-9]*", SUBSYSTEM=="scsi_generic", ATTRS{type}=="3|6", SYMLINK+="scanner scanner-%k", MODE="0660" + +-ACTION=="add", KERNEL=="sg[0-9]*", SUBSYSTEM=="scsi_device", ATTRS{type}=="8", SYMLINK+="changer changer-%k", MODE="0660", GROUP="disk" ++ACTION=="add", KERNEL=="sg[0-9]*", SUBSYSTEM=="scsi_generic", ATTRS{type}=="8", SYMLINK+="changer changer-%k", MODE="0660", GROUP="disk" + + SUBSYSTEM=="usb", KERNEL=="sd*", ATTRS{bInterfaceClass}=="08", ATTRS{bInterfaceSubClass}=="04", GROUP="floppy", MODE="0660", SYMLINK+="floppy floppy-%k" + + KERNEL=="fd[0-9]*", SYMLINK+="floppy floppy-%k" + +-ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="0|7|14", \ ++ACTION=="add", SUBSYSTEM=="scsi_generic", ATTRS{type}=="0|7|14", \ + RUN+="/sbin/modprobe sd_mod" +-ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="[45]", \ ++ACTION=="add", SUBSYSTEM=="scsi_generic", ATTRS{type}=="[45]", \ + RUN+="/sbin/modprobe sr_mod" + + KERNEL=="vcs", OWNER="vcsa", GROUP="tty" diff --git a/udev-git484e1b2d11b9b89418589d885a625e647881933b.patch b/udev-git484e1b2d11b9b89418589d885a625e647881933b.patch new file mode 100644 index 0000000..38dfb40 --- /dev/null +++ b/udev-git484e1b2d11b9b89418589d885a625e647881933b.patch @@ -0,0 +1,27 @@ +commit 484e1b2d11b9b89418589d885a625e647881933b +Author: Kay Sievers +Date: Tue May 25 09:54:14 2010 +0200 + + rules: optical drives - use ID_CDROM_MEDIA_TRACK_COUNT_DATA + + We should not access non-data optical media, ans skip things + like blkid. It will cause errors for some drives. + + https://bugzilla.kernel.org/show_bug.cgi?id=15757 + +diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules +index d9f8003..1f46041 100644 +--- a/rules/rules.d/60-persistent-storage.rules ++++ b/rules/rules.d/60-persistent-storage.rules +@@ -52,9 +52,9 @@ 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}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" ++KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" + # single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET +-KERNEL=="sr*", ENV{ID_CDROM_MEDIA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode" ++KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode" + + # probe filesystem metadata of disks + KERNEL!="sr*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode" diff --git a/udev-giteb2de7acdb741c8a67511c4c458efa93835e18a7.patch b/udev-giteb2de7acdb741c8a67511c4c458efa93835e18a7.patch new file mode 100644 index 0000000..0c3cbb3 --- /dev/null +++ b/udev-giteb2de7acdb741c8a67511c4c458efa93835e18a7.patch @@ -0,0 +1,36 @@ +commit eb2de7acdb741c8a67511c4c458efa93835e18a7 +Author: Harald Hoyer +Date: Mon Jun 21 14:04:43 2010 +0200 + + extras/keymap: add Samsung N210 to keymap rules + + https://bugzilla.redhat.com/show_bug.cgi?id=606302 + + Thanks to John Floyd! + +diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules +index 7c334ce..36d569a 100644 +--- a/extras/keymap/95-keyboard-force-release.rules ++++ b/extras/keymap/95-keyboard-force-release.rules +@@ -19,7 +19,7 @@ DRIVER!="atkbd", GOTO="force_release_end" + ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" + + +-ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N128*|*N130*|*N140*|*SR70S/SR71S*|*Q210/P210*", RUN+="keyboard-force-release.sh $devpath samsung-other" ++ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N128*|*N130*|*N140*|*N210*|*SR70S/SR71S*|*Q210/P210*", RUN+="keyboard-force-release.sh $devpath samsung-other" + + ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules +index 8ed2b59..26666a9 100644 +--- a/extras/keymap/95-keymap.rules ++++ b/extras/keymap/95-keymap.rules +@@ -110,7 +110,7 @@ ENV{DMI_VENDOR}=="INVENTEC", ATTR{[dmi/id]product_name}=="SYMPHONY 6.0/7.0", RUN + + ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keymap $name maxdata-pro_7000" + +-ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*NC20*|*N128*|*N130*|*SP55S*|*SQ45S70S*|*SX60P*|*SX22S*|*SX30S*|*R59P/R60P/R61P*|*SR70S/SR71S*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" ++ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*NC20*|*N128*|*N130*|*N210*|*SP55S*|*SQ45S70S*|*SX60P*|*SX22S*|*SX30S*|*R59P/R60P/R61P*|*SR70S/SR71S*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" + ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s" + ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us" + diff --git a/udev.spec b/udev.spec index b58da0d..073386c 100644 --- a/udev.spec +++ b/udev.spec @@ -5,7 +5,7 @@ Summary: A userspace implementation of devfs Name: udev Version: 153 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2 Group: System Environment/Base Provides: udev-persistent = %{version}-%{release} @@ -20,7 +20,10 @@ Patch34: 0034-add-LGPL-COPYING-to-libudev-and-GUdev.patch Patch110: 0110-cdrom_id-only-mark-sr-0-9-as-ID_CDROM.patch Patch101: udev-151-rules.patch +Patch102: udev-giteb2de7acdb741c8a67511c4c458efa93835e18a7.patch Patch103: udev-151-gperf.patch +Patch104: udev-git484e1b2d11b9b89418589d885a625e647881933b.patch +Patch105: udev-153-changer.patch Source1: start_udev Source3: udev-post.init @@ -131,7 +134,10 @@ glib-based applications using libudev functionality. %patch110 -p1 -b .git110 %patch101 -p1 +%patch102 -p1 %patch103 -p1 +%patch104 -p1 +%patch105 -p1 %build autoreconf -i @@ -368,11 +374,18 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_libdir}/pkgconfig/gudev-1.0* %changelog +* Wed Aug 04 2010 Harald Hoyer 153-1.0.test.1 - trigger with action==add - add rd_NO_MDIMSM on noiswmd kernel cmdline option Resolves: rhbz#589774 - fix console switching and ACLs Resolves: rhbz#608712 +- fix key mapping for Samsung N210 +Resolves: rhbz#606302 +- fix for blank or audio CDs +Resolves: rhbz#606285 +- fix for scsi changer +Resolves: rhbz#600983 * Mon Aug 02 2010 Harald Hoyer 153-1 - version 153, because device-mapper needs IMPORT{db} From 43b3a39d3cb1cfa441197ddd8f2298c48feadb35 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 4 Aug 2010 15:59:39 +0200 Subject: [PATCH 20/24] * Wed Aug 04 2010 Harald Hoyer 153-1.0.test.1 - trigger with action==add - add rd_NO_MDIMSM on noiswmd kernel cmdline option Resolves: rhbz#589774 - fix console switching and ACLs Resolves: rhbz#608712 - fix key mapping for Samsung N210 Resolves: rhbz#606302 - fix for blank or audio CDs Resolves: rhbz#606285 - fix for scsi changer Resolves: rhbz#600983 --- udev-153-n210.patch | 24 +++++++++++++ ...e7acdb741c8a67511c4c458efa93835e18a7.patch | 36 ------------------- udev.spec | 2 +- 3 files changed, 25 insertions(+), 37 deletions(-) create mode 100644 udev-153-n210.patch delete mode 100644 udev-giteb2de7acdb741c8a67511c4c458efa93835e18a7.patch diff --git a/udev-153-n210.patch b/udev-153-n210.patch new file mode 100644 index 0000000..f7f3652 --- /dev/null +++ b/udev-153-n210.patch @@ -0,0 +1,24 @@ +diff -up udev-153/extras/keymap/95-keyboard-force-release.rules.n210 udev-153/extras/keymap/95-keyboard-force-release.rules +--- udev-153/extras/keymap/95-keyboard-force-release.rules.n210 2010-08-04 15:55:56.000000000 +0200 ++++ udev-153/extras/keymap/95-keyboard-force-release.rules 2010-08-04 15:57:54.000000000 +0200 +@@ -19,7 +19,7 @@ DRIVER!="atkbd", GOTO="force_release_end + ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" + + +-ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N130*|*N140*|*SR70S/SR71S*|*Q210/P210*", RUN+="keyboard-force-release.sh $devpath samsung-other" ++ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N128*|*N130*|*N140*|*N210*|*SR70S/SR71S*|*Q210/P210*", RUN+="keyboard-force-release.sh $devpath samsung-other" + + ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +diff -up udev-153/extras/keymap/95-keymap.rules.n210 udev-153/extras/keymap/95-keymap.rules +--- udev-153/extras/keymap/95-keymap.rules.n210 2010-08-04 15:57:23.000000000 +0200 ++++ udev-153/extras/keymap/95-keymap.rules 2010-08-04 15:57:52.000000000 +0200 +@@ -110,7 +110,7 @@ ENV{DMI_VENDOR}=="INVENTEC", ATTR{[dmi/i + + ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keymap $name maxdata-pro_7000" + +-ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*NC20*|*N130*|*SP55S*|*SQ45S70S*|*SX60P*|*SX22S*|*SX30S*|*R59P/R60P/R61P*|*SR70S/SR71S*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" ++ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*NC20*|*N128*|*N130*|*N210*|*SP55S*|*SQ45S70S*|*SX60P*|*SX22S*|*SX30S*|*R59P/R60P/R61P*|*SR70S/SR71S*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" + ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s" + ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us" + diff --git a/udev-giteb2de7acdb741c8a67511c4c458efa93835e18a7.patch b/udev-giteb2de7acdb741c8a67511c4c458efa93835e18a7.patch deleted file mode 100644 index 0c3cbb3..0000000 --- a/udev-giteb2de7acdb741c8a67511c4c458efa93835e18a7.patch +++ /dev/null @@ -1,36 +0,0 @@ -commit eb2de7acdb741c8a67511c4c458efa93835e18a7 -Author: Harald Hoyer -Date: Mon Jun 21 14:04:43 2010 +0200 - - extras/keymap: add Samsung N210 to keymap rules - - https://bugzilla.redhat.com/show_bug.cgi?id=606302 - - Thanks to John Floyd! - -diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules -index 7c334ce..36d569a 100644 ---- a/extras/keymap/95-keyboard-force-release.rules -+++ b/extras/keymap/95-keyboard-force-release.rules -@@ -19,7 +19,7 @@ DRIVER!="atkbd", GOTO="force_release_end" - ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" - - --ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N128*|*N130*|*N140*|*SR70S/SR71S*|*Q210/P210*", RUN+="keyboard-force-release.sh $devpath samsung-other" -+ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N128*|*N130*|*N140*|*N210*|*SR70S/SR71S*|*Q210/P210*", RUN+="keyboard-force-release.sh $devpath samsung-other" - - ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules -index 8ed2b59..26666a9 100644 ---- a/extras/keymap/95-keymap.rules -+++ b/extras/keymap/95-keymap.rules -@@ -110,7 +110,7 @@ ENV{DMI_VENDOR}=="INVENTEC", ATTR{[dmi/id]product_name}=="SYMPHONY 6.0/7.0", RUN - - ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keymap $name maxdata-pro_7000" - --ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*NC20*|*N128*|*N130*|*SP55S*|*SQ45S70S*|*SX60P*|*SX22S*|*SX30S*|*R59P/R60P/R61P*|*SR70S/SR71S*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" -+ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*NC20*|*N128*|*N130*|*N210*|*SP55S*|*SQ45S70S*|*SX60P*|*SX22S*|*SX30S*|*R59P/R60P/R61P*|*SR70S/SR71S*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" - ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s" - ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us" - diff --git a/udev.spec b/udev.spec index 073386c..23ca1ce 100644 --- a/udev.spec +++ b/udev.spec @@ -20,7 +20,7 @@ Patch34: 0034-add-LGPL-COPYING-to-libudev-and-GUdev.patch Patch110: 0110-cdrom_id-only-mark-sr-0-9-as-ID_CDROM.patch Patch101: udev-151-rules.patch -Patch102: udev-giteb2de7acdb741c8a67511c4c458efa93835e18a7.patch +Patch102: udev-153-n210.patch Patch103: udev-151-gperf.patch Patch104: udev-git484e1b2d11b9b89418589d885a625e647881933b.patch Patch105: udev-153-changer.patch From b5e470b9567d023f988dc06e45a6982790ff7b0c Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Fri, 13 Aug 2010 10:30:02 +0200 Subject: [PATCH 21/24] * Fri Aug 13 2010 Harald Hoyer 153-3 - revert the default trigger to "add" --- udev-153-trigger.patch | 22 ++++++++++++++++++++++ udev-post.init | 2 +- udev.spec | 9 +++++++-- 3 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 udev-153-trigger.patch diff --git a/udev-153-trigger.patch b/udev-153-trigger.patch new file mode 100644 index 0000000..2bce982 --- /dev/null +++ b/udev-153-trigger.patch @@ -0,0 +1,22 @@ +diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c +index 03aa534..dbcaee3 100644 +--- a/udev/udevadm-trigger.c ++++ b/udev/udevadm-trigger.c +@@ -110,7 +110,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) + TYPE_SUBSYSTEMS, + TYPE_FAILED, + } device_type = TYPE_DEVICES; +- const char *action = "change"; ++ const char *action = "add"; + struct udev_enumerate *udev_enumerate; + int rc = 0; + +@@ -184,7 +184,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) + " subsystems sys subsystems and drivers\n" + " failed trigger only the events which have been\n" + " marked as failed during a previous run\n" +- " --action= event action value, default is \"change\"\n" ++ " --action= event action value, default is \"add\"\n" + " --subsystem-match= trigger devices from a matching subsystem\n" + " --subsystem-nomatch= exclude devices from a matching subsystem\n" + " --attr-match=]> trigger devices with a matching attribute\n" diff --git a/udev-post.init b/udev-post.init index 67ed0c9..89df663 100644 --- a/udev-post.init +++ b/udev-post.init @@ -26,7 +26,7 @@ case "$1" in [ -w /var/lock/subsys ] || exit 4 STRING=$"Retrigger failed udev events" echo -n $STRING - /sbin/udevadm trigger --type=failed + /sbin/udevadm trigger --type=failed --action=add success "$STRING" echo diff --git a/udev.spec b/udev.spec index 23ca1ce..a5a4030 100644 --- a/udev.spec +++ b/udev.spec @@ -5,7 +5,7 @@ Summary: A userspace implementation of devfs Name: udev Version: 153 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2 Group: System Environment/Base Provides: udev-persistent = %{version}-%{release} @@ -24,6 +24,7 @@ Patch102: udev-153-n210.patch Patch103: udev-151-gperf.patch Patch104: udev-git484e1b2d11b9b89418589d885a625e647881933b.patch Patch105: udev-153-changer.patch +Patch106: udev-153-trigger.patch Source1: start_udev Source3: udev-post.init @@ -138,6 +139,7 @@ glib-based applications using libudev functionality. %patch103 -p1 %patch104 -p1 %patch105 -p1 +%patch106 -p1 %build autoreconf -i @@ -374,7 +376,10 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_libdir}/pkgconfig/gudev-1.0* %changelog -* Wed Aug 04 2010 Harald Hoyer 153-1.0.test.1 +* Fri Aug 13 2010 Harald Hoyer 153-3 +- revert the default trigger to "add" + +* Wed Aug 04 2010 Harald Hoyer 153-2 - trigger with action==add - add rd_NO_MDIMSM on noiswmd kernel cmdline option Resolves: rhbz#589774 From 92e3355c96bacf9c43ba89d2f37c5a7a51e6d6bd Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 22 Sep 2010 13:58:14 +0200 Subject: [PATCH 22/24] - fixed SELinux contexts on "add" events - backported keymaps - backported cdrom_id --- udev-145.tar.bz2.sign | 8 -------- udev.spec | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 10 deletions(-) delete mode 100644 udev-145.tar.bz2.sign diff --git a/udev-145.tar.bz2.sign b/udev-145.tar.bz2.sign deleted file mode 100644 index 23c18c4..0000000 --- a/udev-145.tar.bz2.sign +++ /dev/null @@ -1,8 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.9 (GNU/Linux) -Comment: See http://www.kernel.org/signature.html for info - -iD8DBQBKWxhnyGugalF9Dw4RAvvjAJ9ed+RMRi8gXcFyTPxXsHZpbLSROgCfdpCc -lr5nSwsGGO9e0+wBbD7WDoc= -=5/z0 ------END PGP SIGNATURE----- diff --git a/udev.spec b/udev.spec index a5a4030..09e39b1 100644 --- a/udev.spec +++ b/udev.spec @@ -5,7 +5,7 @@ Summary: A userspace implementation of devfs Name: udev Version: 153 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2 Group: System Environment/Base Provides: udev-persistent = %{version}-%{release} @@ -18,13 +18,15 @@ Patch17: 0017-udev-acl-properly-handle-CK-change-events-for-root-u.patch Patch18: 0018-udev-acl-really-fix-ACL-assignment-in-CK-events.patch Patch34: 0034-add-LGPL-COPYING-to-libudev-and-GUdev.patch Patch110: 0110-cdrom_id-only-mark-sr-0-9-as-ID_CDROM.patch - Patch101: udev-151-rules.patch Patch102: udev-153-n210.patch Patch103: udev-151-gperf.patch Patch104: udev-git484e1b2d11b9b89418589d885a625e647881933b.patch Patch105: udev-153-changer.patch Patch106: udev-153-trigger.patch +Patch200: 0001-set-SELinux-context-on-add-but-not-on-change-events.patch +Patch300: udev-153-keymap-backport.patch +Patch301: udev-153-cdrom_id-backport.patch Source1: start_udev Source3: udev-post.init @@ -141,6 +143,10 @@ glib-based applications using libudev functionality. %patch105 -p1 %patch106 -p1 +%patch200 -p1 +%patch300 -p1 +%patch301 -p1 + %build autoreconf -i automake @@ -376,6 +382,11 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_libdir}/pkgconfig/gudev-1.0* %changelog +* Wed Sep 22 2010 Harald Hoyer 153-4 +- fixed SELinux contexts on "add" events +- backported keymaps +- backported cdrom_id + * Fri Aug 13 2010 Harald Hoyer 153-3 - revert the default trigger to "add" From 43b305ff9c9a87fb0b97da0e31d2022c0617c6d9 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 22 Sep 2010 14:02:53 +0200 Subject: [PATCH 23/24] - fixed SELinux contexts on "add" events - backported keymaps - backported cdrom_id --- ...text-on-add-but-not-on-change-events.patch | 35 +++ udev-153-cdrom_id-backport.patch | 246 ++++++++++++++++++ udev-153-keymap-backport.patch | 194 ++++++++++++++ 3 files changed, 475 insertions(+) create mode 100644 0001-set-SELinux-context-on-add-but-not-on-change-events.patch create mode 100644 udev-153-cdrom_id-backport.patch create mode 100644 udev-153-keymap-backport.patch diff --git a/0001-set-SELinux-context-on-add-but-not-on-change-events.patch b/0001-set-SELinux-context-on-add-but-not-on-change-events.patch new file mode 100644 index 0000000..7ed88b4 --- /dev/null +++ b/0001-set-SELinux-context-on-add-but-not-on-change-events.patch @@ -0,0 +1,35 @@ +From 326c5fc3ea684825629eccaf33a548759162a539 Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Tue, 31 Aug 2010 21:29:21 +0200 +Subject: [PATCH] set SELinux context on 'add' but not on 'change' events + +--- + udev/udev-node.c | 9 ++++++++- + 1 files changed, 8 insertions(+), 1 deletions(-) + +diff --git a/udev/udev-node.c b/udev/udev-node.c +index 228b3eb..c8113f1 100644 +--- a/udev/udev-node.c ++++ b/udev/udev-node.c +@@ -56,10 +56,17 @@ int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_ + info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); + chmod(file, mode); + chown(file, uid, gid); +- udev_selinux_lsetfilecon(udev, file, mode); + } else { + info(udev, "preserve permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); + } ++ /* ++ * Set initial selinux file context only on add events. ++ * We set the proper context on bootup (triger) or for newly ++ * added devices, but we don't change it later, in case ++ * something else has set a custom context in the meantime. ++ */ ++ if (strcmp(udev_device_get_action(dev), "add") == 0) ++ udev_selinux_lsetfilecon(udev, file, mode); + /* always update timestamp when we re-use the node, like on media change events */ + utimensat(AT_FDCWD, file, NULL, 0); + } else { +-- +1.7.2.3 + diff --git a/udev-153-cdrom_id-backport.patch b/udev-153-cdrom_id-backport.patch new file mode 100644 index 0000000..46e0a5b --- /dev/null +++ b/udev-153-cdrom_id-backport.patch @@ -0,0 +1,246 @@ +diff -ur udev-153-orig/extras/cdrom_id/cdrom_id.c udev-153/extras/cdrom_id/cdrom_id.c +--- udev-153-orig/extras/cdrom_id/cdrom_id.c 2010-04-17 19:29:58.000000000 +0200 ++++ udev-153/extras/cdrom_id/cdrom_id.c 2010-08-31 10:35:41.000000000 +0200 +@@ -85,6 +85,8 @@ + static unsigned int cd_media_dvd_rom = 0; + static unsigned int cd_media_dvd_r = 0; + static unsigned int cd_media_dvd_rw = 0; ++static unsigned int cd_media_dvd_rw_ro = 0; /* restricted overwrite mode */ ++static unsigned int cd_media_dvd_rw_seq = 0; /* sequential mode */ + static unsigned int cd_media_dvd_ram = 0; + static unsigned int cd_media_dvd_plus_r = 0; + static unsigned int cd_media_dvd_plus_rw = 0; +@@ -348,6 +350,39 @@ + return 0; + } + ++static int cd_profiles_old_mmc(struct udev *udev, int fd) ++{ ++ struct scsi_cmd sc; ++ int err; ++ ++ unsigned char header[32]; ++ ++ scsi_cmd_init(udev, &sc, header, sizeof(header)); ++ scsi_cmd_set(udev, &sc, 0, 0x51); ++ scsi_cmd_set(udev, &sc, 8, sizeof(header)); ++ scsi_cmd_set(udev, &sc, 9, 0); ++ err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); ++ if ((err != 0)) { ++ info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); ++ info(udev, "no current profile, assuming no media\n"); ++ return -1; ++ }; ++ ++ cd_media = 1; ++ ++ if (header[2] & 16) { ++ cd_media_cd_rw = 1; ++ info(udev, "profile 0x0a media_cd_rw\n"); ++ } else if ((header[2] & 3) < 2 && cd_cd_r) { ++ cd_media_cd_r = 1; ++ info(udev, "profile 0x09 media_cd_r\n"); ++ } else { ++ cd_media_cd_rom = 1; ++ info(udev, "profile 0x08 media_cd_rom\n"); ++ } ++ return 0; ++} ++ + static int cd_profiles(struct udev *udev, int fd) + { + struct scsi_cmd sc; +@@ -365,6 +400,12 @@ + err = scsi_cmd_run(udev, &sc, fd, features, sizeof(features)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "GET CONFIGURATION", err); ++ /* handle pre-MMC2 drives which do not support GET CONFIGURATION */ ++ 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); ++ } + return -1; + } + +@@ -440,10 +481,16 @@ + 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\n", cur_profile); ++ 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); +@@ -527,12 +574,126 @@ + + cd_media = 1; + info(udev, "disk type %02x\n", header[8]); ++ info(udev, "hardware reported media status: %s\n", media_status[header[2] & 3]); + + /* exclude plain CDROM, some fake cdroms return 0 for "blank" media here */ + if (!cd_media_cd_rom) + cd_media_state = media_status[header[2] & 3]; + +- if ((header[2] & 3) != 2) ++ /* 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 */ ++ if (cd_media_dvd_rw_ro && (header[2] & 3) == 1) ++ cd_media_state = media_status[0]; ++ ++ /* DVD+RW discs (and DVD-RW in restricted mode) once formatted are ++ * always "complete", DVD-RAM are "other" or "complete" if the disc is ++ * write protected; we need to check the contents if it is blank */ ++ if ((cd_media_dvd_rw_ro || cd_media_dvd_plus_rw || cd_media_dvd_plus_rw_dl || cd_media_dvd_ram) && (header[2] & 3) > 1) { ++ unsigned char buffer[32 * 2048]; ++ unsigned char result, len; ++ int block, offset; ++ ++ if (cd_media_dvd_ram) { ++ /* a write protected dvd-ram may report "complete" status */ ++ ++ unsigned char dvdstruct[8]; ++ unsigned char format[12]; ++ ++ scsi_cmd_init(udev, &sc, dvdstruct, sizeof(dvdstruct)); ++ scsi_cmd_set(udev, &sc, 0, 0xAD); ++ scsi_cmd_set(udev, &sc, 7, 0xC0); ++ scsi_cmd_set(udev, &sc, 9, sizeof(dvdstruct)); ++ scsi_cmd_set(udev, &sc, 11, 0); ++ err = scsi_cmd_run(udev, &sc, fd, dvdstruct, sizeof(dvdstruct)); ++ if ((err != 0)) { ++ info_scsi_cmd_err(udev, "READ DVD STRUCTURE", err); ++ return -1; ++ } ++ if (dvdstruct[4] & 0x02) { ++ cd_media_state = media_status[2]; ++ info(udev, "write-protected DVD-RAM media inserted\n"); ++ goto determined; ++ } ++ ++ /* let's make sure we don't try to read unformatted media */ ++ scsi_cmd_init(udev, &sc, format, sizeof(format)); ++ scsi_cmd_set(udev, &sc, 0, 0x23); ++ scsi_cmd_set(udev, &sc, 8, sizeof(format)); ++ scsi_cmd_set(udev, &sc, 9, 0); ++ err = scsi_cmd_run(udev, &sc, fd, format, sizeof(format)); ++ if ((err != 0)) { ++ info_scsi_cmd_err(udev, "READ DVD FORMAT CAPACITIES", err); ++ return -1; ++ } ++ ++ len = format[3]; ++ if (len & 7 || len < 16) { ++ info(udev, "invalid format capacities length\n"); ++ return -1; ++ } ++ ++ switch(format[8] & 3) { ++ case 1: ++ info(udev, "unformatted DVD-RAM media inserted\n"); ++ /* This means that last format was interrupted ++ * or failed, blank dvd-ram discs are factory ++ * formatted. Take no action here as it takes ++ * quite a while to reformat a dvd-ram and it's ++ * not automatically started */ ++ goto determined; ++ ++ case 2: ++ info(udev, "formatted DVD-RAM media inserted\n"); ++ break; ++ ++ case 3: ++ cd_media = 0; //return no media ++ info(udev, "format capacities returned no media\n"); ++ return -1; ++ } ++ } ++ ++ /* Take a closer look at formatted media (unformatted DVD+RW ++ * has "blank" status", DVD-RAM was examined earlier) and check ++ * for ISO and UDF PVDs or a fs superblock presence and do it ++ * in one ioctl (we need just sectors 0 and 16) */ ++ scsi_cmd_init(udev, &sc, buffer, sizeof(buffer)); ++ scsi_cmd_set(udev, &sc, 0, 0x28); ++ scsi_cmd_set(udev, &sc, 5, 0); ++ scsi_cmd_set(udev, &sc, 8, 32); ++ scsi_cmd_set(udev, &sc, 9, 0); ++ err = scsi_cmd_run(udev, &sc, fd, buffer, sizeof(buffer)); ++ if ((err != 0)) { ++ info_scsi_cmd_err(udev, "READ FIRST 32 BLOCKS", err); ++ return -1; ++ } ++ ++ /* if any non-zero data is found in sector 16 (iso and udf) or ++ * eventually 0 (fat32 boot sector, ext2 superblock, etc), disc ++ * is assumed non-blank */ ++ result = 0; ++ ++ for (block = 32768; block >= 0 && !result; block -= 32768) { ++ offset = block; ++ while (offset < (block + 2048) && !result) { ++ result = buffer [offset]; ++ offset++; ++ } ++ } ++ ++ if (!result) { ++ cd_media_state = media_status[0]; ++ info(udev, "no data in blocks 0 or 16, assuming blank\n"); ++ } else { ++ info(udev, "data in blocks 0 or 16, assuming complete\n"); ++ } ++ } ++ ++determined: ++ /* "other" is e. g. DVD-RAM, can't append sessions there; DVDs in ++ * restricted overwrite mode can never append, only in sequential mode */ ++ if ((header[2] & 3) < 2 && !cd_media_dvd_rw_ro) + cd_media_session_next = header[10] << 8 | header[5]; + cd_media_session_count = header[9] << 8 | header[4]; + cd_media_track_count = header[11] << 8 | header[6]; +@@ -710,13 +871,11 @@ + if (cd_profiles(udev, fd) < 0) + goto print; + +- /* get writable media state */ +- if (cd_media_info(udev, fd) < 0) +- goto print; +- + /* get session/track info */ +- if (cd_media_toc(udev, fd) < 0) +- goto print; ++ cd_media_toc(udev, fd); ++ ++ /* get writable media state */ ++ cd_media_info(udev, fd); + + print: + printf("ID_CDROM=1\n"); +@@ -810,14 +969,14 @@ + printf("ID_CDROM_MEDIA_SESSION_NEXT=%d\n", cd_media_session_next); + if (cd_media_session_count > 0) + printf("ID_CDROM_MEDIA_SESSION_COUNT=%d\n", cd_media_session_count); ++ if (cd_media_session_count > 1 && cd_media_session_last_offset > 0) ++ printf("ID_CDROM_MEDIA_SESSION_LAST_OFFSET=%llu\n", cd_media_session_last_offset); + if (cd_media_track_count > 0) + printf("ID_CDROM_MEDIA_TRACK_COUNT=%d\n", cd_media_track_count); + if (cd_media_track_count_audio > 0) + printf("ID_CDROM_MEDIA_TRACK_COUNT_AUDIO=%d\n", cd_media_track_count_audio); + if (cd_media_track_count_data > 0) + printf("ID_CDROM_MEDIA_TRACK_COUNT_DATA=%d\n", cd_media_track_count_data); +- if (cd_media_session_last_offset > 0) +- printf("ID_CDROM_MEDIA_SESSION_LAST_OFFSET=%llu\n", cd_media_session_last_offset); + exit: + if (fd >= 0) + close(fd); diff --git a/udev-153-keymap-backport.patch b/udev-153-keymap-backport.patch new file mode 100644 index 0000000..4f97c2f --- /dev/null +++ b/udev-153-keymap-backport.patch @@ -0,0 +1,194 @@ +diff -urN udev-153-orig/extras/keymap/95-keyboard-force-release.rules udev-153/extras/keymap/95-keyboard-force-release.rules +--- udev-153-orig/extras/keymap/95-keyboard-force-release.rules 2010-09-21 13:52:31.000000000 +0200 ++++ udev-153/extras/keymap/95-keyboard-force-release.rules 2010-08-04 14:23:27.000000000 +0200 +@@ -19,7 +19,7 @@ + ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" + + +-ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N128*|*N130*|*N140*|*N210*|*SR70S/SR71S*|*Q210/P210*", RUN+="keyboard-force-release.sh $devpath samsung-other" ++ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*E252*|*N120*|*N128*|*N130*|*N140*|*N148/N208*|*N150*|*N150/N210/N220*|*N220*|*N308*|*N310*|*N510*|*NB30*|*NC10/N110*|*ND10*|*Q210/P210*|*R410P*|*R425/R525*|*R428/P428*|*R460*|*R463*|*R468/R418*|*R480/R431/R481*|*R509*|*R518*|*R519/R719*|*R520/R522/R620*|*R528/R728*|*R530/R730*|*R530/R730/P590*|*R560*|*R580*|*R580/R590*|*R59/R60/R61*|*R59P/R60P/R61P*|*R710*|*R720*|*R780/R778*|*SR58P*|*SR700*|*SR70S/SR71S*|*SX22S*|*X118*|*X120*|*X460*", RUN+="keyboard-force-release.sh $devpath samsung-other" + + ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +@@ -29,4 +29,10 @@ + + ENV{DMI_VENDOR}=="MTC", ATTR{[dmi/id]product_version}=="A0", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + ++ENV{DMI_VENDOR}=="PEGATRON CORP.", ATTR{[dmi/id]product_name}=="Spring Peak", RUN+="keyboard-force-release.sh $devpath common-volume-keys" ++ ++ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite U300|Satellite Pro U300|Satellite U305", RUN+="keyboard-force-release.sh $devpath common-volume-keys" ++ ++ENV{DMI_VENDOR}=="Viooo Corporation", ATTR{[dmi/id]product_name}=="PT17", RUN+="keyboard-force-release.sh $devpath common-volume-keys" ++ + LABEL="force_release_end" +diff -urN udev-153-orig/extras/keymap/95-keymap.rules udev-153/extras/keymap/95-keymap.rules +--- udev-153-orig/extras/keymap/95-keymap.rules 2010-09-21 13:52:31.000000000 +0200 ++++ udev-153/extras/keymap/95-keymap.rules 2010-09-21 12:02:18.000000000 +0200 +@@ -21,7 +21,11 @@ + + ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Multimedia Keyboard", RUN+="keymap $name logitech-wave" + ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-cordless" ++# Logitech Cordless Wave Pro looks slightly weird; some hotkeys are coming through the mouse interface ++ENV{ID_VENDOR_ID}=="046d", ENV{ID_MODEL_ID}=="c529", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-pro-cordless" ++ + ENV{ID_VENDOR}=="Lite-On_Technology_Corp*", ATTRS{name}=="Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint", RUN+="keymap $name lenovo-thinkpad-usb-keyboard-trackpoint" ++ENV{ID_VENDOR_ID}=="04b3", ENV{ID_MODEL_ID}=="301[89]", RUN+="keymap $name ibm-thinkpad-usb-keyboard-trackpoint" + + GOTO="keyboard_end" + +@@ -37,11 +41,12 @@ + + ENV{DMI_VENDOR}=="IBM*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name module-ibm" + ENV{DMI_VENDOR}=="LENOVO*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name module-lenovo" ++ENV{DMI_VENDOR}=="LENOVO*", KERNELS=="input*", ATTRS{name}=="Lenovo ThinkPad SL Series extra buttons", RUN+="keymap $name 0x0E bluetooth" + ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Asus Extra Buttons", ATTR{[dmi/id]product_name}=="W3J", RUN+="keymap $name module-asus-w3j" + ENV{DMI_VENDOR}=="Sony*", KERNELS=="input*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony" + + # Older Vaios have some different keys +-ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="*PCG-C1*|*PCG-K25*|*PCG-F1*|*PCG-F2*|*PCG-F3*|*PCG-F4*|*PCG-F5*|*PCG-F6*|*PCG-FX*|*PCG-FRV*|*PCG-GR*|*PCG-TR*|*PCG-NV*|*PCG-Z*|*VGN-S360*|*VGN-SZ2HP_B*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-old" ++ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="*PCG-C1*|*PCG-K25*|*PCG-F1*|*PCG-F2*|*PCG-F3*|*PCG-F4*|*PCG-F5*|*PCG-F6*|*PCG-FX*|*PCG-FRV*|*PCG-GR*|*PCG-TR*|*PCG-NV*|*PCG-Z*|*VGN-S360*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-old" + + # + # The following rules belong to standard i8042 AT keyboard with high key codes. +@@ -53,19 +58,22 @@ + LABEL="keyboard_vendorcheck" + + ENV{DMI_VENDOR}=="Dell*", RUN+="keymap $name dell" +-ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Inspiron 1011", RUN+="keymap $name 0x84 wlan" ++ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Inspiron 910|Inspiron 1010|Inspiron 1011|Inspiron 1012|Inspiron 1110|Inspiron 1210", RUN+="keymap $name 0x84 wlan" + + ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N*", RUN+="keymap $name compaq-e_evo" + + ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*3000*", RUN+="keymap $name lenovo-3000" + ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X6*", ATTR{[dmi/id]product_version}=="* Tablet" RUN+="keymap $name lenovo-thinkpad_x6_tablet" + ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X200 Tablet*", ATTR{[dmi/id]product_version}=="* Tablet" RUN+="keymap $name lenovo-thinkpad_x200_tablet" ++ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*IdeaPad*", RUN+="keymap $name lenovo-ideapad" ++ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_name}=="S10-*", RUN+="keymap $name lenovo-ideapad" ++ENV{DMI_VENDOR}=="LENOVO", ATTR{[dmi/id]product_version}=="*IdeaPad Y550*", RUN+="keymap $name 0x95 media 0xA3 play" + + ENV{DMI_VENDOR}=="Hewlett-Packard*", RUN+="keymap $name hewlett-packard" + ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][aA][bB][lL][eE][tT]*", RUN+="keymap $name hewlett-packard-tablet" + ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[pP][aA][vV][iI][lL][iI][oO][nN]*", RUN+="keymap $name hewlett-packard-pavilion" + ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*Compaq*|*EliteBook*|*2230s*", RUN+="keymap $name hewlett-packard-compaq_elitebook" +-ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*", RUN+="keymap $name hewlett-packard-2510p_2530p" ++ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*|HP G60 Notebook PC", RUN+="keymap $name hewlett-packard-2510p_2530p" + ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keymap $name hewlett-packard-tx2" + ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="Presario 2100*", RUN+="keymap $name hewlett-packard-presario-2100" + # HP Pavillion dv6315ea has empty DMI_VENDOR +@@ -77,7 +85,8 @@ + ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" + ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" + ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C300*", RUN+="keymap $name acer-travelmate_c300" +-ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|TravelMate*8471*|Aspire 1810T*|AO751h|AO531h", RUN+="keymap $name 0xD9 bluetooth" ++ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|TravelMate*8471*|TravelMate*4720*|Aspire 1810T*|AO751h|AO531h", RUN+="keymap $name 0xD9 bluetooth" ++ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*4720*", RUN+="keymap $name 0xB2 www 0xEE screenlock" + ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate 6593|Aspire 1640", RUN+="keymap $name 0xB2 www 0xEE screenlock" + ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 6920", RUN+="keymap $name acer-aspire_6920" + ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" +@@ -110,7 +119,7 @@ + + ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keymap $name maxdata-pro_7000" + +-ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*NC20*|*N128*|*N130*|*N210*|*SP55S*|*SQ45S70S*|*SX60P*|*SX22S*|*SX30S*|*R59P/R60P/R61P*|*SR70S/SR71S*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" ++ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", RUN+="keymap $name samsung-other" + ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s" + ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us" + +@@ -120,6 +129,8 @@ + + ENV{DMI_VENDOR}=="OQO Inc.*", ATTR{[dmi/id]product_name}=="OQO Model 2*", RUN+="keymap $name oqo-model2" + ++ENV{DMI_VENDOR}=="ONKYO CORPORATION", ATTR{[dmi/id]product_name}=="ONKYOPC", RUN+="keymap $name onkyo" ++ + ENV{DMI_VENDOR}=="ASUS", RUN+="keymap $name asus" + + ENV{DMI_VENDOR}=="VIA", ATTR{[dmi/id]product_name}=="K8N800", ATTR{[dmi/id]product_version}=="VT8204B", RUN+="keymap $name 0x81 prog1" +diff -urN udev-153-orig/extras/keymap/findkeyboards udev-153/extras/keymap/findkeyboards +--- udev-153-orig/extras/keymap/findkeyboards 2009-12-15 12:49:25.000000000 +0100 ++++ udev-153/extras/keymap/findkeyboards 2010-07-08 11:37:47.000000000 +0200 +@@ -34,6 +34,8 @@ + # modules + module=`udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*Extra Buttons'` + module="$module ++`udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*extra buttons'`" ++ module="$module + `udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='Sony Vaio Keys'`" + for m in $module; do + evdev=`ls -d $m/event* 2>/dev/null` +diff -urN udev-153-orig/extras/keymap/.gitignore udev-153/extras/keymap/.gitignore +--- udev-153-orig/extras/keymap/.gitignore 1970-01-01 01:00:00.000000000 +0100 ++++ udev-153/extras/keymap/.gitignore 2010-03-18 16:44:52.000000000 +0100 +@@ -0,0 +1,6 @@ ++keymap ++keys-from-name.gperf ++keys-from-name.h ++keys-to-name.h ++keys.txt ++ +diff -urN udev-153-orig/extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint udev-153/extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint +--- udev-153-orig/extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint 1970-01-01 01:00:00.000000000 +0100 ++++ udev-153/extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint 2010-07-07 10:58:29.000000000 +0200 +@@ -0,0 +1,7 @@ ++0x900f0 screenlock ++0x900f1 wlan ++0x900f2 switchvideomode ++0x900f3 suspend ++0x900f4 brightnessup ++0x900f5 brightnessdown ++0x900f8 zoom +diff -urN udev-153-orig/extras/keymap/keymaps/lenovo-ideapad udev-153/extras/keymap/keymaps/lenovo-ideapad +--- udev-153-orig/extras/keymap/keymaps/lenovo-ideapad 1970-01-01 01:00:00.000000000 +0100 ++++ udev-153/extras/keymap/keymaps/lenovo-ideapad 2010-08-17 16:31:27.000000000 +0200 +@@ -0,0 +1,7 @@ ++# Key codes observed on S10-3, assumed valid on other IdeaPad models ++0x81 rfkill # does nothing in BIOS ++0x83 display_off # BIOS toggles screen state ++0xB9 brightnessup # does nothing in BIOS ++0xBA brightnessdown # does nothing in BIOS ++0xF1 camera # BIOS toggles camera power ++0xf2 unknown # trackpad enable/disable (does nothing in BIOS) +diff -urN udev-153-orig/extras/keymap/keymaps/logitech-wave-pro-cordless udev-153/extras/keymap/keymaps/logitech-wave-pro-cordless +--- udev-153-orig/extras/keymap/keymaps/logitech-wave-pro-cordless 1970-01-01 01:00:00.000000000 +0100 ++++ udev-153/extras/keymap/keymaps/logitech-wave-pro-cordless 2010-07-07 10:58:29.000000000 +0200 +@@ -0,0 +1,12 @@ ++0xC01B6 camera ++0xC0183 media ++0xC0184 wordprocessor ++0xC0186 spreadsheet ++0xC018E calendar ++0xC0223 homepage ++0xC01BC messenger ++0xC018A mail ++0xC0221 search ++0xC00B8 ejectcd ++0xC022D zoomin ++0xC022E zoomout +diff -urN udev-153-orig/extras/keymap/keymaps/micro-star udev-153/extras/keymap/keymaps/micro-star +--- udev-153-orig/extras/keymap/keymaps/micro-star 2009-12-03 13:45:03.000000000 +0100 ++++ udev-153/extras/keymap/keymaps/micro-star 2010-06-11 10:52:56.000000000 +0200 +@@ -6,6 +6,7 @@ + 0xE2 bluetooth # satellite dish2 + 0xE4 f22 # Fn-F3 Touchpad disable + 0xEC email # envelope button ++0xEE camera # Fn-F6 camera disable + 0xF6 wlan # satellite dish1 + 0xF7 brightnessdown # Fn-F4 + 0xF8 brightnessup # Fn-F5 +diff -urN udev-153-orig/extras/keymap/keymaps/onkyo udev-153/extras/keymap/keymaps/onkyo +--- udev-153-orig/extras/keymap/keymaps/onkyo 1970-01-01 01:00:00.000000000 +0100 ++++ udev-153/extras/keymap/keymaps/onkyo 2010-08-31 10:35:41.000000000 +0200 +@@ -0,0 +1,14 @@ ++0xA0 mute # Fn+D ++0xAE volumedown # Fn+F ++0xB0 volumeup # Fn+G ++0xDF sleep # Fn+W ++0xE0 bluetooth # Fn+H ++0xE2 cyclewindows # Fn+Esc ++0xEE battery # Fn+Q ++0xF0 media # Fn+R ++0xF5 switchvideomode # Fn+E ++0xF6 camera # Fn+T ++0xF7 f22 # Fn+Y (touchpad toggle) ++0xF8 brightnessup # Fn+S ++0xF9 brightnessdown # Fn+A ++0xFB wlan # Fn+J From 6432dc01e28660f6fb4993811d65bfef87e5aeb6 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Fri, 19 Nov 2010 09:03:32 +0100 Subject: [PATCH 24/24] - fix /dev/systty Resolves: rhbz#654935 --- start_udev | 1 + udev.spec | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/start_udev b/start_udev index ba9b10c..9e88dbc 100755 --- a/start_udev +++ b/start_udev @@ -55,6 +55,7 @@ if [ -n "$selinuxfs" ] && [ "`cat /proc/self/attr/current`" != "kernel" ]; then SELINUX_STATE=1 fi fi +[ -c /dev/systty ] && ln -fs tty0 /dev/systty touch_recursive() { ( cd $1; diff --git a/udev.spec b/udev.spec index 09e39b1..9a62302 100644 --- a/udev.spec +++ b/udev.spec @@ -5,7 +5,7 @@ Summary: A userspace implementation of devfs Name: udev Version: 153 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv2 Group: System Environment/Base Provides: udev-persistent = %{version}-%{release} @@ -256,6 +256,10 @@ if test -f /proc/1/exe -a -d /proc/1/root; then fi exit 0 +%triggerpostun -- udev < 153-5 +[ -c /dev/systty ] && ln -fs tty0 /dev/systty +: + %post # start daemon if we are not in a chroot if test -f /proc/1/exe -a -d /proc/1/root; then @@ -382,6 +386,10 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_libdir}/pkgconfig/gudev-1.0* %changelog +* Thu Nov 18 2010 Harald Hoyer 153-5 +- fix /dev/systty +Resolves: rhbz#654935 + * Wed Sep 22 2010 Harald Hoyer 153-4 - fixed SELinux contexts on "add" events - backported keymaps