[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: USB flash drive not automounting or mounting



On Monday 06 February 2006 9:58 am, Andrew Sackville-West so eloquently 
stated:

> Now, I am not sure which of these would be used for a flash drive, but I
> can tell that a few won't be....

look in /etc/udev/rules.d/050_hal* and see what that says. That is the rule
 that creates sd* devices.

OK, in /etc/udev/hal.rules:
# put removable IDE/SCSI devices into the hal group instead of 'disk'
BUS="scsi",KERNEL="sd[a-z]*", PROGRAM="/etc/udev/scripts/device-removable.sh 
%k", RESULT="1", NAME="%k", MODE="0640", GROUP="hal"
# BUS="ide", KERNEL="hd[a-z]*", PROGRAM="/etc/udev/scripts/device-removable.sh 
%k", RESULT="1", NAME="%k", MODE="0640", GROUP="hal"
BUS="usb", KERNEL="ub[a-z]*", NAME="%k", MODE="0640", GROUP="hal"

In /etc/udev/rules.d/:
I have no 050_hal* files. I have a file called z_hal-plugdev.rules:
# put removable IDE/SCSI devices into the hal group instead of 'disk'
BUS="scsi",KERNEL="sd[a-z]*", PROGRAM="/etc/udev/scripts/device-removable.sh 
%k", RESULT="1", NAME="%k", MODE="0640", GROUP="hal"
# BUS="ide", KERNEL="hd[a-z]*", PROGRAM="/etc/udev/scripts/device-removable.sh 
%k", RESULT="1", NAME="%k", MODE="0640", GROUP="hal"
BUS="usb", KERNEL="ub[a-z]*", NAME="%k", MODE="0640", GROUP="hal"

Since they point to /etc/udev/scripts/device-removable.sh:
#!/bin/sh -e
# print "1" if device $1 is either removable, on the ieee1394 or on the usb 
bus,
# and "0" otherwise.

check_bus() {
  # check if the DEVICE is on the given bus 
  # This is done by checking if any of the devices on the bus is a prefix 
  # of the device
  BUSDEVP="/sys/bus/$1/devices"
  for x in $BUSDEVP/*; do
    [ -L "$x" ] || continue
    if echo "$DEVICE" | grep -q "^$(readlink -f $x)"; then 
      return 0
    fi
  done
  return 1
}

DEV="${1%[0-9]*}"
BLOCKPATH="/sys/block/$DEV"

if [ ! -d "${BLOCKPATH}" ]; then 
  exit 1
fi

REMOVABLE="${BLOCKPATH}/removable"
DEVICE="$(readlink -f "${BLOCKPATH}/device")"
IS_REMOVABLE="0"

if [ -e "$REMOVABLE" ]; then
  IS_REMOVABLE="$(cat $REMOVABLE)"
fi

if [ "$IS_REMOVABLE" = "1" ] || check_bus "usb" || check_bus "ieee1394" ; then 
  echo 1
else 
  echo 0
fi
exit 0


Nothing here leads me to believe this is how the automounting happens. I also 
looked at my Ubuntu udev scripts and rules and saw nothing there.

Can someone enlighten me otherwise?

Rob

-- 
Mountlake Terrace, WA, USA



Reply to: