LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   hotplug configuration (https://www.linuxquestions.org/questions/debian-26/hotplug-configuration-210134/)

alexrait1 07-27-2004 04:25 AM

hotplug configuration
 
hello,
I am trying to find out how to make this service work for me.
I believe it's installed correctly (I have morphix debian), since all the files in
/etc/hotplug are in place.

My final goal is to get it work like in Suse 9.1 or Mandrake 10 with usb memory sticks. Namely, when I insert that device into the usb slot, an icon appears on my kde desktop with the mounted device, and it disappears again after I plug it out.

I am not sure my hotplug service is running, though when I write
Code:

hotplug start
it just moves to the next line.
the same with
Code:

hotplug status
The modules for the memory stick are loaded correctly so that
Code:

mount -t vfat /dev/sda1 /mnt/usb
works ok.

Now, I read the file /etc/hotplug/usb.rc which (as I believe) contains what I need.
Code:

maybe_start_usb ()
{

 local COUNT SYNTHESIZE
 COUNT=0
 SYNTHESIZE=true
    if [ ! -d /proc/bus/usb ]; then
        SYNTHESIZE=false
    fi
modprobe -q usbcore >/dev/null 2>&1
    if [ -d /proc/bus/usb ]; then
        # if it's not mounted, try to mount it
        if [ ! -f /proc/bus/usb/devices ]; then
        if grep -q -E      "^[^#][^[:space:]]+[[:space:]]+/proc/bus/usb/?[[:space:]]" /etc/fstab; th
                mount /proc/bus/usb
            else
                if grep -q usbfs /proc/filesystems; then
                    mount -t usbfs usbfs /proc/bus/usb
                else
                    mount -t usbdevfs usbdevfs /proc/bus/usb
                fi
            fi
        fi
    fi
.
.
.

the output of mount contains this line:
Code:

usbfs on /proc/bus/usb type usbfs (rw)
but it is there regardless of the memory stick.

what can be done?
where can I say to it to open my application whenever it sees the memory stick plugged in?

thanx to everybody.

ToniT 07-27-2004 08:45 AM

/proc/bus/usb is only losely related to usb stick. It is an interface where you can check your system for different usb devices.

alexrait1 07-27-2004 09:37 AM

Thanx for the remark..
Ok, I did have some progress :
I noticed that when I write
Code:

modprobe usb-storage
and then plug in my memory stick (DOK), the module is unloaded!
so I looked at /etc/hotplug/usb/usb-storage and found this:
Code:

if (not $attached and $unattached) {
          system 'rmmod usb-storage';
        }

I commented this line, and the usb-storage was no longer unloaded.
Now there are three files: usb-storage,usb-agent and usb.rc.
I tried to find out what is the order of execution and the result is (with "echo")
usb.rc->usb.agent->usb-storage
though I guess that might not be correct since they are built of many functions..
Anyway, after these files run, I can easily mount my usb drive with
mount -t /dev/sda1 /mnt/usb
but, if I put this line in usb-agent, and direct the ouput to some file, It contains this message:
Code:

mount: /dev/sda1 is not a valid block device
So I still wonder where to put this line....(though I am happy these files are been exectued at least).

according to this post:

post

Quote:

Watch a file in a timeout. (We had hotplug for USB storage
devices in Red Hat 7.1 working quite nicely by watching
/etc/fstab for changes; kudzu added new entries in
response to hotplug events. magicdev noticed the
changes, signaled mc which added icons on the desktop.)
I guess I have to make something similar...


All times are GMT -5. The time now is 03:27 AM.