LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-17-2009, 01:12 AM   #1
gyuvarajan
LQ Newbie
 
Registered: Apr 2009
Posts: 6

Rep: Reputation: 0
USB Pendrive detection


Hi all,

I need to develop a SW in which the SW has to determine when any USB is connected,it has to identify and do the Read and write operation with the pendrive.
I have to identify the moment when pendrive is connected.System has no GUI only Black Box.
Im using RHEL with Kernel 2.6.18.

My question is how to identify if pendrive is connected.Is any System flag or some other thing will set In OS?

Please help me out to solve this problem



Many Thanks in Advance
Yuvi
 
Old 04-17-2009, 01:26 AM   #2
vibinlakshman
Member
 
Registered: Dec 2008
Location: Kerala, India
Distribution: Ubuntu 11.10
Posts: 334

Rep: Reputation: 33
Cool

Quote:
Originally Posted by gyuvarajan View Post
Hi all,

I need to develop a SW in which the SW has to determine when any USB is connected,it has to identify and do the Read and write operation with the pendrive.
I have to identify the moment when pendrive is connected.System has no GUI only Black Box.
Im using RHEL with Kernel 2.6.18.

My question is how to identify if pendrive is connected.Is any System flag or some other thing will set In OS?

Please help me out to solve this problem



Many Thanks in Advance
Yuvi
Definitely while external drives are plugged certain drivers are responsible for setting flags .. But i'm not quite sure which functions is invoked , either ioctl() or not .. Wait for others to reply

command lsusb is been invoked by surely a function which set flags ..
 
Old 04-17-2009, 01:39 AM   #3
hurry_hui
Member
 
Registered: Oct 2008
Location: Near Jakarta
Distribution: Slackware, Arch, Slax, Porteus, Tiny Core, Slitaz
Posts: 355
Blog Entries: 1

Rep: Reputation: 52
What you need is found in /etc/udev/rules.d .
 
Old 04-17-2009, 01:40 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You should provide more info such as which kernel you are using. The architecture, etc. The udevd daemon can be configured to launch a program, but this is better for short scripts.

You might want to look at ivman.
Code:
DETAILS
       Ivman is a flexible device manager, allowing users to run arbitrary commands when devices are added/removed, when  device  properties  change,  and  when
       devices emit conditions.
 
Old 04-17-2009, 01:50 AM   #5
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 61
Did your instructor implement a timeline for you and other students to draft a perspective?
 
Old 04-17-2009, 02:00 AM   #6
gyuvarajan
LQ Newbie
 
Registered: Apr 2009
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jschiwal View Post
You should provide more info such as which kernel you are using. The architecture, etc. The udevd daemon can be configured to launch a program, but this is better for short scripts.

You might want to look at ivman.
Code:
DETAILS
       Ivman is a flexible device manager, allowing users to run arbitrary commands when devices are added/removed, when  device  properties  change,  and  when
       devices emit conditions.
kernel used is 2.6.18.
Im very new to linux....what is Ivman
 
Old 04-17-2009, 02:03 AM   #7
gyuvarajan
LQ Newbie
 
Registered: Apr 2009
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Junior Hacker View Post
Did your instructor implement a timeline for you and other students to draft a perspective?
yes, i need to do this SW in 3 days.
 
Old 04-17-2009, 02:15 AM   #8
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Ivman will automount the pendrive or sdcard automatically and can be used to run an arbitrary script. It is lighter weight than udev/dbus/hal/polkit AFAIK. Your application sounds like either for an embedded device or kiosk or VAR system.

Look if your distro supplies it. On mine it is installed but not used by default.

I asked for the kernel version because isn't uncommon for embedded device to run a different architecture or use a 2.5 kernel which may not have udev or hal support.
 
Old 04-17-2009, 02:35 AM   #9
gyuvarajan
LQ Newbie
 
Registered: Apr 2009
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jschiwal View Post
Ivman will automount the pendrive or sdcard automatically and can be used to run an arbitrary script. It is lighter weight than udev/dbus/hal/polkit AFAIK. Your application sounds like either for an embedded device or kiosk or VAR system.

Look if your distro supplies it. On mine it is installed but not used by default.

I asked for the kernel version because isn't uncommon for embedded device to run a different architecture or use a 2.5 kernel which may not have udev or hal support.
It is for embedded device only.I have mentioned kernel version only.any way it is RHEL with Kernel 2.6
 
Old 04-18-2009, 12:49 AM   #10
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
No. It isn't only for embedded devices. It may be easier for you to use than configuring the dbus/hal/polkit services.
 
  


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 Pendrive detection gyuvarajan Linux - Newbie 3 04-18-2009 08:16 AM
Problem with usb pendrive and usb modem ZTE ZXDSL 852 AM33N Linux - Hardware 3 12-10-2008 03:25 AM
usb pendrive in dell inspiron with 8 usb ports sergioricardo Linux - Hardware 4 02-12-2008 11:05 AM
Conflicting USB mouse & usb pendrive on Slackware 11.0 aruntom55 Slackware 3 08-26-2007 01:34 AM
USB Pendrive d4d4n9 Mandriva 7 02-03-2004 08:44 PM

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

All times are GMT -5. The time now is 01:15 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