From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 2A0141381F3 for ; Fri, 30 Nov 2012 09:59:45 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9A597E02CE; Fri, 30 Nov 2012 09:59:25 +0000 (UTC) Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com [209.85.212.53]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B840621C010 for ; Fri, 30 Nov 2012 09:58:11 +0000 (UTC) Received: by mail-vb0-f53.google.com with SMTP id b23so12583047vbz.12 for ; Fri, 30 Nov 2012 01:58:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=shRTKVWJlib0A24M7P2q0E8ksR9rU83nvL1qJFrCb8U=; b=CS2v4xwOnmRFb9WAzgaDjZ4wFp4gZkhJ1LKr+xSzYIXMIRiyDFQEpKll2KfHQmikdO xNIMOhL3VJpVHEMh+3bhoGDke97CiaGUejWellCqztEV/KFYTtNQXgmGIGLqWAT+MvL3 UJVVjWrrEk/9MyErW99nW6smpT2WB3Z+CW5jmd/gzrnwlHZ6P8PeoE7lc/DgsPtsLXG1 R+ETbIJWS530OJRmj9okVE6N31e1ZwEKdJ5DbrRDr8kDtYUBmdpT5du0ZGCQi4aWGNA8 U8hEEkiHPel5FpRGWK2ZDD1dXeDLLtEwgztDiXDtzrfAmTKiD87KzrUzO4Ieaxc8Vv6V m/nA== Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Received: by 10.52.75.105 with SMTP id b9mr507963vdw.28.1354269490941; Fri, 30 Nov 2012 01:58:10 -0800 (PST) Received: by 10.58.223.170 with HTTP; Fri, 30 Nov 2012 01:58:10 -0800 (PST) In-Reply-To: <20121130030927.GA12990@waltdnes.org> References: <20121129192025.GO23914@server> <20121129223557.GA11921@waltdnes.org> <20121130030927.GA12990@waltdnes.org> Date: Fri, 30 Nov 2012 09:58:10 +0000 Message-ID: Subject: Re: [gentoo-user] serial in /sys From: Jorge Almeida To: gentoo-user@lists.gentoo.org Content-Type: text/plain; charset=ISO-8859-1 X-Archives-Salt: 5bce2216-1d90-4efb-9ffc-535c31fc50bf X-Archives-Hash: 0062169b9fe9f7a6519a3affe361da2b On Fri, Nov 30, 2012 at 3:09 AM, Walter Dnes wrote: > On Fri, Nov 30, 2012 at 12:28:01AM +0000, Jorge Almeida wrote > >> When a pen is inserted, this is what is set: >> >> DEVNAME=sdd > > This is almost exactly what I remember from when I was > writing/testing/debugging my automount scripts. The one difference I > remember is that when mdev handled it, there was no "DEVNAME" variable, > but rather it was "MDEV". But otherwise identical. Two important notes... Strange. The variable name is set by the kernel. Maybe you were using a patched kernel? > > 1) For a USB mass storage device (pen or external hard drive) with N > partitions, the hotplug handler will get N+1 events when inserting and > also when removing. E.g. if your pen drive has 3 partitions, you'll get > 4 events... Right. The helper program is launched 4 times and will create (or remove, depending on $ACTION) 4 symlinks. > > Would you be OK if the devices were always mounted in /media ? The > reason I ask is that my scripts use pmount, which can take an optional > label argument. E.g. if MDEV is "sdd1" > pmount looks a good idea for a many-users workstation. For a 1-user computer, there's no loss of functionality with sticking with fstab. > > Actually, if I was writing it, I would add a few lines to my script > for the "add" ACTION Sure, I just didn't mention it. > * label=${MDEV} > * look for a "serial" file in the PCI path of the newly-inserted device > * if found; then > grep through a textfile to match the contents of the "serial" file I thought of keeping data-- (key,value) = (serial_number, custom_name_of_device)-- in a cdb database. I think it is faster than reading a text file, and no parsing needed. It is also scalable (although this is probably irrelevant on a custom-workstation scale...). My (untested) program is about 11k, statically compiled. By the way, I don't suppose there is a mailing list to talk about these matters (mdev/ udev-alternative/ udev-fork related)? This is really distro-agnostic stuff... Thanks Jorge Almeida