From mboxrd@z Thu Jan 1 00:00:00 1970 From: Date: Wed, 10 Oct 2007 05:38:52 +0000 Subject: Re: Unable to run a user program on usb device connection Message-Id: <747360.82589.qm@web51602.mail.re2.yahoo.com> List-Id: References: <527409.71590.qm@web51603.mail.re2.yahoo.com> In-Reply-To: <527409.71590.qm@web51603.mail.re2.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org Hi Nazim, Thank you for the suggestion. Yes I'm using montavista kernel, so tried whatever you suggested but without any success. The following are the steps I tried, 1)Modified the usb.usermap file in /etc/hotplug directory as follows =20 # For our device test.sh 0x0003 0x0451 0x97FB 0x0000 0x0000=20 0x00 0x00 0x00 0x00 0x00 0x00 =20 0x00000000 # Test for a USB mouse first test.sh 0x0003 0x0461 0x4D15 0x0000 0x0000=20 0x00 0x00 0x00 0x00 0x00 0x00 =20 0x00000000 =20 2)Wrote the test.sh to write a string =93Hello World=94 in a file debug_out (I=92m doing this because I was informed that in some kernels the echo statements from the scripts executed as part of hotplug are re-direceted to /dev/null. By doing this I can look at this debug_out file and ensure that whether our script is executed or not) and placed the script under /etc/hotplug, /etc/hotplug.d and /etc/hotplug.d/default. The following is the script =20 =20 echo =93Hello World=94 >> /debug_out =20 This was also not working. I'm running out of ideas now. Thanks one again. Warm Regards, Shankar=20 --- Nazim Khan wrote: > Hi Shankar, >=20 > If you are not using montavista kernel distribution, > then you should > follow the udev theory. >=20 > On Montavista kernel, udev does not work. > It supports the hotplug in a different way so you > don't need udevd and > its rules in /etc/udev. >=20 > Any kernel event is reported to user space first by > executing the > /sbin/hotplug script. > If your USB device is Memory Device(Flash/Disk) For > usb device, you > should have the following scripts (since mass > storage device appears > as SCSI devices) > /etc/hotplug.d/scsi/scsi.hotplug >=20 > For other USB devices you need to have appropriate > scripts in > /etc/hotplug.d/ folder. >=20 > Nazim >=20 >=20 >=20 >=20 >=20 > On 10/8/07, shankoo77@yahoo.com > wrote: > > Hi, > > Thanks for the suggestion, but it didn't work > for > > me. I'm working on ARM architecture and yes the > kernel > > detects device removal successfully. I get the > > following message on disconnecting a USB device > > > > usb 1-1: USB disconnect, address 2 > > > > Also already there is a shell script called > hotplug in > > the /sbin directory but its not called for some > > reason. > > > > I think (I'm not 100% sure though) the kernel code > > calls the user program whose path is stored in > > "/proc/sys/kernel/hotplug" whenever a hotplug > event > > happens. In my kernel this happens to be > > "/sbin/udevsend". If the kernel has to call > > /sbin/hotplug then I need to change this system > > variable mentioned above to /sbin/hotplug. I tried > > doing this but I was unable to change it (I'm root > in > > the platform). I tried without changing this also > > without any success. By looking at all the > documents I > > read, it sounds to me that if hot plug is enabled > in > > the kernel then by default it'll call the program > > whose path info is stored in > > "/proc/sys/kernel/hotplug". I think for some > reason > > thats not happening with my setup. > > > > Warm Regards, > > Shankar > > > > --- =BD=F0=C8=DA =D0=BB wrote: > > > > > > > > You can put "hotplug" script under directory > /sbin/ > > > . It can be invoked once the kernel detects that > > > your usb device has been pluged in. So, put > > > whatever shell script you want to invoke into > this > > > service script. Note, make sure the file name of > the > > > service script under /sbin/ is "hotplug", not > > > anythis else. The system will automatically call > > > this file once you attach a usb device to your > > > system. > > > By the way, can your system detect the removal > event > > > once you remove the usb device? Did the terminal > > > promt out some information about the > disconnection > > > of the usb device? What is your hardware > > > architecture=A3=BF> Date: Sun, 7 Oct 2007 21:10:50 > > > -0700> From: shankoo77@yahoo.com> Subject: > Unable to > > > run a user program on usb device connection> To: > > > linux-hotplug-devel@lists.sourceforge.net> > > Hi,> > > > I'm a newbie to Linux hotplug sub-system. > Please> > > > excuse me if the question is very basic. I want> > to > > > hook a user space application with the hot plug> > > > sub-system in such a way that the application > is> > > > executed on attaching a specific USB device. > I've> > > > explained what all I tried below, please let me > > > know> where I'm going wrong.> > My linux kernel > > > version is 2.6.10 and it uses the> =A1=B0udev=A1=B1 > > > mechanism to support hot plug. Our application> > > > should be executed when a device with a > specific> > > > vendor id and product id is plugged in the USB > bus.> > > > I=A1=AFve enabled the hot plug support in the > kernel; > > > in> fact by default CONFIG_HOTPLUG was enabled. > I > > > included> a test.rules file in the > > > /etc/udev/rules.d/ directory> in which I have > > > included the above mentioned vendor> id, product > id > > > and in the PROGRAM parameter the name> of the > > > application to be run. To start with, this> > program > > > is just a shell script that prints =A1=B0Hello> > World=A1=B1 > > > on the console. After this, when we plug in the> > > > above mentioned device I=A1=AFm sure that the kernel > > > has> detected it because I=A1=AFm seeing the > device=A1=AFs> > > > information in /proc/bus/usb/devices. But our > shell> > > > script is not getting called at all. Can some > one > > > let> me know what I'm missing here? The > test.rules > > > file> contains the following line only> > > > > ATTR{idVendor}=3D"0451", > ATTR{idProduct}=3D"97fb",> > > > SYMLINK+=3D"hello-%k", MODE=3D"666",> > > > PROGRAM=3D"/home/shankar/usb_disp.sh"> > Please > help > > > me in getting this sorted out.> > Thanks in > > > Advance,> Shankar > > > > > > > > > > ___________________________________________________________________________= _________> > > > Be a better Heartthrob. Get better relationship > > > answers from someone who knows. Yahoo! Answers - > > > Check it out. > > > > > > > http://answers.yahoo.com/dir/?link=3Dlist&sid96545433> > > > > > > > > > > -------------------------------------------------------------------------> > > > This SF.net email is sponsored by: Splunk Inc.> > > > Still grepping through log files to find > problems? > > > Stop.> Now Search log events and configuration > files > > > using AJAX and a browser.> Download your FREE > copy > > > of Splunk now >> http://get.splunk.com/> > > > _______________________________________________> > > > 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 > > > > > > _________________________________________________________________ > > > Invite your mail contacts to join your friends > list > > > with Windows Live Spaces. It's easy! > > > > > > http://spaces.live.com/spacesapi.aspx?wx_action=3Dcreate&wx_url=3D/friends.= aspx&mkt=3Den-us > > > > > > > > > > > ___________________________________________________________________________= _________ > > Pinpoint customers who are looking for what you > sell. > > http://searchmarketing.yahoo.com/ > > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. > > Still grepping through log files to find problems? > Stop. > > Now Search log events and configuration files > using AJAX and a browser. >=20 =3D=3D message truncated =3D _____________________________________________________________________= _______________ Check out the hottest 2008 models today at Yahoo! Autos. http://autos.yahoo.com/new_cars.html ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ 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