diff options
author | Richard Yao <ryao@gentoo.org> | 2013-03-17 12:50:36 -0400 |
---|---|---|
committer | Richard Yao <ryao@cs.stonybrook.edu> | 2013-03-17 12:50:36 -0400 |
commit | 788245436d3c9e3fbc84285d60f3b4c40e18c207 (patch) | |
tree | 2983d000a6b91e6c6f0877fadc14b47df5e0adee | |
parent | 15cad0e19bc6e79fe70b23b1b0f076ab23d4d7a4 (diff) | |
parent | 261132097e647d259c851b32c3c5798fa13cc67a (diff) |
Merge remote-tracking branch 'origin/follow-upstream'
Signed-off-by: Richard Yao <ryao@gentoo.org>
-rw-r--r-- | configure.ac | 104 | ||||
-rw-r--r-- | keymaps-force-release/Makefile.am | 2 | ||||
-rw-r--r-- | keymaps-force-release/samsung-series-9 (renamed from keymaps-force-release/samsung-90x3a) | 0 | ||||
-rw-r--r-- | keymaps/Makefile.am | 3 | ||||
-rw-r--r-- | keymaps/hewlett-packard-hdx9494nr | 3 | ||||
-rw-r--r-- | keymaps/samsung-series-9 (renamed from keymaps/samsung-90x3a) | 0 | ||||
-rw-r--r-- | rules/95-keyboard-force-release.rules | 4 | ||||
-rw-r--r-- | rules/95-keymap.rules | 6 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/accelerometer/accelerometer.c | 11 | ||||
-rw-r--r-- | src/cdrom_id/cdrom_id.c | 2 | ||||
-rw-r--r-- | src/libudev/Makefile.am | 14 | ||||
-rw-r--r-- | src/scsi_id/scsi_serial.c | 2 | ||||
-rw-r--r-- | src/udev/udev-builtin-blkid.c | 16 | ||||
-rw-r--r-- | src/udev/udev-builtin-net_id.c | 49 | ||||
-rw-r--r-- | src/udev/udev-builtin-path_id.c | 17 | ||||
-rw-r--r-- | src/udev/udev-builtin-usb_id.c | 13 | ||||
-rw-r--r-- | src/udev/udevadm-hwdb.c | 8 |
18 files changed, 163 insertions, 93 deletions
diff --git a/configure.ac b/configure.ac index 8b46ae6083..df7ba6af4d 100644 --- a/configure.ac +++ b/configure.ac @@ -25,7 +25,7 @@ AC_PROG_AWK AC_PROG_CC_C99 AS_IF([test "x$ac_cv_prog_cc_c99" = "xno"], [ - AC_MSG_ERROR([no C99 compiler found, $PACKAGE requires a C99 compiler.]) + AC_MSG_ERROR([no C99 compiler found, $PACKAGE requires a C99 compiler.]) ]) AC_PROG_CXX @@ -39,12 +39,12 @@ AC_PATH_PROG([XSLTPROC], [xsltproc]) # Checks for header files. AC_CHECK_HEADERS( - [arpa/inet.h fcntl.h inttypes.h langinfo.h limits.h locale.h \ - netinet/in.h sys/ioctl.h sys/mount.h \ - sys/param.h sys/socket.h sys/statvfs.h sys/time.h sys/vfs.h syslog.h \ - termios.h unistd.h], - [], - [AC_MSG_ERROR([*** POSIX header not found])] + [arpa/inet.h fcntl.h inttypes.h langinfo.h limits.h locale.h \ + netinet/in.h sys/ioctl.h sys/mount.h \ + sys/param.h sys/socket.h sys/statvfs.h sys/time.h sys/vfs.h syslog.h \ + termios.h unistd.h], + [], + [AC_MSG_ERROR([*** POSIX header not found])] ) # Checks for typedefs, structures, and compiler characteristics. @@ -71,11 +71,11 @@ AC_FUNC_MKTIME AC_FUNC_MMAP AC_CHECK_FUNCS( - [alarm dup2 ftruncate localtime_r mempcpy \ - mkdir munmap nl_langinfo rmdir setlocale socket stpcpy \ - uname], - [], - [AC_MSG_ERROR([*** POSIX function not found])] + [alarm dup2 ftruncate localtime_r mempcpy \ + mkdir munmap nl_langinfo rmdir setlocale socket stpcpy \ + uname], + [], + [AC_MSG_ERROR([*** POSIX function not found])] ) AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX librt not found])]) AC_SEARCH_LIBS([sqrt], [m], [], [AC_MSG_ERROR([*** POSIX libm not found])]) @@ -88,38 +88,38 @@ AC_SEARCH_LIBS([sqrt], [m], [], [AC_MSG_ERROR([*** POSIX libm not found])]) # Set paths here AC_ARG_WITH( - [rootprefix], - [AS_HELP_STRING( - [--with-rootprefix=DIR], - [rootfs directory prefix for config files and kernel modules])], - [], - [with_rootprefix=${ac_default_prefix}] + [rootprefix], + [AS_HELP_STRING( + [--with-rootprefix=DIR], + [rootfs directory prefix for config files and kernel modules])], + [], + [with_rootprefix=${ac_default_prefix}] ) AC_ARG_WITH( - [rootlibdir], - [AS_HELP_STRING( - [--with-rootlibdir=DIR], - [Root directory for libraries necessary for boot])], - [], - [with_rootlibdir=${libdir}] + [rootlibdir], + [AS_HELP_STRING( + [--with-rootlibdir=DIR], + [Root directory for libraries necessary for boot])], + [], + [with_rootlibdir=${libdir}] ) AC_ARG_ENABLE( - [split-usr], - [AS_HELP_STRING( - [--enable-split-usr], - [Include hard-coded default search paths in / and /usr])], - [], - [AS_IF( - [test "x${ac_default_prefix}" != "x${with_rootprefix}"], - [enable_split_usr=yes], - [enable_split_usr=no])] + [split-usr], + [AS_HELP_STRING( + [--enable-split-usr], + [Include hard-coded default search paths in / and /usr])], + [], + [AS_IF( + [test "x${ac_default_prefix}" != "x${with_rootprefix}"], + [enable_split_usr=yes], + [enable_split_usr=no])] ) AS_IF( - [test "x${enable_split_usr}" = "xyes"], - [AC_DEFINE(HAVE_SPLIT_USR, 1, [Define to include hard-coded default search paths in / and /usr])] + [test "x${enable_split_usr}" = "xyes"], + [AC_DEFINE(HAVE_SPLIT_USR, 1, [Define to include hard-coded default search paths in / and /usr])] ) # Configured paths @@ -244,7 +244,7 @@ GTK_DOC_CHECK([1.18],[--flavour no-tmpl]) AM_CONDITIONAL([ENABLE_GTK_DOC],[test "x$enable_gtk_doc" = "xyes"]) AS_IF([test "x$enable_gtk_doc" = "xyes" -a "x$XSLTPROC" = x], [ - AC_MSG_ERROR([*** GTK doc requested but xsltproc not found]) + AC_MSG_ERROR([*** GTK doc requested but xsltproc not found]) ]) # ------------------------------------------------------------------------------ @@ -265,18 +265,18 @@ AC_ARG_ENABLE(libkmod, [AS_HELP_STRING([--enable-libkmod], [Enable module loadin if test "x${enable_modules}" = xyes; then - AC_DEFINE([HAVE_MODULES], [1], [Define if we support loading modules]) + AC_DEFINE([HAVE_MODULES], [1], [Define if we support loading modules]) - AS_IF([test "x${enable_libkmod}" = xyes], - [AC_CHECK_LIB([kmod], [main], - [PKG_CHECK_MODULES(KMOD, [libkmod >= 5]) - AC_SUBST([LIBKMOD], ["-lkmod"]) - AC_DEFINE([HAVE_LIBKMOD], [1], - [Define if you have libkmod]) - ], - [AC_MSG_FAILURE( - [--enable-libkmod was given, but test for kmod failed])], - [-lkmod])]) + AS_IF([test "x${enable_libkmod}" = xyes], + [AC_CHECK_LIB([kmod], [main], + [PKG_CHECK_MODULES(KMOD, [libkmod >= 5]) + AC_SUBST([LIBKMOD], ["-lkmod"]) + AC_DEFINE([HAVE_LIBKMOD], [1], + [Define if you have libkmod]) + ], + [AC_MSG_FAILURE( + [--enable-libkmod was given, but test for kmod failed])], + [-lkmod])]) fi @@ -355,20 +355,20 @@ AC_MSG_RESULT([ pkgconfiglibdir: ${libdir}/pkgconfig sharepkgconfigdir ${datadir}/pkgconfig - libgudev_includedir ${includedir}/gudev-1.0/gudev + libgudev_includedir ${includedir}/gudev-1.0/gudev - girdir ${datadir}/gir-1.0 - typelibsdir ${libdir}/girepository-1.0 + girdir ${datadir}/gir-1.0 + typelibsdir ${libdir}/girepository-1.0 ]) # ------------------------------------------------------------------------------ dnl Set configured scripts executable if test -f src/keymap/check-keymaps.sh; then - chmod +x src/keymap/check-keymaps.sh + chmod +x src/keymap/check-keymaps.sh fi if test -f src/keymap/keyboard-force-release.sh; then - chmod +x src/keymap/keyboard-force-release.sh + chmod +x src/keymap/keyboard-force-release.sh fi diff --git a/keymaps-force-release/Makefile.am b/keymaps-force-release/Makefile.am index 1c4fb51499..8abd627014 100644 --- a/keymaps-force-release/Makefile.am +++ b/keymaps-force-release/Makefile.am @@ -5,5 +5,5 @@ dist_udevkeymapforcere_DATA = \ dell-xps \ hp-other \ samsung-other \ - samsung-90x3a \ + samsung-series-9 \ common-volume-keys diff --git a/keymaps-force-release/samsung-90x3a b/keymaps-force-release/samsung-series-9 index 65707effb7..65707effb7 100644 --- a/keymaps-force-release/samsung-90x3a +++ b/keymaps-force-release/samsung-series-9 diff --git a/keymaps/Makefile.am b/keymaps/Makefile.am index c809888062..e8f5a60110 100644 --- a/keymaps/Makefile.am +++ b/keymaps/Makefile.am @@ -28,6 +28,7 @@ KEYMAPS = \ hewlett-packard-tablet \ hewlett-packard-tx2 \ hewlett-packard_elitebook-8440p \ + hewlett-packard-hdx9494nr \ ibm-thinkpad-usb-keyboard-trackpoint \ inventec-symphony_6.0_7.0 \ lenovo-3000 \ @@ -54,7 +55,7 @@ KEYMAPS = \ onkyo \ oqo-model2 \ samsung-other \ - samsung-90x3a \ + samsung-series-9 \ samsung-sq1us \ samsung-sx20s \ toshiba-satellite_a100 \ diff --git a/keymaps/hewlett-packard-hdx9494nr b/keymaps/hewlett-packard-hdx9494nr new file mode 100644 index 0000000000..f3484e125a --- /dev/null +++ b/keymaps/hewlett-packard-hdx9494nr @@ -0,0 +1,3 @@ +0xB2 www # FnF3 +0xD8 f22 # touchpad off +0xD9 f23 # touchpad on diff --git a/keymaps/samsung-90x3a b/keymaps/samsung-series-9 index 3b65735fa0..3b65735fa0 100644 --- a/keymaps/samsung-90x3a +++ b/keymaps/samsung-series-9 diff --git a/rules/95-keyboard-force-release.rules b/rules/95-keyboard-force-release.rules index 3e87ed791a..77bae24836 100644 --- a/rules/95-keyboard-force-release.rules +++ b/rules/95-keyboard-force-release.rules @@ -23,7 +23,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]*", RUN+="keyboard-force-release.sh $devpath samsung-other" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*90X3A*", RUN+="keyboard-force-release.sh $devpath samsung-90x3a" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*90X3A*|*900X3*|*900X4*", RUN+="keyboard-force-release.sh $devpath samsung-series-9" ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath common-volume-keys" ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Latitude E*|Latitude *U|Precision M*", RUN+="keyboard-force-release.sh $devpath dell-touchpad" @@ -46,7 +46,7 @@ ENV{DMI_VENDOR}=="Viooo Corporation", ATTR{[dmi/id]product_name}=="PT17", RUN+=" # These are all the HP laptops that setup a touchpad toggle key ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[pP][aA][vV][iI][lL][iI][oO][nN]*", RUN+="keyboard-force-release.sh $devpath hp-other" ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keyboard-force-release.sh $devpath hp-other" -ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*|HP G60 Notebook PC", RUN+="keyboard-force-release.sh $devpath hp-other" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*|HP G60 Notebook PC|HDX9494NR", RUN+="keyboard-force-release.sh $devpath hp-other" ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote 6615WD", RUN+="keyboard-force-release.sh $devpath common-volume-keys" diff --git a/rules/95-keymap.rules b/rules/95-keymap.rules index 1a208492ae..3fb208cd4d 100644 --- a/rules/95-keymap.rules +++ b/rules/95-keymap.rules @@ -100,8 +100,9 @@ ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*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" ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP G62 Notebook PC", RUN+="keymap $name 0xB2 www" -ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP ProBook*", RUN+="keymap $name 0xF8 rfkill" +ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP ProBook*", RUN+="keymap $name 0xF8 rfkill 0xB2 www" ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP EliteBook 8440p", RUN+="keymap $name hewlett-packard_elitebook-8440p" +ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HDX9494NR", RUN+="keymap $name hewlett-packard-hdx9494nr" # HP Pavillion dv6315ea has empty DMI_VENDOR # quick play ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dmi/id]board_version}=="65.2B", RUN+="keymap $name 0x88 media" @@ -153,7 +154,8 @@ ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", RUN+="keymap $name samsung-oth 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" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*700Z*", RUN+="keymap $name 0xBA ejectcd 0x96 keyboardbrightnessup 0x97 keyboardbrightnessdown" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*90X3A*", RUN+="keymap $name samsung-90x3a" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*700T*", RUN+="keymap $name 0xAD leftmeta" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*90X3A*|*900X3*|*900X4*", RUN+="keymap $name samsung-series-9" 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" diff --git a/src/Makefile.am b/src/Makefile.am index fdcc0711a9..82732ca4bb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -21,7 +21,7 @@ endif if ENABLE_KEYMAP SUBDIRS += \ - keymap + keymap endif if ENABLE_LEGACYLIB diff --git a/src/accelerometer/accelerometer.c b/src/accelerometer/accelerometer.c index 67fed27c5e..76c64d753b 100644 --- a/src/accelerometer/accelerometer.c +++ b/src/accelerometer/accelerometer.c @@ -257,7 +257,6 @@ int main (int argc, char** argv) char devpath[PATH_MAX]; char *devnode; - const char *id_path; struct udev_enumerate *enumerate; struct udev_list_entry *list_entry; @@ -303,18 +302,10 @@ int main (int argc, char** argv) return 1; } - id_path = udev_device_get_property_value(dev, "ID_PATH"); - if (id_path == NULL) { - fprintf (stderr, "unable to get property ID_PATH for '%s'", devpath); - return 0; - } - /* Get the children devices and find the devnode */ - /* FIXME: use udev_enumerate_add_match_parent() instead */ devnode = NULL; enumerate = udev_enumerate_new(udev); - udev_enumerate_add_match_property(enumerate, "ID_PATH", id_path); - udev_enumerate_add_match_subsystem(enumerate, "input"); + udev_enumerate_add_match_parent(enumerate, dev); udev_enumerate_scan_devices(enumerate); udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { struct udev_device *device; diff --git a/src/cdrom_id/cdrom_id.c b/src/cdrom_id/cdrom_id.c index 1056536b7d..b659cc31ee 100644 --- a/src/cdrom_id/cdrom_id.c +++ b/src/cdrom_id/cdrom_id.c @@ -513,6 +513,8 @@ static int cd_profiles_old_mmc(struct udev *udev, int fd) if (cd_media == 1) { log_debug("no current profile, but disc is present; assuming CD-ROM\n"); cd_media_cd_rom = 1; + cd_media_track_count = 1; + cd_media_track_count_data = 1; return 0; } else { log_debug("no current profile, assuming no media\n"); diff --git a/src/libudev/Makefile.am b/src/libudev/Makefile.am index 007f0defbd..687764e5e2 100644 --- a/src/libudev/Makefile.am +++ b/src/libudev/Makefile.am @@ -5,13 +5,13 @@ LIBUDEV_REVISION=0 LIBUDEV_AGE=2 define move-to-rootlibdir - if test "$(libdir)" != "$(rootlibdir)"; then \ - $(MKDIR_P) $(DESTDIR)$(rootlibdir) && \ - so_img_name=$$(readlink $(DESTDIR)$(libdir)/$$libname) && \ - so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \ - ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/$$libname && \ - mv $(DESTDIR)$(libdir)/$$libname.* $(DESTDIR)$(rootlibdir); \ - fi + if test "$(libdir)" != "$(rootlibdir)"; then \ + $(MKDIR_P) $(DESTDIR)$(rootlibdir) && \ + so_img_name=$$(readlink $(DESTDIR)$(libdir)/$$libname) && \ + so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \ + ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/$$libname && \ + mv $(DESTDIR)$(libdir)/$$libname.* $(DESTDIR)$(rootlibdir); \ + fi endef AM_CPPFLAGS = \ diff --git a/src/scsi_id/scsi_serial.c b/src/scsi_id/scsi_serial.c index 3c52dee62d..950b8adc0a 100644 --- a/src/scsi_id/scsi_serial.c +++ b/src/scsi_id/scsi_serial.c @@ -799,7 +799,7 @@ static int do_scsi_page80_inquiry(struct udev *udev, ser_ind = prepend_vendor_model(udev, dev_scsi, &serial[1]); if (ser_ind < 0) return 1; - ser_ind++; /* for the leading 'S' */ + ser_ind++; /* for the leading 'S' */ for (i = 4; i < len + 4; i++, ser_ind++) serial[ser_ind] = buf[i]; } diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c index 4293103046..e3a89973cb 100644 --- a/src/udev/udev-builtin-blkid.c +++ b/src/udev/udev-builtin-blkid.c @@ -78,6 +78,22 @@ static void print_property(struct udev_device *dev, bool test, const char *name, } else if (startswith(name, "PART_ENTRY_")) { util_strscpyl(s, sizeof(s), "ID_", name, NULL); udev_builtin_add_property(dev, test, s, value); + + } else if (streq(name, "SYSTEM_ID")) { + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_SYSTEM_ID", s); + + } else if (streq(name, "PUBLISHER_ID")) { + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_PUBLISHER_ID", s); + + } else if (streq(name, "APPLICATION_ID")) { + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_APPLICATION_ID", s); + + } else if (streq(name, "BOOT_SYSTEM_ID")) { + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_BOOT_SYSTEM_ID", s); } } diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c index 7c9564f4cd..36eec5aec0 100644 --- a/src/udev/udev-builtin-net_id.c +++ b/src/udev/udev-builtin-net_id.c @@ -94,6 +94,7 @@ enum netname_type{ NET_UNDEF, NET_PCI, NET_USB, + NET_BCMA, }; struct netnames { @@ -108,8 +109,9 @@ struct netnames { char pci_onboard[IFNAMSIZ]; const char *pci_onboard_label; - struct udev_device *usbdev; char usb_ports[IFNAMSIZ]; + + char bcma_core[IFNAMSIZ]; }; /* retrieve on-board index number and label from firmware */ @@ -251,7 +253,7 @@ static int names_pci(struct udev_device *dev, struct netnames *names) { if (!parent) return -ENOENT; /* check if our direct parent is a PCI device with no other bus in-between */ - if (streq("pci", udev_device_get_subsystem(parent))) { + if (streq_ptr("pci", udev_device_get_subsystem(parent))) { names->type = NET_PCI; names->pcidev = parent; } else { @@ -265,6 +267,7 @@ static int names_pci(struct udev_device *dev, struct netnames *names) { } static int names_usb(struct udev_device *dev, struct netnames *names) { + struct udev_device *usbdev; char name[256]; char *ports; char *config; @@ -272,12 +275,12 @@ static int names_usb(struct udev_device *dev, struct netnames *names) { size_t l; char *s; - names->usbdev = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_interface"); - if (!names->usbdev) + usbdev = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_interface"); + if (!usbdev) return -ENOENT; /* get USB port number chain, configuration, interface */ - util_strscpy(name, sizeof(name), udev_device_get_sysname(names->usbdev)); + util_strscpy(name, sizeof(name), udev_device_get_sysname(usbdev)); s = strchr(name, '-'); if (!s) return -EINVAL; @@ -316,6 +319,25 @@ static int names_usb(struct udev_device *dev, struct netnames *names) { return 0; } +static int names_bcma(struct udev_device *dev, struct netnames *names) { + struct udev_device *bcmadev; + unsigned int core; + + bcmadev = udev_device_get_parent_with_subsystem_devtype(dev, "bcma", NULL); + if (!bcmadev) + return -ENOENT; + + /* bus num:core num */ + if (sscanf(udev_device_get_sysname(bcmadev), "bcma%*d:%d", &core) != 1) + return -EINVAL; + /* suppress the common core == 0 */ + if (core > 0) + snprintf(names->bcma_core, sizeof(names->bcma_core), "b%d", core); + + names->type = NET_BCMA; + return 0; +} + static int names_mac(struct udev_device *dev, struct netnames *names) { const char *s; unsigned int i; @@ -452,7 +474,24 @@ static int builtin_net_id(struct udev_device *dev, int argc, char *argv[], bool if (names.pci_slot[0]) if (snprintf(str, sizeof(str), "%s%s%s", prefix, names.pci_slot, names.usb_ports) < (int)sizeof(str)) udev_builtin_add_property(dev, test, "ID_NET_NAME_SLOT", str); + goto out; } + + /* Broadcom bus */ + err = names_bcma(dev, &names); + if (err >= 0 && names.type == NET_BCMA) { + char str[IFNAMSIZ]; + + if (names.pci_path[0]) + if (snprintf(str, sizeof(str), "%s%s%s", prefix, names.pci_path, names.bcma_core) < (int)sizeof(str)) + udev_builtin_add_property(dev, test, "ID_NET_NAME_PATH", str); + + if (names.pci_slot[0]) + if (snprintf(str, sizeof(str), "%s%s%s", prefix, names.pci_slot, names.bcma_core) < (int)sizeof(str)) + udev_builtin_add_property(dev, test, "ID_NET_NAME_SLOT", str); + goto out; + } + out: return EXIT_SUCCESS; } diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c index c2c9161c94..d6b3736aee 100644 --- a/src/udev/udev-builtin-path_id.c +++ b/src/udev/udev-builtin-path_id.c @@ -356,7 +356,7 @@ static struct udev_device *handle_scsi(struct udev_device *parent, char **path) goto out; } - /* lousy scsi sysfs does not have a "subsystem" for the transport */ + /* scsi sysfs does not have a "subsystem" for the transport */ name = udev_device_get_syspath(parent); if (strstr(name, "/rport-") != NULL) { @@ -375,12 +375,15 @@ static struct udev_device *handle_scsi(struct udev_device *parent, char **path) } /* - * We do not support the ATA transport class, it creates duplicated link - * names as the fake SCSI host adapters are all separated, they are all - * re-based as host == 0. ATA should just stop faking two duplicated - * hierarchies for a single topology and leave the SCSI stuff alone; - * until that happens, there are no by-path/ links for ATA devices behind - * an ATA transport class. + * We do not support the ATA transport class, it uses global counters + * to name the ata devices which numbers spread across multiple + * controllers. + * + * The real link numbers are not exported. Also, possible chains of ports + * behind port multipliers cannot be composed that way. + * + * Until all that is solved at the kernel level, there are no by-path/ + * links for ATA devices. */ if (strstr(name, "/ata") != NULL) { parent = NULL; diff --git a/src/udev/udev-builtin-usb_id.c b/src/udev/udev-builtin-usb_id.c index 13d1226393..ce9ffe7db8 100644 --- a/src/udev/udev-builtin-usb_id.c +++ b/src/udev/udev-builtin-usb_id.c @@ -189,7 +189,7 @@ static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len pos = 0; strpos = 0; ifs_str[0] = '\0'; - while (pos < sizeof(buf) && strpos+7 < len-2) { + while (pos < size && strpos+7 < len-2) { struct usb_interface_descriptor *desc; char if_str[8]; @@ -432,6 +432,17 @@ fallback: usb_serial = udev_device_get_sysattr_value(dev_usb, "serial"); if (usb_serial) { + const unsigned char *p; + + /* http://msdn.microsoft.com/en-us/library/windows/hardware/gg487321.aspx */ + for (p = (unsigned char *)usb_serial; *p != '\0'; p++) + if (*p < 0x20 || *p > 0x7f || *p == ',') { + usb_serial = NULL; + break; + } + } + + if (usb_serial) { util_replace_whitespace(usb_serial, serial_str, sizeof(serial_str)-1); util_replace_chars(serial_str, NULL); } diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c index 917d1e0eaf..4f43953895 100644 --- a/src/udev/udevadm-hwdb.c +++ b/src/udev/udevadm-hwdb.c @@ -474,9 +474,10 @@ static int import_file(struct trie *trie, const char *filename) { } static void help(void) { - printf("Usage: udevadm hwdb [--create] [--help] [--root <root_path>]\n" + printf("Usage: udevadm hwdb OPTIONS\n" " --update update the hardware database\n" - " --test <modalias> query database and print result\n" + " --test=<modalias> query database and print result\n" + " --root=<path> alternative root path in the filesystem\n" " --help\n\n"); } @@ -488,7 +489,8 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) { { "help", no_argument, NULL, 'h' }, {} }; - const char *test = NULL, *root_path = NULL; + const char *test = NULL; + const char *root_path = NULL; char *udev_hwdb_path = UDEV_HWDB_BIN; bool update = false; struct trie *trie = NULL; |