From owner-freebsd-usb@FreeBSD.ORG Wed May 6 22:09:50 2009 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75465106567B for ; Wed, 6 May 2009 22:09:50 +0000 (UTC) (envelope-from jhs@berklix.org) Received: from flat.berklix.org (flat.berklix.org [83.236.223.115]) by mx1.freebsd.org (Postfix) with ESMTP id EBC788FC17 for ; Wed, 6 May 2009 22:09:49 +0000 (UTC) (envelope-from jhs@berklix.org) Received: from js.berklix.net (p549A2CEE.dip.t-dialin.net [84.154.44.238]) (authenticated bits=0) by flat.berklix.org (8.13.8/8.13.8) with ESMTP id n46M9kTP086835; Thu, 7 May 2009 00:09:47 +0200 (CEST) (envelope-from jhs@berklix.org) Received: from fire.js.berklix.net (fire.js.berklix.net [192.168.91.41]) by js.berklix.net (8.13.8/8.13.8) with ESMTP id n46M9a4w009807; Thu, 7 May 2009 00:09:36 +0200 (CEST) (envelope-from jhs@berklix.org) Received: from fire.js.berklix.net (localhost [127.0.0.1]) by fire.js.berklix.net (8.14.3/8.14.3) with ESMTP id n46M9Bxa022017; Thu, 7 May 2009 00:09:16 +0200 (CEST) (envelope-from jhs@fire.js.berklix.net) Message-Id: <200905062209.n46M9Bxa022017@fire.js.berklix.net> To: freebsd-usb@freebsd.org From: "Julian Stacey" Organization: http://berklix.com BSD Unix Linux Consultancy, Munich Germany User-agent: EXMH on FreeBSD http://berklix.com/free/ X-URL: http://berklix.com In-reply-to: Your message "Wed, 06 May 2009 19:39:11 +0300." <4A01BD2F.40409@icyb.net.ua> Date: Thu, 07 May 2009 00:09:11 +0200 Sender: jhs@berklix.org Cc: Andriy Gapon Subject: Re: devd automatic conversion of umass[0-9] to da[0-9] X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 May 2009 22:09:50 -0000 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