LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 01-12-2011, 07:43 PM   #1
falmdavis
Member
 
Registered: Jul 2010
Posts: 56

Rep: Reputation: 15
USB kernel module, how functions get called by kernel


The USB kernel module is called "ums-usbat,ko" for the 2.6.37 kernel found from www.kernel.org. The source file is "shuttle_usbat.c" which is in linux-2.6.37/drivers/usb/storage directory. It depends on usb-storage.

Much of this will be beginning questions about how the functions get called in the kernel module. In the source file, there are many functions. When the module is inserted, the

Code:
static int __init usbat_init(void)
{
        return usb_register(&usbat_driver);
}
init function is called. When the module is removed, the

Code:
static void __exit usbat_exit(void)
{
        usb_deregister(&usbat_driver);
}
exit function is called. What makes the other functions get called? How can I call one of the functions?

There is also a macro called US_DEBUG. It is defined somewhere else, maybe in the kernel tree. How can I turn this on/off? I am building the module on its own.

When I plug in an RCA k@zoo mp3 player, it does not create a scsi device. How can I find out if the functions are getting called?

What could I do to try to read the device:
Quote:
usb 3-1: New USB device found, idVendor=069b, idProduct=2220
usb 3-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
usb 3-1: usb_probe_device
usb 3-1: configuration #1 chosen from 1 choice
usb 3-1: adding 3-1:1.0 (config #1, interface 0)
drivers/usb/core/inode.c: creating file '004'
hub 3-0:1.0: state 7 ports 2 chg 0000 evt 0002
hub 1-0:1.0: hub_suspend
usb usb1: bus auto-suspend
ehci_hcd 0000:00:10.4: suspend root hub
 
Old 01-18-2011, 01:58 PM   #2
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Quote:
Originally Posted by falmdavis View Post
What makes the other functions get called? How can I call one of the functions?
http://tldp.org/HOWTO/Module-HOWTO/x627.html This might be of some use to both of us. Can you give an example of a function which you wonder how s getting called? Point out to the source too.

Quote:
Originally Posted by falmdavis View Post
How can I find out if the functions are getting called?
Try dmesg or printk.
 
  


Reply

Tags
kernel module



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
loadable kernel module compilation error for SHA1 functions nikhil86 Programming 1 03-25-2008 09:08 PM
warning undefined functions.....doing kernel module programing swift_a2002 Programming 10 05-24-2007 11:50 AM
LXer: Howto: build Linux kernel module against installed kernel w/o full kernel source tree LXer Syndicated Linux News 0 09-03-2006 08:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 09:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration