From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Fri, 05 Dec 2003 11:55:23 +0000 Subject: Re: register to get notified with hotplug? MIME-Version: 1 Content-Type: multipart/mixed; boundary="Dxnq1zWXvFF0Q93v" Message-Id: List-Id: References: In-Reply-To: To: linux-hotplug@vger.kernel.org --Dxnq1zWXvFF0Q93v Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Dec 05, 2003 at 08:41:20PM +0900, Quynh Nguyen Anh wrote: > hello, > > i want to write a program that get notified when a usb device (exactly a > usb memory key) is plugged into the usb port of the machine. i guess > hotplug fits this job well. > > but i dont know how to register my program to hotplug, so it can be > notified. may you please show me the way? (it is best to have some > examples or source codes) Just put two files into /etc/hotplug/usb/*. Hotplug will read the *.usermap and if it matches the USB device it calls given script. Here is a simple example i use for my DigiCam. Kay --Dxnq1zWXvFF0Q93v Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="canon.usermap" canon 0x0003 0x04a9 0x3056 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 --Dxnq1zWXvFF0Q93v Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename=canon #!/bin/sh /usr/bin/logger -t $0 "found Canon $PRODUCT at $DEVICE" chown kay:kay $DEVICE --Dxnq1zWXvFF0Q93v-- ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel