Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: manuel on August 10, 2009, 02:36:01 PM

Title: Being notified when plugging an usb stick? [SOLVED]
Post by: manuel on August 10, 2009, 02:36:01 PM
Hello.

I need to know how I could be notified of plugging an usb memory and react reading some files therein.
I've installed dbus and hal TCEs, but I'm not able to receive dbus messages.
Is there an application where I can see dbus and hal working? Something like Gnome panel with automount applet? (But without the whole Gnome thing.)

Thanks!

Title: Re: Being notified when plugging an usb stick?
Post by: bmarkus on August 10, 2009, 03:06:40 PM
Hi,
 
first make sure DBUS and HAL is running. Use 'lshal' command. If everything is ok, you will get a long list of identified devices.

If DBUS/HAL is not running, start it with 'sudo hal-start'
 
If running, use 'lshal -m' to monitor changes. Plug USB drive, it must be reported.

However it depends on what do you want to do. In fact USB connection is identified by udev and kernel, DBUS and HAL are higher layers and not necessarily needed, see udev rules.
Title: Re: Being notified when plugging an usb stick?
Post by: ^thehatsrule^ on August 10, 2009, 03:07:58 PM
I think the hal extension were created initially for the xfce4 extension in mind... not sure if any other extensions take advantage of it

Alternatively, you could adjust the udev settings instead.
Title: Re: Being notified when plugging an usb stick?
Post by: manuel on August 10, 2009, 03:34:36 PM
Hello.

Ok, I see HAL isn't running. I run "sudo hal-start", and dbus starts, but not hal.
I've seen, in other post, that we need bluez to start dbus and hal. I've installed that and a lot of things to try to get dbus working, even edited /opt/bootlocal.sh and added hal-start, but to no avail.

While waiting your help, I'll read udev rules docs.

Thank you.
Title: Re: Being notified when plugging an usb stick?
Post by: bmarkus on August 10, 2009, 03:39:27 PM

Ok, I see HAL isn't running. I run "sudo hal-start", and dbus starts, but not hal.
I've seen, in other post, that we need bluez to start dbus and hal. I've installed that and a lot of things to try to get dbus working, even edited


Bluez definitely not needed. hal.tcel (or hal.tczl) installs everything needed to run hal. There is mybe a conflict between installed components.

Take a clean system, either a newly installed on the USB stick or start system with 'tinycore base nolocal norestore' option. Then install only hal with appbrowser.

It must work on TC 2.2 system. If not, there must be an error message. Share it with us.
Title: Re: Being notified when plugging an usb stick?
Post by: bmarkus on August 10, 2009, 03:56:39 PM

While waiting your help, I'll read udev rules docs.


sudo udevmonitor may help


or you can run periodically lsusb command. There are many different approaches...
Title: Re: Being notified when plugging an usb stick?
Post by: manuel on August 11, 2009, 03:35:30 AM
Hello.

Ok, it's just like you said. After a clean install it works perfectly.
Anyway, after following your suggestions, last night I readed udev documentation and I have to say, to my joy: that's the perfect solution to my headache  :)

Thank you guys because I didn't even know about udev, and this will be a source of joy and happiness.  ;D