Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
hotplug usb.agent does not execute $REMOVER script
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
NanoCosm
Tux's lil' helper
Tux's lil' helper


Joined: 16 May 2003
Posts: 99
Location: Germany

PostPosted: Thu Dec 16, 2004 12:08 pm    Post subject: hotplug usb.agent does not execute $REMOVER script Reply with quote

Hi!

Writing a universal USB-Storage hotplugging script I figured out that there seems to be a bug in usb.agent.

When plugging in an USB-Pen, the "add" event is generated and $REMOVER ist set in usb.agent via
Code:

...
#
# declare a REMOVER name that the add action can use to create a
# remover, or that the remove action can use to execute a remover.
#
if [ "$DEVPATH" != "" ]; then
  # probably, 2.6.x
  REMOVER=/var/run/usb/$(readlink -f $SYSFS/$DEVPATH | sed -e 's;/;%;g')
                              ^^^^^ This DOES work when plugging in.
elif [ "$DEVICE" != "" ]; then
  # 2.4.x?
  REMOVER=/var/run/usb/$(echo $DEVICE | sed -e 's;/;%;g')
else
  # should not happen?
  REMOVER=/var/run/usb/$(echo "$INTERFACE/$PRODUCT/$TYPE" | sed -e 's;/;%;g')
fi
export REMOVER
...


but when unplugging readlink can not return anything because the /sys/devices.... does not exists anymore.

Is there already a solution for this?

Oh, I use hotplug 20040923 and hotplug-base 20040401
Back to top
View user's profile Send private message
NanoCosm
Tux's lil' helper
Tux's lil' helper


Joined: 16 May 2003
Posts: 99
Location: Germany

PostPosted: Thu Dec 16, 2004 2:26 pm    Post subject: Reply with quote

I submitted a bug-report to the developers, including the fix below:

Code:

#
# declare a REMOVER name that the add action can use to create a
# remover, or that the remove action can use to execute a remover.
#
if [ "$DEVPATH" != "" ]; then
  # probably, 2.6.x
  REMOVER=/var/run/usb/$(echo "$SYSFS$DEVPATH" | sed -e 's;/;%;g')
elif [ "$DEVICE" != "" ]; then
  # 2.4.x?
  REMOVER=/var/run/usb/$(echo $DEVICE | sed -e 's;/;%;g')
else
  # should not happen?
  REMOVER=/var/run/usb/$(echo "$INTERFACE/$PRODUCT/$TYPE" | sed -e 's;/;%;g')
fi
export REMOVER



See http://sourceforge.net/tracker/index.php?func=detail&atid=117679&aid=1086458&group_id=17679
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum