How to chek if USB port is mounted in linux?

Discussion in 'C Programming' started by KimHoon, Sep 19, 2003.

  1. KimHoon

    KimHoon Guest

    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!
     
    KimHoon, Sep 19, 2003
    #1
    1. Advertising

  2. KimHoon <> 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 () ---------------------------\
    | 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
     
    Joona I Palaste, Sep 19, 2003
    #2
    1. Advertising

  3. KimHoon

    Clemens Auer Guest

    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" <> 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!
    >
    >
     
    Clemens Auer, Sep 19, 2003
    #3
  4. KimHoon

    LibraryUser Guest

    *** Rude and evil topposting corrected ***

    Clemens Auer wrote:
    > "KimHoon" <> 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.
     
    LibraryUser, Sep 19, 2003
    #4
  5. KimHoon

    Jack Klein Guest

    On Fri, 19 Sep 2003 08:45:31 +0200, Clemens Auer <>
    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
     
    Jack Klein, Sep 20, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dunce by face...
    Replies:
    1
    Views:
    675
    Dunce by face...
    Jan 19, 2006
  2. ad
    Replies:
    1
    Views:
    1,397
    =?Utf-8?B?c2VyZ2UgY2FsZGVyYXJh?=
    Jul 15, 2005
  3. Replies:
    3
    Views:
    373
    perchef
    Aug 16, 2005
  4. Almad
    Replies:
    1
    Views:
    270
    Almad
    Nov 6, 2006
  5. chek where mouse is

    , Apr 4, 2006, in forum: Javascript
    Replies:
    7
    Views:
    133
    Evertjan.
    Apr 5, 2006
Loading...

Share This Page