-   Linux - Kernel (
-   -   driver for a device in linux (

karan2386 04-24-2012 02:09 PM

driver for a device in linux
I am making a usb module in which I am reading and writing from pen drive. Further its compiled with no errors and when I install the driver it still doesnt work. I know there would be a driver for controlling the device(pen drive) but HOW SHOULD I LOOK FOR THAT DRIVER SO THAT I CAN UNLOAD THE DRIVER AND USE MINE.

Didier Spaier 04-24-2012 03:57 PM

kam, you don't have to capitalize your sentences for them to be read, it's like shouting.

'rmmod usb_storage' will do what you want. Or you can blacklist usb_storage, or recompile your kernel without it.

PS Sorry to be rude, but if you are not able to find such an information by yourself, how come you are able to write a Linux driver?

karan2386 04-25-2012 12:26 AM

Didier,do you think i havn't done that ..... I have but its giving me message as follow
ERROR: Module usb_storage does not exist in /proc/modules
and secondly i was following an example .

PS: Sorry to be rude and for copying your line but Please only reply if you could solve the doubts.There is no need to comment about the issues which is none of your buisness.

Didier Spaier 04-25-2012 12:31 AM


Originally Posted by karan2386 (Post 4662346)
ERROR: Module usb_storage does not exist in /proc/modules

May be the driver is not configured as a module, but built-in your kernel? I would check the .config file to make sure.

Didier Spaier 04-25-2012 12:48 AM

BTW something is funny: here (with usb_storage compiled as a module), if I plug-in an USB key and type 'rmmod usb-storage' it works, though the USB key be still attached, but if I type 'rmmod usb_storage' it says 'ERROR: Module usb_storage is in use', which is correct.

Back to the topic, I guess that you have a proc file system, do you? Just wondering, as /proc is in the process of being obsoleted by /sys, may be some day rmmod should relate on a sys structure instead of /proc...

sundialsvcs 04-25-2012 08:11 AM

Okay, I see a couple of possible issues that could be contributing. (And, hey everybody, let's all just be cool here.)

The first question is, whether the module is set up to be loaded automatically (hotplug...), and if it can in fact be loaded, and if the module that you think you're loading actually is the one that is. Some modules are designed to printk() a message to the system console-log when they're loaded or unloaded, just for this reason. Try explicitly loading and unloading it by hand.

Then, the USB device signature is used both by hotplug and (should be...) by the driver to recognize the device that the driver's supposed to be loaded-for and then attached-to.

I always approach debugging tasks like this in more or less the same way: put a debugging symbol with conditional #defines that cause a bunch of messages to be spewed out to the system console log, as the module gives a "play by play account" of exactly what it's doing. (This usually is quickly followed by "d'oh!" :redface: )

anil_pugalia 07-10-2012 01:59 AM

Karan, the usb-storage driver is showing "in use" because when you insert a pen drive, nowadays it gets auto-mounted. So, just umount that and then do a rmmod usb_storage, and then you should load the driver you are playing with. With that you should get the results as expected.

All times are GMT -5. The time now is 03:16 PM.