View previous topic :: View next topic |
Author |
Message |
Ian Goldby Guru
Joined: 18 May 2002 Posts: 539 Location: (Inactive member)
|
Posted: Sun Aug 04, 2002 10:19 am Post subject: How to load module when KDE desktop icon opened? |
|
|
I have a KDE desktop icon for my digital camera that mounts the device /dev/sda1. This is a USB mass-storage device on which my camera appears when I plug it in. If usb-storage is compiled as a kernel module, then devfs does not create /dev/sda1 until the module is loaded. Thus when I click the icon, I just get an error saying that /dev/sda1 does not exist, until I go to a terminal, become root, and type 'insmod usb-storage'. Now, I'm not exactly Grandma, but it does seem that this is not entirely a user-friendly way to go about things.
I would like to know how to have usb-storage automatically loaded when I click the icon. I presume I've got to do something in /etc/modules.d/, but I'm not really up to speed with modules. I know I could just have it load on boot, but that seems to defeat the object of compiling it as a module in the first place.
Or would I be better off to compile everything into the kernel and abandon my brief flirtation with loadable modules? But it seems that this is exactly the sort of thing the Linux module architecture ought to handle transparently, so I'd like to do this the Right Way(TM) if possible. |
|
Back to top |
|
|
Locke n00b
Joined: 02 Aug 2002 Posts: 50 Location: Baton Rouge, LA, US
|
Posted: Sun Aug 04, 2002 10:24 am Post subject: |
|
|
Well, I'm not exactly an uber sysadmin so I'm sure there's a better way to do this. But couldn't you just add usb-storage to /etc/modules.autoload and then not have to worry about loading it at all? Or do you only want it loaded while the camera is plugged in? |
|
Back to top |
|
|
puddpunk l33t
Joined: 20 Jul 2002 Posts: 681 Location: New Zealand
|
Posted: Sun Aug 04, 2002 10:45 am Post subject: . |
|
|
i assume the module fails if the camera isnt plugged in... or else just do what was said above.
Else, you can write a script thats attached to your kde icon that uses sudo and an echo'd Password (unsafe). I'm pretty sure linux supports some kind of hot-plug event system, so you could google about and find some more about that. Just add a modprobe command to the event.
I dont use USB much, so i dont really know what im talking about. But its worth a try... |
|
Back to top |
|
|
Ian Goldby Guru
Joined: 18 May 2002 Posts: 539 Location: (Inactive member)
|
Posted: Sun Aug 04, 2002 11:21 am Post subject: |
|
|
Thanks for the suggestions.
/etc/modules.autoload - if I put a module in /etc/modules.autoload so that it is always loaded, I might just as well have compiled it directly into the kernel and avoided any of the additional complexity modules in the first place. I can't see why you'd put a facility that you want always loaded into a module.
Linux hotplug event system - I did a Google and discovered the http://linux-hotplug.sourceforge.net/ and also http://linux-usb.sourceforge.net/policy.html, which was rather more informative. Looks like I would need to emerge hotplug, which would enable me to have a script run whenever something new is plugged into the USB port. That script would presumably then recognise the camera and load the usb-storage module. But to be honest, I'm not sure this is really worth the bother.
Summary: unless there is a simpler way, I think I'll go back to compiling everything into the kernel and stop using modules. |
|
Back to top |
|
|
Naan Yaar Bodhisattva
Joined: 27 Jun 2002 Posts: 1549
|
Posted: Sun Aug 04, 2002 3:16 pm Post subject: |
|
|
To launch from the desktop, you can write a two liner script that insmod's and then mounts the device, I guess. You can make the application run as another user in kde. |
|
Back to top |
|
|
aardvark Guru
Joined: 30 Jun 2002 Posts: 576
|
Posted: Sun Aug 04, 2002 3:26 pm Post subject: |
|
|
Do you have "General->Support for hot-pluggable devices " enabled in your kernel? |
|
Back to top |
|
|
|