summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2006-07-09 21:32:55 +0200
committerKay Sievers <kay.sievers@suse.de>2006-07-09 21:32:55 +0200
commitc2e04d6b8b82e870c6b9ce397f5fdf9c8b4efb5a (patch)
tree1150bff9ad0dd9e87d5a82781b11207cd12ad4d9
parent989e081131f25b24da26ca94f0494ca756389867 (diff)
path_id: prepare for new sysfs layout
-rw-r--r--extras/path_id/path_id51
1 files changed, 28 insertions, 23 deletions
diff --git a/extras/path_id/path_id b/extras/path_id/path_id
index f9b3d5a73f..825c77c3b1 100644
--- a/extras/path_id/path_id
+++ b/extras/path_id/path_id
@@ -407,30 +407,35 @@ handle_usb () {
handle_device () {
full_sysfs_path="$SYSFS$DEVPATH"
- if [ -L $full_sysfs_path/subsystem ]; then
- # new sysfs block layout
- full_sysfs_path="${full_sysfs_path%/*}"
- cd "$full_sysfs_path/subsystem";
- subsys="`pwd -P`"
- cd "$OPWD"
- subsys="${subsys##*/}"
- if [ "$subsys" = "block" ]; then
- # parent is "block", it's a partition, move one up
- full_sysfs_path="${full_sysfs_path%/*}"
- fi
- cd $full_sysfs_path
- else
- # old sysfs block layout
- if [ ! -L $full_sysfs_path/device ] ; then
- if [ -f $full_sysfs_path/range ] ; then return ; fi
- full_sysfs_path="${full_sysfs_path%/*}"
- : full_sysfs_path "$full_sysfs_path"
- if [ ! -L $full_sysfs_path/device -o ! -f $full_sysfs_path/dev ] ; then
- return
+ case "$DEVPATH" in
+ /devices/*)
+ # new sysfs layout
+ if [ -L $full_sysfs_path/subsystem ]; then
+ full_sysfs_path="${full_sysfs_path%/*}"
+ cd "$full_sysfs_path/subsystem";
+ subsys="`pwd -P`"
+ cd "$OPWD"
+ subsys="${subsys##*/}"
+ if [ "$subsys" = "block" ]; then
+ # parent is "block", it's a partition, move one up
+ full_sysfs_path="${full_sysfs_path%/*}"
+ fi
+ cd $full_sysfs_path
fi
- fi
- cd $full_sysfs_path/device
- fi
+ ;;
+ *)
+ # old sysfs layout
+ if [ ! -L $full_sysfs_path/device ] ; then
+ if [ -f $full_sysfs_path/range ] ; then return ; fi
+ full_sysfs_path="${full_sysfs_path%/*}"
+ : full_sysfs_path "$full_sysfs_path"
+ if [ ! -L $full_sysfs_path/device -o ! -f $full_sysfs_path/dev ] ; then
+ return
+ fi
+ fi
+ cd $full_sysfs_path/device
+ ;;
+ esac
full_sysfs_device_path="`pwd -P`"
cd "$OPWD"
D=$full_sysfs_device_path