Re: Plugging in USB devices
- From: Henrik Carlqvist <Henrik.Carlqvist@xxxxxxxxxxxx>
- Date: Tue, 20 Dec 2005 07:58:01 +0100
DBBu***@xxxxxxxxx wrote:
> My program can already see/read/write to a device if it's plugged in
> before I start the program. But, I need to be able to keep this program
> running always and if I plug in a new device, my program needs to
> realize that it's there. Is this possible in Linux?
Yes, it is possible. The best way would probably be to let hotplug send a
message in some way to your program.
> If I plug in a USB device, a message shows up in one of my terminals
> saying that a device has been plugged in. Is there a system wide
> message that is being sent that I can catch with my already running
> program? How can I go about this?
There is a program called dmesg which displays those messages. Maybe you
could borrow some code from dmesg.
However, I still think that hotplug would be a better solution. There is
some good documentation describing how to set up hotplug to change
permissions for a usb digital camera at
http://www.gphoto.org/doc/manual/permissions-usb.html . Changing
permissions is not what you want to do, but if you modify those scripts to
send a message to your program (maybe with a socket) I think that you have
accomplished what you want.
regards Henrik
--
The address in the header is only to prevent spam. My real address is:
hc7(at)uthyres.com Examples of addresses which go to spammers:
root@xxxxxxxxxxxxx root@localhost
.
- References:
- Plugging in USB devices
- From: DBBu***
- Plugging in USB devices
- Prev by Date: Re: doesn't print blue text in PDFs
- Next by Date: Re: Interrupt Processing
- Previous by thread: Plugging in USB devices
- Next by thread: Configuring hardware sensors on an Intel D865PERL motherboard
- Index(es):