How to chek if USB port is mounted in linux?

K

KimHoon

I want to know how to check if USB port is mounted...

I programmed some sources , which run to read data-files in usb storage.

And I have no input systems; no keyboard, no mouse, no touchpad screen...

I want immediately to stop running my program when I disconnect USB port
physically.

In this point, the program is checking in every 3 seconds whether USB is
mounted.

If USB is connected and mounted, programs continue running and if not, they
must be stoped automatically.

Everything is OK but checking USB port.

How can I program in C?

Please show me the sources in C...

Thanks with God!
 
J

Joona I Palaste

KimHoon said:
I want to know how to check if USB port is mounted...

That can't be done in ISO standard C. Please ask in a newsgroup
dedicated to your own implementation.

--
/-- Joona Palaste ([email protected]) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"How come even in my fantasies everyone is a jerk?"
- Daria Morgendorfer
 
C

Clemens Auer

you can check for the specific files in the /proc file system od also in
the /sys filesystem on 2.6 kernels ..
or you play a bit with iocntrl ind it should provide the same ..

btw.
whe 2.6serie of the linux kernel provides a feature that does exactly
the same you want to do.. somewhere in the security chapter of the
kernel config...
so maybe look at that piece of code ..
 
L

LibraryUser

*** Rude and evil topposting corrected ***

Clemens said:
.... snip ...

you can check for the specific files in the /proc file system od
also in the /sys filesystem on 2.6 kernels ..
or you play a bit with iocntrl ind it should provide the same ..

btw.
whe 2.6serie of the linux kernel provides a feature that does
exactly the same you want to do.. somewhere in the security
chapter of the kernel config...
so maybe look at that piece of code ..

There are two major problems with your reply. First, it is
topposted, which is not condoned in c.l.c. Second, it is
off-topic, as was the original query. Such queries should be
answered only with redirection to an appropriate group. The
reason is that erroneous responses will not get corrected (there
is nobody here to do it, at least in theory), and that such
responses encourage more off-topic traffic.
 
J

Jack Klein

you can check for the specific files in the /proc file system od also in
the /sys filesystem on 2.6 kernels ..
or you play a bit with iocntrl ind it should provide the same ..

This is comp.lang.c, not a Linux newsgroup. Please don't post such
off-topic gibberish here. There is no such thing as a "/sys" or
"/proc" file system in the C language.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top