Hi FreeBSD community The SCSI device (eg. da1s1) is not created automatically upon a CF card plug in on an USB multi-card reader on FreeBSD 7.2 (i386) but the SCSI device (eg. da1s1) is created automatically if I reboot the computer while the CF card is plug in. Here are detail: $ camcontrol devlist <GENERIC USB Storage-SMC 010D> at scbus0 target 0 lun 0 (pass0,da0) <GENERIC USB Storage-CFC 010D> at scbus0 target 0 lun 1 (pass1,da1) <GENERIC USB Storage-MMC 010D> at scbus0 target 0 lun 2 (pass2,da2) <GENERIC USB Storage-MSC 010D> at scbus0 target 0 lun 3 (pass3,da3) After the CF card is plugged in: $ ls -l /dev/ | grep da crw-r----- 1 root operator 0, 105 Jul 22 13:18 da0 crw-r----- 1 root operator 0, 106 Jul 22 13:18 da1 crw-r----- 1 root operator 0, 107 Jul 22 13:18 da2 crw-r----- 1 root operator 0, 108 Jul 22 13:18 da3 After reboot while the CF card is plugged in: $ ls -l /dev/ | grep da crw-r----- 1 root operator 0, 105 Jul 22 13:24 da0 crw-r----- 1 root operator 0, 106 Jul 22 13:24 da1 crw-r----- 1 root operator 0, 110 Jul 22 13:24 da1s1 crw-r----- 1 root operator 0, 107 Jul 22 13:24 da2 crw-r----- 1 root operator 0, 108 Jul 22 13:24 da3 My questions in this regards are: 1. Is this an error/bug in FreeBSD 7.2? 2. Or, does it require some configuration tweak? If this is an error/bug in FreeBSD 7.2, could somebody please develop a patch against the FreeBSD 7.2 sources? Kind regards Sagara
On Wednesday 22 July 2009 04:20:27 Sagara Wijetunga wrote:> Hi FreeBSD community > > The SCSI device (eg. da1s1) is not created automatically upon a CF card > plug in on an USB multi-card reader on FreeBSD 7.2 (i386) but the SCSI > device (eg. da1s1) is created automatically if I reboot the computer while > the CF card is plug in. > > Here are detail: > $ camcontrol devlist > <GENERIC USB Storage-SMC 010D> at scbus0 target 0 lun 0 (pass0,da0) > <GENERIC USB Storage-CFC 010D> at scbus0 target 0 lun 1 (pass1,da1) > <GENERIC USB Storage-MMC 010D> at scbus0 target 0 lun 2 (pass2,da2) > <GENERIC USB Storage-MSC 010D> at scbus0 target 0 lun 3 (pass3,da3) > > After the CF card is plugged in: > $ ls -l /dev/ | grep da > crw-r----- 1 root operator 0, 105 Jul 22 13:18 da0 > crw-r----- 1 root operator 0, 106 Jul 22 13:18 da1 > crw-r----- 1 root operator 0, 107 Jul 22 13:18 da2 > crw-r----- 1 root operator 0, 108 Jul 22 13:18 da3 > > After reboot while the CF card is plugged in: > $ ls -l /dev/ | grep da > crw-r----- 1 root operator 0, 105 Jul 22 13:24 da0 > crw-r----- 1 root operator 0, 106 Jul 22 13:24 da1 > crw-r----- 1 root operator 0, 110 Jul 22 13:24 da1s1 > crw-r----- 1 root operator 0, 107 Jul 22 13:24 da2 > crw-r----- 1 root operator 0, 108 Jul 22 13:24 da3 > > My questions in this regards are: > 1. Is this an error/bug in FreeBSD 7.2? >This is known limitation of, I think, GEOM stack.> 2. Or, does it require some configuration tweak? >After plugging in your CF card, issue true > /dev/da1 command. After writing zero bytes (nothing gets actually written into your media, thus it is not changed at all) GEOM reads some data from media and creates desired device(s). Regards, Milan
Milan Obuch writes:> On Wednesday 22 July 2009 04:20:27 Sagara Wijetunga wrote: >> Hi FreeBSD community >> >> The SCSI device (eg. da1s1) is not created automatically upon a CF card >> plug in on an USB multi-card reader on FreeBSD 7.2 (i386) but the SCSI >> device (eg. da1s1) is created automatically if I reboot the computer while >> the CF card is plug in. >> >> Here are detail: >> $ camcontrol devlist >> <GENERIC USB Storage-SMC 010D> at scbus0 target 0 lun 0 (pass0,da0) >> <GENERIC USB Storage-CFC 010D> at scbus0 target 0 lun 1 (pass1,da1) >> <GENERIC USB Storage-MMC 010D> at scbus0 target 0 lun 2 (pass2,da2) >> <GENERIC USB Storage-MSC 010D> at scbus0 target 0 lun 3 (pass3,da3) >> >> After the CF card is plugged in: >> $ ls -l /dev/ | grep da >> crw-r----- 1 root operator 0, 105 Jul 22 13:18 da0 >> crw-r----- 1 root operator 0, 106 Jul 22 13:18 da1 >> crw-r----- 1 root operator 0, 107 Jul 22 13:18 da2 >> crw-r----- 1 root operator 0, 108 Jul 22 13:18 da3 >> >> After reboot while the CF card is plugged in: >> $ ls -l /dev/ | grep da >> crw-r----- 1 root operator 0, 105 Jul 22 13:24 da0 >> crw-r----- 1 root operator 0, 106 Jul 22 13:24 da1 >> crw-r----- 1 root operator 0, 110 Jul 22 13:24 da1s1 >> crw-r----- 1 root operator 0, 107 Jul 22 13:24 da2 >> crw-r----- 1 root operator 0, 108 Jul 22 13:24 da3 >> >> My questions in this regards are: >> 1. Is this an error/bug in FreeBSD 7.2? >> > > This is known limitation of, I think, GEOM stack. > >> 2. Or, does it require some configuration tweak? >> > > After plugging in your CF card, issue > > true > /dev/da1 > > command. After writing zero bytes (nothing gets actually written into your > media, thus it is not changed at all) GEOM reads some data from media and > creates desired device(s). >Hi Milan, thanks for the reply. Yep, your suggestion works but it simply unacceptable for end users. We are the makers of the Tomahawk Desktop (http://www.tomahawkcomputers.com/). Anybody in the FreeBSD community care to develop a patch to make it possible to use multi-card readers under FreeBSD? Best regards Sagara
Milan Obuch wrote:> On Wednesday 22 July 2009 04:20:27 Sagara Wijetunga wrote: >> Hi FreeBSD community >> >> The SCSI device (eg. da1s1) is not created automatically upon a CF card >> plug in on an USB multi-card reader on FreeBSD 7.2 (i386) but the SCSI >> device (eg. da1s1) is created automatically if I reboot the computer while >> the CF card is plug in. >> >> Here are detail: >> $ camcontrol devlist >> <GENERIC USB Storage-SMC 010D> at scbus0 target 0 lun 0 (pass0,da0) >> <GENERIC USB Storage-CFC 010D> at scbus0 target 0 lun 1 (pass1,da1) >> <GENERIC USB Storage-MMC 010D> at scbus0 target 0 lun 2 (pass2,da2) >> <GENERIC USB Storage-MSC 010D> at scbus0 target 0 lun 3 (pass3,da3) >> >> After the CF card is plugged in: >> $ ls -l /dev/ | grep da >> crw-r----- 1 root operator 0, 105 Jul 22 13:18 da0 >> crw-r----- 1 root operator 0, 106 Jul 22 13:18 da1 >> crw-r----- 1 root operator 0, 107 Jul 22 13:18 da2 >> crw-r----- 1 root operator 0, 108 Jul 22 13:18 da3 >> >> After reboot while the CF card is plugged in: >> $ ls -l /dev/ | grep da >> crw-r----- 1 root operator 0, 105 Jul 22 13:24 da0 >> crw-r----- 1 root operator 0, 106 Jul 22 13:24 da1 >> crw-r----- 1 root operator 0, 110 Jul 22 13:24 da1s1 >> crw-r----- 1 root operator 0, 107 Jul 22 13:24 da2 >> crw-r----- 1 root operator 0, 108 Jul 22 13:24 da3 >> >> My questions in this regards are: >> 1. Is this an error/bug in FreeBSD 7.2? > > This is known limitation of, I think, GEOM stack.No, it is certainly not. What would be the point? The problem the OP is not that the CF device itself is not detected - the device being /dev/da1 - but that the partition on the device (da1s1) is not detected. It is possibly malformed. The OP should nuke the device (overwrite with dd if=/dev/zero of=/dev/da1 bs=1m), re-create the partition table and see if that helps.
On Wed, 2009-07-22 at 11:52 +0800, Sagara Wijetunga wrote:> Hi Milan, thanks for the reply. > > Yep, your suggestion works but it simply unacceptable for end users. We are > the makers of the Tomahawk Desktop (http://www.tomahawkcomputers.com/). > > Anybody in the FreeBSD community care to develop a patch to make it possible > to use multi-card readers under FreeBSD? > > Best regards > SagaraPerhaps that could be what the Tomahawk Desktop contributes back to FreeBSD? Seems to be your itch... Regards Tom
On Wednesday 22 July 2009 08:11:23 Sagara Wijetunga wrote:> Milan Obuch writes: > > On Wednesday 22 July 2009 04:20:27 Sagara Wijetunga wrote: > >> Hi FreeBSD community > >> > >> The SCSI device (eg. da1s1) is not created automatically upon a CF card > >> plug in on an USB multi-card reader on FreeBSD 7.2 (i386) but the SCSI > >> device (eg. da1s1) is created automatically if I reboot the computer > >> while the CF card is plug in. > >>Which kind of reader is it?Is it something built-in or standalone connected via USB cable to (externally accessible) USB port on your computer? If the latter, could you try the difference between plugging first reader into USB port, than CF into reader and plugging first CF into reader and than connect reader into USB port? Regards, Milan
Milan Obuch writes:> On Wednesday 22 July 2009 08:11:23 Sagara Wijetunga wrote: >> Milan Obuch writes: >> > On Wednesday 22 July 2009 04:20:27 Sagara Wijetunga wrote: >> >> Hi FreeBSD community >> >> >> >> The SCSI device (eg. da1s1) is not created automatically upon a CF card >> >> plug in on an USB multi-card reader on FreeBSD 7.2 (i386) but the SCSI >> >> device (eg. da1s1) is created automatically if I reboot the computer >> >> while the CF card is plug in. >> >> > > Which kind of reader is it?Is it something built-in or standalone connected > via USB cable to (externally accessible) USB port on your computer? If the > latter, could you try the difference between plugging first reader into USB > port, than CF into reader and plugging first CF into reader and than connect > reader into USB port? >1. This is an internal multi-card reader. 2. The CF card is not malformed. I have tried with a brand new CF card, FreeBSD does not create a daXs1 slice device node even for the new CF card. 3. Tried both cards under Linux 2.6, they work fine. No issue at all. The moment the card is plug in, Linux creates the sdc1 device node, the moment the CF card is taken out of the reader, the Linux removes the sdc1 node. 4. Both cards factory formatted to msdos file system. Regards Sagara
On Wed, Jul 22, 2009 at 10:20:27AM +0800, Sagara Wijetunga wrote:> My questions in this regards are: > 1. Is this an error/bug in FreeBSD 7.2?This is regression from pre-5.x days. In 4.x and earlier, you can have static device nodes and access them just fine.> 2. Or, does it require some configuration tweak?As a workaround, you should drop cardreader.conf into /usr/local/etc/devd/ (create directory if it does not exist) with contents like: attach 1000 { device-name "umass[0-9]+"; action "/usr/local/libexec/umass/attach-umass $device-name"; }; Script /usr/local/libexec/umass/attach-umass is invoked when umassX appears: #!/bin/sh PATH=/bin:/sbin:/usr/bin:/usr/sbin DEV=/dev p=`dirname $0` [ -z "$1" ] && exit 1 u="$1" # wait until dust settles i=1; while [ $i -le 10 ] do sleep 1 device=`$p/umass2da $u` if [ $? = 0 ]; then : > $DEV/${device} break fi i=$(($i+1)) done This script calls /usr/local/libexec/umass/umass2da helper to translate umassX to daY (in hope this translation is possible): #!/bin/sh PATH=/sbin:/usr/bin camcontrol devlist -v | awk -v u=$1 '\ BEGIN { s = ""; e = 1; } $3 ~ /umass-sim[0-9]+/ { s = $3; sub("-sim","",s); } /[,(]da[0-9]+.*\)$/ { if(s == u) { match($NF, /da[0-9]+/); print substr($NF, RSTART, RLENGTH); e=0; exit 0; } } END { exit e; }' Eugene Grosbein
Eugene Grosbein writes:> On Thu, Jul 23, 2009 at 08:13:38AM +0800, Sagara Wijetunga wrote: > >> Hi Eugene, thanks for the reply. The issue we discussed is about internal >> multi-card readers. For internal multi-card readers, the umassX created at >> boot time. If there is media inside at boot time, the device node for >> slices are also created. There is no issue about it. But the issue is after >> boot up, later some time, if you plug in a media card, FreeBSD does not >> generate any devd event. This needs to be fixed at the FreeBSD end, >> appreciate if the FreeBSD community actively fix it soon. > > If there is no devd event really, you can setup cron job to poll > your reader as a workaround. Or feel free to hack driver so it would > generate events for devd :-) >cat /dev/devctl shows nothing get to devd on media insertion. Poll via cron is not a solution. How often to poll? People expect immediate access to the card once plug in. At boot umassX, passX, daX are already setup for the reader. Once a card (media) is plug in, we expect a devd notification as follows: !system=DEVFS subsystem=CDEV type=CREATE cdev=daXs1 Once the media is taken out, we expect a devd notification as follows: !system=DEVFS subsystem=CDEV type=DESTROY cdev=daXs1 Where above X depends on which slot a card is plug in. If you conversant in this area, could you help us to identify what is/are the exact function/s in which program/s to look into identify the media insertion activity, so that we can generate relevant devd event. Regards Sagara