Date: Thu, 07 May 2009 00:09:11 +0200 From: "Julian Stacey" <jhs@berklix.org> To: freebsd-usb@freebsd.org Cc: Andriy Gapon <avg@icyb.net.ua> Subject: Re: devd automatic conversion of umass[0-9] to da[0-9] Message-ID: <200905062209.n46M9Bxa022017@fire.js.berklix.net> In-Reply-To: Your message "Wed, 06 May 2009 19:39:11 %2B0300." <4A01BD2F.40409@icyb.net.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
Andriy Gapon wrote: > on 06/05/2009 18:27 Julian Stacey said the following: > > Config below works for a number of memory sticks simultaneously; > > But if one already has a dvd burner plugged in, > > then it fails as devd sees (in case of a first memory stick) a new umass1. > > Although /dev/da0* get created, devd tries to access non existant da1*. > > Any ideas how to improve this ? ( Using 7.1-RELEASE ) > > You could try to watch for cdev events (i.e. creation of daX device nodes) instead > of driver events. But I am not sure if cdev events are in 7.1, they are definitely > in 7.2: > > notify 1000 { > match "system" "DEVFS"; > match "subsystem" "CDEV"; > match "type" "CREATE"; > match "cdev" "^da[0-9]+$"; > action "echo 't120o3l32 b>c+f+16' > /dev/speaker"; > }; Thanks Andriy, cdev seems to be in 7.1, but I switched to test on a 7.2-RELEASE host: It did not work. cdev is not set at attach time. only available later, as shown below: With conf: ---------- action "sleep 2; \ rm -f /devusb/kingston; touch /tmp/devd-debug/xx.$cdev ; \ ln -s /dev/`echo $device-name|sed -e s/umass/da/`a \ /devusb/kingston; \ fsck -y -t ufs /devusb/kingston; \ mount -t ufs -o noatime /devusb/kingston /usb/kingston" ; }; ---------- Devd output: Executing 'sleep 2; rm -f /devusb/kingston; touch /tmp/devd-debug/xx. ; ln -s /dev/`echo umass0|sed -e s/umass/da/`a /devusb/kingston; fsck -y -t ufs /devusb/kingston; mount -t ufs -o noatime /devusb/kingston /usb/kingston' ** /devusb/kingston ** Last Mounted on /usb/kingston ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cyl groups 2 files, 1 used, 242418 free (18 frags, 30300 blocks, 0.0% fragmentation) Popping table Processing event '!system=DEVFS subsystem=CDEV type=CREATE cdev=pass1' Pushing table setting system=DEVFS setting subsystem=CDEV setting type=CREATE setting cdev=pass1 Processing notify event Popping table Processing event '!system=DEVFS subsystem=CDEV type=CREATE cdev=da0' ls -l /tmp/devd-debug -rw-r--r-- 1 root wheel 0 May 6 22:52 xx. Using your idea of alternate conf with notify instead of attach: notify 1000 { match "system" "DEVFS"; match "subsystem" "CDEV"; match "type" "CREATE"; match "cdev" "^da[0-9]+$"; action "touch /tmp/devd-debug/xx.cdev.$cdev \ /tmp/devd-debug/xx.vendor.$vendor" ; }; ls -l /tmp/devd-debug -rw-r--r-- 1 root wheel 0 May 6 23:56 xx.cdev.da0 -rw-r--r-- 1 root wheel 0 May 6 23:56 xx.vendor. In case of notigy, devd has the reverse of attach: $cdev is now set & available, $vendor is not available. I want to have all of $vendor, $product $sernum etc _And_ $cdev so I can automatically mount sticks to known paths ( sticks being inserted at random timing relative to each other, & not doing anything dirty with eg which port connected ). Anyone got ideas how to achieve this ? Cheers, Julian -- Julian Stacey: BSDUnixLinux C Prog Admin SysEng Consult Munich www.berklix.com Mail plain ASCII text. HTML & Base64 text are spam. www.asciiribbon.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905062209.n46M9Bxa022017>