LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 04-14-2010, 02:33 AM   #1
chaitalil
LQ Newbie
 
Registered: Apr 2010
Posts: 4

Rep: Reputation: 0
Question detection of a device when plugged through USB port


can any one tell me detection code of device when an external device is connected through USB port. please help me....
 
Old 04-14-2010, 02:40 AM   #2
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,591

Rep: Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244
I guess udev is what you are looking for (but since your question is a bit vague I can't be sure).

Evo2.
 
Old 04-14-2010, 02:57 AM   #3
chaitalil
LQ Newbie
 
Registered: Apr 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Smile hi.

Thank you for your suggesion.
Actually i want to know that if a pen drive is plugged in the USB port then how the detection is handeled by the OS. Is there any specific code for detection external device? Can i get that code anyways?

Regrads,
Chaitali Lokhande.
 
Old 04-14-2010, 02:59 AM   #4
chaitalil
LQ Newbie
 
Registered: Apr 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by evo2 View Post
I guess udev is what you are looking for (but since your question is a bit vague I can't be sure).

Evo2.
Thank you for your suggesion.
Actually i want to know that if a pen drive is plugged in the USB port then how the detection is handeled by the OS. Is there any specific code for detection external device? Can i get that code anyways?

Regrads,
Chaitali Lokhande.
 
Old 04-14-2010, 04:37 AM   #5
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,591

Rep: Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244
Hmm, you talk about "OS": perhaps you are referring to the kernel. In that case, hotplug is what you are interested in. The code is in the kernel source.

Evo2.
 
Old 02-12-2013, 12:11 PM   #6
suuvan
LQ Newbie
 
Registered: Feb 2013
Posts: 2

Rep: Reputation: Disabled
I guess if I can give you some hint here. Once USP port plug in, the USB controller detect and read low level info like,
VendorID, ProductID then it send to USB-core code, look for it. USB-core will send info to Kernel, Kernel will search, in this case I believe is USB_HID category, for the match ProductIS and VendorID to luanch the driver to handle that specific device.
In your case is Pendrive. From there you can search and go on.... Udev and Udev rules will involve at some point. good luck.
 
Old 02-12-2013, 12:52 PM   #7
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,582

Rep: Reputation: 480Reputation: 480Reputation: 480Reputation: 480Reputation: 480
what exactly are you trying to accomplish?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
USB device plugged in at boot is not detected knobby67 Linux - Hardware 2 04-12-2008 05:54 AM
FAT32 hd failure -plugged usb device Jose Rivas Fedora 2 04-03-2008 04:25 PM
How to detect programatically if a USB device is is plugged-in / plugged out? franc Linux - Software 3 02-01-2007 05:01 AM
how to know a usb device is plugged in/out lordofring Linux - Software 2 04-25-2005 02:15 PM
Why does PC hang when USB device is plugged in? DeepSPiN Fedora 1 12-03-2003 11:59 AM


All times are GMT -5. The time now is 10:25 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration