Драйвер для картридера linux

Using a USB Card Reader in Linux

I recently got a Compact Flash card reader and set about getting it to work under Linux (x86). I didn’t find any instructions that were as straightforward as they should be, so.

First things first. here are some resources:

You should be able to follow the same procedure for other USB storage devices (portable hard drives, other media cards, etc.). With minimal modifications, the setup is the same for USB CD-ROM drives, floppies, etc.

If you have any particular successes or failures using these instructions, let me know. I originally did this on Debian sarge with Linux kernel 2.4.19. It should work with any 2.4.x series kernel. I have also done this with 2.6.x kernels and it all works.

Installing the Drivers

The USB driver serves up your reader as a SCSI device, so you also need to install the SCSI drivers. In the “ SCSI Support” section, enable these. The configuration name and the module name are listed:

  • SCSI Support ( CONFIG_SCSI , scsi.o )
  • SCSI disk support ( CONFIG_BLK_DEV_SD , sd_mod.o )
  • SCSI generic support ( CONFIG_CHR_DEV_SG , sg.o )
  • Probe all LUNs on each SCSI device ( CONFIG_SCSI_MULTI_LUN ), required only for multi-card devices.

You need to use the USB mass storage driver to access your reader. In the “ USB Support” section of the kernel configuration, enable the following:

  • Support for USB ( CONFIG_ USB , usb.o )
  • Preliminary USB device file system ( CONFIG_USB_DEVICEFS )
  • Whatever USB drivers you need, one or more of: ECHI HCD ( CONFIG_USB_EHCI_HCD , usb-ehci-hcd.o ), UHCI ( CONFIG_USB_UHCI , usb-uhci.o ), OHCI ( CONFIG_USB_OHCI , usb-ohci.o )
  • USB Mass Storage support ( CONFIG_USB_STORAGE , usb-storage.o )

Make sure you do not select the “Low Performance USB Block Driver” ( BLK_DEV_UB ). It will prevent the whole thing from working correctly.

Compile your kernel with these options and reboot (or just load the relevant modules if you’ve got them). And, plug the thing in, if you haven’t already.

Checking it out

If you have a look through the file /proc/bus/usb/devices , you should see a section with an S: line and the name of your reader and an I: line with Driver=usb-storage . If you see that, the kernel is recognizing the USB device.

Install the sg3-utils package if you haven’t already (on Debian, apt-get install sg3-utils ). To check your SCSI devices, run the command sg_scan -i . You should see something like this:

/dev/sg0: scsi0 channel=0 lun=0 [em] type=0 eUSB Compact Flash 5.09 [wide=0 sync=0 cmdq=0 sftre=0 pq=0x0]

This indicates that the “raw” SCSI device associated with your reader is /dev/sg0 . You can also confirm that the driver is working by looking at the file /proc/scsi/scsi .

Читайте также:  Linux analyze disk usage

Now, run the command sg_map to determine the real SCSI device associated with your reader. You’ll see output like this:

That’s it. Your card reader is /dev/sda . The first (and almost certainly only) partition is /dev/sda1 .

Multi Card Readers

If you have an n -in-1 card reader that can deal with multiple cards, the process isn’t much different. Make sure that “Probe all LUNs on each SCSI device” ( CONFIG_SCSI_MULTI_LUN ) is enabled in your kernel. If this isn’t compiled in, you can add this line to your /etc/modules.conf :

Or, for a more temporary solution, run this command:

The device should still appear in your /proc/bus/usb/devices as described above. When you do the sg_scan -i , you should see several devices, like this:

/dev/sg2: scsi2 channel=0 lun=0 [em] type=0 Generic STORAGE DEVICE 0128 [wide=0 sync=0 cmdq=0 sftre=0 pq=0x0] /dev/sg3: scsi2 channel=0 lun=1 [em] type=0 Generic STORAGE DEVICE 0128 [wide=0 sync=0 cmdq=0 sftre=0 pq=0x0] /dev/sg4: scsi2 channel=0 lun=2 [em] type=0 Generic STORAGE DEVICE 0128 [wide=0 sync=0 cmdq=0 sftre=0 pq=0x0] /dev/sg5: scsi2 channel=0 lun=3 [em] type=0 Generic STORAGE DEVICE 0128 [wide=0 sync=0 cmdq=0 sftre=0 pq=0x0]

Notice that the four generics are part of the same physical device, but have different LUNs . The “Probe all LUNs on each SCSI device” option in the kernel must be enabled so it will find these.

If so, then sg_map can do its thing:

/dev/sg2 /dev/sda /dev/sg3 /dev/sdb /dev/sg4 /dev/sdc /dev/sg5 /dev/sdd

On this system, the four slots on the card reader are mapped to SCSI devices /dev/sd[a-d] .

If you don’t have “Probe all LUNs on each SCSI device” set (as in Knoppix, Libranet, and some other default installs), you’re not out of luck. You just have to manually enable the probing. You can either modify /etc/modules.conf , or run the above command on startup.

sg_scan -i finds devices 0, 1, 2, and 3, but if you don’t have “Probe all LUNs on each SCSI device” set, sg_map will only find device 0. If adding the max_scsi_luns line doesn’t work, you could try running commands like these (to add three more devices):

echo >/proc/scsi/scsi «scsi add-single-device 2 0 0 1»
echo >/proc/scsi/scsi «scsi add-single-device 2 0 0 2»
echo >/proc/scsi/scsi «scsi add-single-device 2 0 0 3»

The numbers in these commands are (in order), the hostid, bus/channel, target ( SCSI ID), and LUN . These are the numbers in the first line of each section in the sg_scan -i output (eg. scsi2 channel=0 lun=1 corresponds to the first echo command).

Читайте также:  Основные типы файлов linux

Now, the question of which slot on the reader corresponds to which device file. I have no real advice here. Some readers give a useful description in sg_scan . If not, put a card in and try to mount it on each one. You will get a “ mount: No medium found ” for absent cards. When you find the right one, add it to your /etc/fstab as described below and forget about it. Repeat for each kind of card you actually have.

One more note: don’t cheap-out on your card reader. The first multi-card reader I bought was a off-brand and would spontaneously disconnent itself after being mounted for a minute or two. I replaced it with a SanDisk 8-in-1 and everything worked beautifully.

Thanks to Susan Macchia for her notes on getting n -in-1 card readers working that got me started with mine. Thanks also to the mailing list posted that I’ve long since lost that pointed out the “Probe all LUNs ” thing. Thanks to Chris Bryant for the info on how to work around when “Probe all LUNs ” isn’t available, and Neil Gunton and Dale Thacher for even more.

Final Setup

You’ll want to add a line to your /etc/fstab so you can easily mount a card. I mount my card at /mnt/flash ; you can mount it anywhere you want, just create the mount point first. Add this line to /etc/fstab :

/dev/sda1 /mnt/flash vfat noauto,user 0 0

The user option lets any user mount the card. If you don’t want that, remove it.

Now, you should be able to insert a card and mount it with the command mount /mnt/flash . Before you remove the card, unmount it with the command umount /mnt/flash .

Formatting a Card

Since cards are generally formatted as DOS ”disks”, they are formatted just like any other DOS disk. The Unix command mkfs -t vfat /dev/sda1 or mkfs -t msdos /dev/sda1 should do it.

Источник

Драйвер для картридера linux

Ребят, есть ноут Асер Аспаер 5742 (вроде). С usb всё хорошо. Сегодня вставил sd в картридер и сиситема его увидела и определила, но вот открывать наотрез отказывается)
Чего делать?)

Coffee Сообщения: 101 Зарегистрирован: 06 дек 2017, 23:38 Поблагодарили: 1 раз Контактная информация:

Драйверы картридера(или не читает sd)

rogoznik Сообщения: 9698 Зарегистрирован: 27 июн 2017, 13:36 Решено: 121 Откуда: Нижний Тагил Благодарил (а): 757 раз Поблагодарили: 1859 раз Контактная информация:

Драйверы картридера(или не читает sd)

Изображение

Coffee Сообщения: 101 Зарегистрирован: 06 дек 2017, 23:38 Поблагодарили: 1 раз Контактная информация:

Драйверы картридера(или не читает sd)

Coffee Сообщения: 101 Зарегистрирован: 06 дек 2017, 23:38 Поблагодарили: 1 раз Контактная информация:

Драйверы картридера(или не читает sd)

Chocobo Сообщения: 10010 Зарегистрирован: 27 авг 2016, 22:57 Решено: 215 Откуда: НН Благодарил (а): 812 раз Поблагодарили: 3000 раз Контактная информация:

Драйверы картридера(или не читает sd)

Изображение

Изображение

Coffee Сообщения: 101 Зарегистрирован: 06 дек 2017, 23:38 Поблагодарили: 1 раз Контактная информация:

Читайте также:  Linux chmod полный доступ

Драйверы картридера(или не читает sd)

Coffee Сообщения: 101 Зарегистрирован: 06 дек 2017, 23:38 Поблагодарили: 1 раз Контактная информация:

Драйверы картридера(или не читает sd)

rogoznik Сообщения: 9698 Зарегистрирован: 27 июн 2017, 13:36 Решено: 121 Откуда: Нижний Тагил Благодарил (а): 757 раз Поблагодарили: 1859 раз Контактная информация:

Драйверы картридера(или не читает sd)

Изображение

Chocobo Сообщения: 10010 Зарегистрирован: 27 авг 2016, 22:57 Решено: 215 Откуда: НН Благодарил (а): 812 раз Поблагодарили: 3000 раз Контактная информация:

Драйверы картридера(или не читает sd)

Coffee , всему, что пишется вот так — одна дорога, в терминал.
А результат их вызова сюда, в данном случае

Изображение

Изображение

Coffee Сообщения: 101 Зарегистрирован: 06 дек 2017, 23:38 Поблагодарили: 1 раз Контактная информация:

Драйверы картридера(или не читает sd)

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=1445028k,nr_inodes=361257,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=293712k,mode=755)
/dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (rw,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event,release_agent=/run/cgmanager/agents/cgm-release-agent.perf_event)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids,release_agent=/run/cgmanager/agents/cgm-release-agent.pids)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset,clone_children)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb,release_agent=/run/cgmanager/agents/cgm-release-agent.hugetlb)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=22,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=13947)
mqueue on /dev/mqueue type mqueue (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
tracefs on /sys/kernel/debug/tracing type tracefs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
cgmfs on /run/cgmanager/fs type tmpfs (rw,relatime,size=100k,mode=755)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=293712k,mode=700,uid=1000,gid=1000)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
/dev/sda3 on /media/ars/Media type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,uhelper=udisks2)

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sdb 8:16 1 15G 0 disk sr0 11:0 1 1024M 0 rom sda 8:0 0 298,1G 0 disk ├─sda4 8:4 0 57,2G 0 part ├─sda2 8:2 0 37,3G 0 part / ├─sda3 8:3 0 198,1G 0 part /media/ars/Media └─sda1 8:1 0 5,6G 0 part [SWAP]

Coffee Сообщения: 101 Зарегистрирован: 06 дек 2017, 23:38 Поблагодарили: 1 раз Контактная информация:

Драйверы картридера(или не читает sd)

Chocobo Сообщения: 10010 Зарегистрирован: 27 авг 2016, 22:57 Решено: 215 Откуда: НН Благодарил (а): 812 раз Поблагодарили: 3000 раз Контактная информация:

Драйверы картридера(или не читает sd)

Coffee , если потребуется — дадим и с sudo )
З.Ы — ббкоды не забывай при оформлении

Вроде видно её
sdb 8:16 1 15G 0 disk
Только вот разделов на ней нет, и файловых систем тоже, соответсвенно

Изображение

Изображение

Coffee Сообщения: 101 Зарегистрирован: 06 дек 2017, 23:38 Поблагодарили: 1 раз Контактная информация:

Источник

Оцените статью
Adblock
detector