LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 01: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, 01:40 AM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
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, 01: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, 01: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, 03:37 AM   #5
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
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, 11:11 AM   #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, 11:52 AM   #7
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

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


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:07 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
Open Source Consulting | Domain Registration