From owner-freebsd-questions@FreeBSD.ORG Wed May 13 06:43:56 2015 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 36217C62 for ; Wed, 13 May 2015 06:43:56 +0000 (UTC) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF094151E for ; Wed, 13 May 2015 06:43:55 +0000 (UTC) Received: from r56.edvax.de (port-92-195-97-206.dynamic.qsc.de [92.195.97.206]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx01.qsc.de (Postfix) with ESMTPS id 587763CE57 for ; Wed, 13 May 2015 08:43:52 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id t4D6hpCG004153 for ; Wed, 13 May 2015 08:43:51 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Wed, 13 May 2015 08:43:51 +0200 From: Polytropon To: FreeBSD Questions Subject: Using SD cards with automount / GUI notification Message-Id: <20150513084351.2be8f6fa.freebsd@edvax.de> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2015 06:43:56 -0000 What is the recommended use of built-in card readers in combination with device (and media) autodetection, followed by notification services (such as employed by desktop environments to make icons pop up)? This is essential for automount functionality that users (in single-user single-PC contexts) usually rely on. Think of how Gnome (as a "simple" example) handles removable devices. I'm asking because of the required "re-tasting" of the devices and how it fits into that concept. Initially, the device files corresponding to the different card slots are present: /dev/da[0-2] in this example. # camcontrol devlist at scbus0 target 0 lun 0 (pass0,cd0) at scbus3 target 0 lun 0 (da0,pass1) at scbus3 target 0 lun 1 (da1,pass2) <- at scbus3 target 0 lun 2 (da2,pass3) And therefore: # ls /dev/da* /dev/da0 /dev/da1 /dev/da2 After inserting a SD card into the SD card reader (which is /dev/da1 here), nothing happens. That's why: # true > /dev/da1 And suddenly: # ls /dev/da* /dev/da0 /dev/da1 /dev/da1s1 /dev/da2 Now possible: # mount /media/sd The SD card can be accessed (due to the entry in /etc/fstab which specifies the required options); in this case /dev/da1s1 will be mounted at /media/sd as msdosfs with the options set of rw,noauto,noatime,-m=644,-M=755. When done: # umount /media/sd The card is then removed. But the device file shown above (/dev/da1s1) isn't removed, even after "re-tasting" it keeps being present: # ls /dev/da* /dev/da0 /dev/da1 /dev/da1s1 /dev/da2 # true > /dev/da1 /dev/da1: Device not configured. # ls /dev/da* /dev/da0 /dev/da1 /dev/da1s1 /dev/da2 My questions so far: 1. In order to get the notification mechanism working for card readers, is it acceptable to do "true > true > /dev/da[0-2]" in a repeated manner, let's say, every 10 seconds (because users don't want to waste time waiting)? Is this better being done with a /etc/rc.local "hack" or via cron? 2. How to deal with the notification when the card disappears? 3. Does using the presence of labels (not tested here) offer a better approach? I will be thankful for any insight in this strange topic. :-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...