Detecting cards in USB card reader
Mike Clarke
jmc-freebsd2 at milibyte.co.uk
Sat Feb 6 23:28:31 UTC 2010
On Saturday 06 February 2010, Polytropon wrote:
> I can understand this. Maybe accessing the "SCSI layer" of
> the card reader can help? If
>
> % camcontrol reset all
>
> will cause the same effect (of creating the correct nodes in
> /dev), you can be more precise (e. g. just reset da0); see
>
> % man camcontrol
>
> for further (and maybe more elegant) details.
Neither reset nor rescan have any effect with camcontrol. Without a
suitable incantation like 'cat /dev/null > /dev/da0' I just
have /dev/da0 but no /dev/da0s1 after inserting a card. The system
knows that the media is there, "fdisk /dev/da0" can see the slice even,
but there's no device node for it.
This is what happens after inserting a 16MB card in the reader:
curlew:/root# ls -l /dev/da0*
crw-r----- 1 root operator 0, 176 6 Feb 23:15 /dev/da0
curlew:/root# fdisk /dev/da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=15 heads=64 sectors/track=32 (2048 blks/cyl)
parameters to be used for BIOS calculations are:
cylinders=15 heads=64 sectors/track=32 (2048 blks/cyl)
Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 1 (0x01),(Primary DOS with 12 bit FAT)
start 32, size 31264 (15 Meg), flag 80 (active)
beg: cyl 0/ head 1/ sector 1;
end: cyl 488/ head 1/ sector 32
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
curlew:/root# ls -l /dev/da0*
crw-r----- 1 root operator 0, 176 6 Feb 23:15 /dev/da0
Still no device for slice 1 until after I attempt to open da0 for
writing:
curlew:/root# cat /dev/null > /dev/da0
curlew:/root# ls -l /dev/da0*
crw-r----- 1 root operator 0, 176 6 Feb 23:15 /dev/da0
crw-r----- 1 root operator 0, 129 6 Feb 23:18 /dev/da0s1
I can use this to initialise the card reader but I'd feel more
comfortable with something a bit less dangerous looking.
--
Mike Clarke
More information about the freebsd-questions
mailing list