Find the answer to your Linux question:
Results 1 to 4 of 4
Hi All, How do i detect insertion/removal of external devices like SD card, USB devices etc., in my program, which should be running in thread. If single API is available, ...
  1. #1
    Just Joined!
    Join Date
    Jul 2009
    Posts
    3

    Lightbulb How do i detect insertion/removal of devices?

    Hi All,

    How do i detect insertion/removal of external devices like SD card, USB devices etc., in my program, which should be running in thread. If single API is available, it will be too good. Otherwise, please suggest me the how to achieve that.

    Regards,
    Pramod

  2. #2
    Linux Guru
    Join Date
    Nov 2004
    Posts
    6,110
    Hardware detection and management is handled by udev. You might want to add rules to udev to talk to your application which is the most direct way or alternatively you can directly look at kernel messages/dmesg to detect any change.

  3. #3
    Just Joined!
    Join Date
    Jul 2009
    Posts
    3
    Can u please help me for coding?

  4. #4
    Linux Guru
    Join Date
    Nov 2004
    Posts
    6,110
    There's a lot to it and I've only had a brief encounter with creating rules. I'd recommend you have a read up on the system and how to built udev rules:

    Writing udev rules

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...