473,325 Members | 2,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

How to chek if USB port is mounted in linux?

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!
Nov 13 '05 #1
4 9956
KimHoon <ki*******@sayclub.com> scribbled the following:
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 (pa*****@cc.helsinki.fi) ---------------------------\
| 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
Nov 13 '05 #2
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 ..
On Fri, 19 Sep 2003 15:15:37 +0900
"KimHoon" <ki*******@sayclub.com> wrote:
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!

Nov 13 '05 #3
On Fri, 19 Sep 2003 08:45:31 +0200, Clemens Auer <fo*****@gmx.net>
wrote in comp.lang.c:
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
Nov 13 '05 #4
*** Rude and evil topposting corrected ***

Clemens Auer wrote:
"KimHoon" <ki*******@sayclub.com> wrote:
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...
.... 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.

--
Replies should be to the newsgroup
Chuck Falconer, on vacation.
Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: ^CeFoS^ | last post by:
Hello to everybody, I've done an application that draws in a frame the trajectory of a robot. The robot position is readed through the serial port, and several commands are wrote through the...
4
by: Eric Haskins | last post by:
I had a server lose a drive. This customer didnt back his database. I mounted old failing drive as a slave and can see .frm .MYI & .MYD But if I copy them to /var/lib/mysql/db_name it says .frm...
3
by: rusttree | last post by:
Many moons ago, I took a class in embedded control at school. The course focused on a micro-controller mounted on a small electric car that was programmed using simple C code. The...
4
by: Paul Reddin | last post by:
Hi, Please don't throw your hands up immediately and quote me "this is not supported" etc .... I have a "temporary need" to move our DEVELOPMENT databases off our SAN and onto an NFS...
9
by: Jimmy | last post by:
Hi, this isn't really a C question, but I do not know where else to turn to. Can anyone please tell me how to get the port number for com port 1 and com port 2? I tried searching the web but...
0
by: collinm | last post by:
hi we use linux and c language under bash i do echo -e \\000\\000\\000\\000\000\\001Z00\\002AA LINUX \\004 >/dev/ttyS1 that send command to a led display (alpha sign communication)
2
by: yogesh | last post by:
i developing a game in c++, for that i got the socket program is working successfull in freebsd , but the same program is shifted to the Redhat linux 9.0 . i change the ip address and the port...
2
ronnil
by: ronnil | last post by:
Hi First of all, let me say that I'm fairly new to Linux. My problem is that I'm not entirely able to uninstall windows partially because I need to debug webpages in MSIE. So what i would like...
1
by: Sanjuro | last post by:
Recently read an article by Felix Lee: Setting up DB2 for UNIX and Linux on NFS mounted file systems ( http://tinyurl.com/yuxbk3 ). I was wondering why would anyone want to setup things like...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.