# /dev/sda1 not created for Card Reader............

## Frodg

I have searched the forums and other distros to solve this but have had not success: ( I have printed a mound of posts from this forum and am thinking of setting up a library service)

I have followed instructions from many posts and can't find the solution.

My 2.6.3 kernel supports the Card Reader hardware and is configured with SCSI support, fat & vfat support, usb-storage support....

cat /proc/bus/usb/devices lists my device ..... so it is recognised

usb scanners and printers work flawlessly.

Anyway - after days of recompiling kernels with support in modules or compiled in the kernel I still cannot get /dev/sda or /dev/scsi/...... to appear. I have booted with the card reader plugged in - not plugged in, with a card inserted - without a card inserted....

dmesg does not alter after plugging in or unplugging the card

/var/log/

I must be missing something basic. If I could at least get the /dev/sda part working then mounting and reading the card will be a breeze. 

One of the posts suggested that under 2.6.3 the card reader may be mounted under some other /dev device? How do I find this if it is true?

I have unmasked and installed gn3-utils but they do not seem to be able to work on gentoo? Neither gn_scan -i nor gn_map give any output for hardware. Maybe this is telling me something but I don't know.

It works on Mandrake (copied and fstab settings to gentoo as well as checking the kernel configurations - although Mandrake does not have the 2.6.3 kernel and I had to patch it with the tarball). It works with XP.  

Am I rambling? Sorry. I have surely forgetten half of the things I have tried but I may have to give up.

Can anyone help with this?

----------

## NeddySeagoon

Frodg,

Have you got SCSI emulation built properly?

If you have built modules lsmod needs to show (at least)

```
sr_mod               

scsi_mod

sg 

sd_mod
```

If you haven't built with modules, check your kernel config.

----------

## Frodg

G'day,

I believe (having checked a number of times) that these are compiled into the kernel. (this does not mean I haven't missed them   :Embarassed:  )

I am thinking that I will rebuild the kernel (again) but with everything related to usb storage, scsi emulation etc as modules and manually insert them. At least this would enable the lsmod command to confirm that they are loaded properly...

Tonight this will be my goal

Thanks

----------

## sikpig

I have a multi-card reader (CF, SD, MMC, SM, & MS) and to get it to work, I had enable multi-lun support in the kernel.  So each slot had its own device (/dev/sda[1-4]).  This was with kernel version 2.4, though, and you probably already tried that... I just thought I would throw that out there.. 

good luck

----------

## Frodg

OK

I have recompiled the kernel (4th time) with all the modules listed above loaded. Multi Lun support is on.

Still Nothing.

This is truely amazing.

----------

## Frodg

At least i now get this from dmesg when i attach, detach and reattach the Card Reader......

Console: switching to colour frame buffer device 100x37

Console: switching to colour frame buffer device 100x37

usb 2-1: new full speed USB device using address 3

usb 2-1: USB disconnect, address 3

usb 2-1: new full speed USB device using address 4

But still no /dev/sda or /dev/scsi

How do i find out where the usb 2-1 is loading the hardware and under which device?????

Help please   :Mad: 

----------

## NeddySeagoon

Frodg,

Have a look with usbview

----------

## Frodg

usbview allows you to see the physical connection etc... but I can't see from that which device is created in /dev  ????

This is the real issue.

I know the device is recognised (dmesg) I know its physiv\cal location and attributes -(usbview)

Where in /dev would it be, given that neither /dev/sda* or /dev/scsi/* are created at any time...

Is there a program that will identify if it is creating a device in some other spot?

----------

## pezplaya

Frodg, I am also having the same exact problem as you.  I am also running Kernel 2.6.3 and I believe I selected all the modules I need in menuconfig.

Anyone else have any other ideas?

----------

## dsd

post the following and i'll try to help

```
lsusb -v

lspci -v
```

also post kernel .config and dmesg output to some webspace (to avoid killing the forums)

----------

## sleek

In order to get /dev/sdaX, you MUST have SCSI disk support enabled in the kernel. The name of the module will be sd_mod. While the device will be recognized without that module, you will NOT be able to mount /dev/sdaX until the module is loaded.

----------

## Frodg

See first post - scsi support is enabled - all modules in all previous posts are installed  - lsmod lists everything that has ever been mentioned in posts as loaded ....

That is why it is not a duplicate post....

----------

## Frodg

 *dsd wrote:*   

> post the following and i'll try to help
> 
> ```
> lsusb -v
> 
> ...

 

Thanks,

I will set this up when I get home and post the details

Frodg

----------

## Frodg

The dmesg output is here:

http://members.optusnet.com.au/~pattong/message.txt

The kernel .config output is here:

http://members.optusnet.com.au/~pattong/kernel.txt

The lsusb -v code:

```
Bus 002 Device 003: ID 04a5:20b0 Acer Peripherals Inc. (now BenQ Corp.) S2W 3300U/4300U

Device Descriptor:

  bLength                18

  bDescriptorType         1

  bcdUSB               1.00

  bDeviceClass          255 Vendor Specific Class

  bDeviceSubClass       255 Vendor Specific Subclass

  bDeviceProtocol       255 Vendor Specific Protocol

  bMaxPacketSize0         8

  idVendor           0x04a5 Acer Peripherals Inc. (now BenQ Corp.)

  idProduct          0x20b0 S2W 3300U/4300U

  bcdDevice            0.42

  iManufacturer           1 Color

  iProduct                2  FlatbedScanner 23

  iSerial                 0

  bNumConfigurations      1

  Configuration Descriptor:

    bLength                 9

    bDescriptorType         2

    wTotalLength           39

    bNumInterfaces          1

    bConfigurationValue     1

    iConfiguration          0

    bmAttributes         0x40

      Self Powered

    MaxPower              100mA

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        0

      bAlternateSetting       0

      bNumEndpoints           3

      bInterfaceClass       255 Vendor Specific Class

      bInterfaceSubClass    255 Vendor Specific Subclass

      bInterfaceProtocol    255 Vendor Specific Protocol

      iInterface              0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x81  EP 1 IN

        bmAttributes            2

          Transfer Type            Bulk

          Synch Type               none

        wMaxPacketSize         64

        bInterval               0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x02  EP 2 OUT

        bmAttributes            2

          Transfer Type            Bulk

          Synch Type               none

        wMaxPacketSize          8

        bInterval               0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x83  EP 3 IN

        bmAttributes            3

          Transfer Type            Interrupt

          Synch Type               none

        wMaxPacketSize          8

        bInterval              16

  Language IDs: (length=4)

     0409 English(US)

Bus 002 Device 002: ID 04e6:1010 SCM Microsystems, Inc. USBAT-2 CompactFlash Card Reader

  Language IDs: none (invalid length string descriptor 04; len=256)

Device Descriptor:

  bLength                18

  bDescriptorType         1

  bcdUSB               1.00

  bDeviceClass            0 Interface

  bDeviceSubClass         0

  bDeviceProtocol         0

  bMaxPacketSize0        16

  idVendor           0x04e6 SCM Microsystems, Inc.

  idProduct          0x1010 USBAT-2 CompactFlash Card Reader

  bcdDevice            0.05

  iManufacturer           1 SHUTTLE

  iProduct                2 SCM Micro USBAT-02

  iSerial                 0

  bNumConfigurations      1

  Configuration Descriptor:

    bLength                 9

    bDescriptorType         2

    wTotalLength           39

    bNumInterfaces          1

    bConfigurationValue     1

    iConfiguration          0

    bmAttributes         0x80

    MaxPower              100mA

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        0

      bAlternateSetting       0

      bNumEndpoints           3

      bInterfaceClass       255 Vendor Specific Class

      bInterfaceSubClass      1

      bInterfaceProtocol    255

      iInterface              0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x81  EP 1 IN

        bmAttributes            3

          Transfer Type            Interrupt

          Synch Type               none

        wMaxPacketSize          4

        bInterval               5

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x82  EP 2 IN

        bmAttributes            2

          Transfer Type            Bulk

          Synch Type               none

        wMaxPacketSize         64

        bInterval               0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x03  EP 3 OUT

        bmAttributes            2

          Transfer Type            Bulk

          Synch Type               none

        wMaxPacketSize         64

        bInterval               0

  Language IDs: none (invalid length string descriptor 04; len=256)

Bus 002 Device 001: ID 0000:0000

Device Descriptor:

  bLength                18

  bDescriptorType         1

  bcdUSB               1.10

  bDeviceClass            9 Hub

  bDeviceSubClass         0

  bDeviceProtocol         0

  bMaxPacketSize0         8

  idVendor           0x0000

  idProduct          0x0000

  bcdDevice            2.06

  iManufacturer           3 Linux 2.6.3-gentoo-r1 uhci_hcd

  iProduct                2 UHCI Host Controller

  iSerial                 1 0000:00:07.3

  bNumConfigurations      1

  Configuration Descriptor:

    bLength                 9

    bDescriptorType         2

    wTotalLength           25

    bNumInterfaces          1

    bConfigurationValue     1

    iConfiguration          0

    bmAttributes         0x40

      Self Powered

    MaxPower                0mA

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        0

      bAlternateSetting       0

      bNumEndpoints           1

      bInterfaceClass         9 Hub

      bInterfaceSubClass      0

      bInterfaceProtocol      0

      iInterface              0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x81  EP 1 IN

        bmAttributes            3

          Transfer Type            Interrupt

          Synch Type               none

        wMaxPacketSize          2

        bInterval             255

  Language IDs: (length=4)

     0409 English(US)

Bus 001 Device 003: ID 04b8:0005 Seiko Epson Corp. Stylus Printer

Device Descriptor:

  bLength                18

  bDescriptorType         1

  bcdUSB               1.10

  bDeviceClass            0 Interface

  bDeviceSubClass         0

  bDeviceProtocol         0

  bMaxPacketSize0         8

  idVendor           0x04b8 Seiko Epson Corp.

  idProduct          0x0005 Stylus Printer

  bcdDevice            1.00

  iManufacturer           1 EPSON

  iProduct                2 USB Printer

  iSerial                 3 HRO310203311148160

  bNumConfigurations      1

  Configuration Descriptor:

    bLength                 9

    bDescriptorType         2

    wTotalLength           32

    bNumInterfaces          1

    bConfigurationValue     1

    iConfiguration          0

    bmAttributes         0xc0

      Self Powered

    MaxPower                2mA

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        0

      bAlternateSetting       0

      bNumEndpoints           2

      bInterfaceClass         7 Printer

      bInterfaceSubClass      1 Printer

      bInterfaceProtocol      2 Bidirectional

      iInterface              0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x01  EP 1 OUT

        bmAttributes            2

          Transfer Type            Bulk

          Synch Type               none

        wMaxPacketSize         64

        bInterval               0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x82  EP 2 IN

        bmAttributes            2

          Transfer Type            Bulk

          Synch Type               none

        wMaxPacketSize         64

        bInterval               0

  Language IDs: (length=4)

     0409 English(US)

Bus 001 Device 002: ID 04f9:0016 Brother Industries, Ltd

Device Descriptor:

  bLength                18

  bDescriptorType         1

  bcdUSB               2.00

  bDeviceClass            0 Interface

  bDeviceSubClass         0

  bDeviceProtocol         0

  bMaxPacketSize0        64

  idVendor           0x04f9 Brother Industries, Ltd

  idProduct          0x0016

  bcdDevice            1.00

  iManufacturer           1 Brother

  iProduct                2 HL-5040

  iSerial                 3 E3J322100

  bNumConfigurations      1

  Configuration Descriptor:

    bLength                 9

    bDescriptorType         2

    wTotalLength           32

    bNumInterfaces          1

    bConfigurationValue     1

    iConfiguration          0

    bmAttributes         0xc0

      Self Powered

    MaxPower                2mA

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        0

      bAlternateSetting       0

      bNumEndpoints           2

      bInterfaceClass         7 Printer

      bInterfaceSubClass      1 Printer

      bInterfaceProtocol      2 Bidirectional

      iInterface              0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x01  EP 1 OUT

        bmAttributes            2

          Transfer Type            Bulk

          Synch Type               none

        wMaxPacketSize         64

        bInterval               0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x82  EP 2 IN

        bmAttributes            2

          Transfer Type            Bulk

          Synch Type               none

        wMaxPacketSize         64

        bInterval               0

  Language IDs: (length=4)

     0409 English(US)

Bus 001 Device 001: ID 0000:0000

Device Descriptor:

  bLength                18

  bDescriptorType         1

  bcdUSB               1.10

  bDeviceClass            9 Hub

  bDeviceSubClass         0

  bDeviceProtocol         0

  bMaxPacketSize0         8

  idVendor           0x0000

  idProduct          0x0000

  bcdDevice            2.06

  iManufacturer           3 Linux 2.6.3-gentoo-r1 uhci_hcd

  iProduct                2 UHCI Host Controller

  iSerial                 1 0000:00:07.2

  bNumConfigurations      1

  Configuration Descriptor:

    bLength                 9

    bDescriptorType         2

    wTotalLength           25

    bNumInterfaces          1

    bConfigurationValue     1

    iConfiguration          0

    bmAttributes         0x40

      Self Powered

    MaxPower                0mA

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        0

      bAlternateSetting       0

      bNumEndpoints           1

      bInterfaceClass         9 Hub

      bInterfaceSubClass      0

      bInterfaceProtocol      0

      iInterface              0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x81  EP 1 IN

        bmAttributes            3

          Transfer Type            Interrupt

          Synch Type               none

        wMaxPacketSize          2

        bInterval             255

  Language IDs: (length=4)

     0409 English(US)

```

The lspci -v code :

```
lspci -v

00:00.0 Host bridge: VIA Technologies, Inc. VT8363/8365 [KT133/KM133] (rev 03)

        Flags: bus master, medium devsel, latency 8

        Memory at e8000000 (32-bit, prefetchable) [size=64M]

        Capabilities: [a0] AGP version 2.0

        Capabilities: [c0] Power Management version 2

00:01.0 PCI bridge: VIA Technologies, Inc. VT8363/8365 [KT133/KM133 AGP] (prog-if 00 [Normal decode])

        Flags: bus master, 66Mhz, medium devsel, latency 0

        Bus: primary=00, secondary=01, subordinate=01, sec-latency=0

        Memory behind bridge: ec000000-edffffff

        Prefetchable memory behind bridge: e0000000-e7ffffff

        Capabilities: [80] Power Management version 2

00:07.0 ISA bridge: VIA Technologies, Inc. VT82C686 [Apollo Super South] (rev 40)

        Subsystem: VIA Technologies, Inc. VT82C686/A PCI to ISA Bridge

        Flags: bus master, stepping, medium devsel, latency 0

        Capabilities: [c0] Power Management version 2

00:07.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT8233/A/C/VT8235 PIPC Bus Master IDE (rev 06) (prog-if 8a [Master SecP PriP])

        Flags: bus master, medium devsel, latency 32

        I/O ports at d000 [size=16]

        Capabilities: [c0] Power Management version 2

00:07.2 USB Controller: VIA Technologies, Inc. USB (rev 1a) (prog-if 00 [UHCI])

        Subsystem: VIA Technologies, Inc. (Wrong ID) USB Controller

        Flags: bus master, medium devsel, latency 32, IRQ 9

        I/O ports at d400 [size=32]

        Capabilities: [80] Power Management version 2

00:07.3 USB Controller: VIA Technologies, Inc. USB (rev 1a) (prog-if 00 [UHCI])

        Subsystem: VIA Technologies, Inc. (Wrong ID) USB Controller

        Flags: bus master, medium devsel, latency 32, IRQ 9

        I/O ports at d800 [size=32]

        Capabilities: [80] Power Management version 2

00:07.4 Bridge: VIA Technologies, Inc. VT82C686 [Apollo Super ACPI] (rev 40)

        Subsystem: VIA Technologies, Inc. VT82C686 [Apollo Super ACPI]

        Flags: medium devsel, IRQ 11

        Capabilities: [68] Power Management version 2

00:07.5 Multimedia audio controller: VIA Technologies, Inc. VT82C686 AC97 Audio Controller (rev 50)

        Subsystem: VIA Technologies, Inc. VT82C686 AC97 Audio Controller

        Flags: medium devsel, IRQ 11

        I/O ports at dc00 [size=256]

        I/O ports at e000 [size=4]

        I/O ports at e400 [size=4]

        Capabilities: [c0] Power Management version 2

00:0a.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)

        Subsystem: Realtek Semiconductor Co., Ltd. RT8139

        Flags: bus master, medium devsel, latency 32, IRQ 11

        I/O ports at e800 [size=256]

        Memory at ef000000 (32-bit, non-prefetchable) [size=256]

        Expansion ROM at <unassigned> [disabled] [size=64K]

        Capabilities: [50] Power Management version 2

01:00.0 VGA compatible controller: nVidia Corporation NV11 [GeForce2 MX/MX 400] (rev a1) (prog-if 00 [VGA])

        Flags: bus master, 66Mhz, medium devsel, latency 248, IRQ 10

        Memory at ec000000 (32-bit, non-prefetchable) [size=16M]

        Memory at e0000000 (32-bit, prefetchable) [size=128M]

        Expansion ROM at <unassigned> [disabled] [size=64K]

        Capabilities: [60] Power Management version 2

        Capabilities: [44] AGP version 2.0

```

Sorry for thelong post but you did ask for it  :Smile: 

I have probably missed something simple ...

Oh, lsmod code:

```
Module                  Size  Used by

lp                     11140  -

parport_pc             39756  -

parport                43656  -

8139cp                 20384  -

nls_iso8859_15          4384  -

nls_cp850               4608  -

usb_storage           103920  -

nvidia               1701036  -

8139too                24768  -

mii                     4800  -

sg                     34080  -

sr_mod                 16260  -

sd_mod                 15552  -

scsi_mod               77164
```

Its like bearing your soul to have all this in a post..................

----------

## dsd

[note to self, use google before spending ages in the kernel source trying to figure it out]

your device is a USBAT-2 driver. theres an external project here writing drivers for this hardware. you should try patching your kernel with the 2.5 patch (it might be out of date, and we might run into problems there, but try it anyway).

----------

## Frodg

 *dsd wrote:*   

> [note to self, use google before spending ages in the kernel source trying to figure it out]
> 
> your device is a USBAT-2 driver. theres an external project here writing drivers for this hardware. you should try patching your kernel with the 2.5 patch (it might be out of date, and we might run into problems there, but try it anyway).

 

Unfortunately when I apply the patch I get this:

```
patch -p1 < /usr/usbat02-2.5.diff

patching file drivers/usb/storage/Kconfig

Hunk #1 succeeded at 121 with fuzz 2 (offset 29 lines).

patching file drivers/usb/storage/Makefile

Hunk #1 FAILED at 18.

1 out of 1 hunk FAILED -- saving rejects to file drivers/usb/storage/Makefile.rej

patching file drivers/usb/storage/transport.h

Hunk #1 succeeded at 92 with fuzz 1 (offset 18 lines).

patching file drivers/usb/storage/unusual_devs.h

Hunk #1 succeeded at 246 with fuzz 2 (offset 34 lines).

patching file drivers/usb/storage/usb.c

Hunk #1 succeeded at 87 with fuzz 2 (offset 7 lines).

Hunk #2 succeeded at 702 with fuzz 2 (offset -81 lines).

Skipping patch.

1 out of 1 hunk ignored -- saving rejects to file drivers/usb/storage/zio_cf.h.rej

(/usr/src/linux) # cat drivers/usb/storage/zio_cf.h.rej

***************

*** 0 ****

--- 1,49 ----

+ /* Driver for Dazzle/SCM zio Compact Flash reader

+  * Header File

+  *

+  * Current development and maintenance by:

+  *   (c) 2002 Thomas Kreiling (usbdev AT sm04.de)

+  *

+  * See zio_cf.c for more explanation

+  *

+  * This program is free software; you can redistribute it and/or modify it

+  * under the terms of the GNU General Public License as published by the

+  * Free Software Foundation; either version 2, or (at your option) any

+  * later version.

+  *

+  * This program is distributed in the hope that it will be useful, but

+  * WITHOUT ANY WARRANTY; without even the implied warranty of

+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU

+  * General Public License for more details.

+  *

+  * You should have received a copy of the GNU General Public License along

+  * with this program; if not, write to the Free Software Foundation, Inc.,

+  * 675 Mass Ave, Cambridge, MA 02139, USA.

+  */

+

+ #ifndef _USB_ZIOCF_H

+ #define _USB_ZIOCF_H

+

+ extern int ziocf_transport(Scsi_Cmnd *srb, struct us_data *us);

+ extern int init_ziocf(struct us_data *us);

+

+ #include <linux/hdreg.h>

+

+ #define USBAT_ATA             0x40

+

+ static struct hd_driveid drive;

+

+ struct ziocf_info {

+    unsigned long   sectors;     // total sector count

+    unsigned long   ssize;       // sector size in bytes

+    __u16 heads;

+    __u16 sec_per_track;

+

+

+    // the following aren't used yet

+    unsigned char   sense_key;

+    unsigned long   sense_asc;   // additional sense code

+    unsigned long   sense_ascq;  // additional sense code qualifier

+ };

+

+ #endif

```

So I ran this anyway..... 

```
make menuconfig
```

which gave the option to install the module (Yipee) - but would not complete the make process - even with make -k - which completed but would not update the target....

```
 ..

code removed for ease of viewing....

 CC      arch/i386/lib/usercopy.o

  AR      arch/i386/lib/lib.a

make: Target `all' not remade because of errors.
```

So where do I go from here?

I have removed the patch and have kept the unpatched kernel.

can we alter the patch in some way with the results from the zio_cf.h.rej file?

I admit I have no idea....

thanks for your help

----------

## dsd

ok.. i have ported the driver to 2.6

this wasnt as simple as i had expected, looks like things have moved around since the time the 2.5 patch was written.

i havent tested it (i dont have any hardware of this type), and im an inexperienced hacker, so ive probably broken something

however, it does compile  :Smile: 

please try it

http://www.reactivated.net/patches/linux-kernel/2.6.4/usbat2-usb-driver.patch

after applying that patch, could you post what appears in dmesg once you plug/unplug the reader?

also, if it seems to be working, could you run the following test once or twice?

assuming the device is mounted at /mnt/smartmedia :

create a file in your homedir, the size of the smartmedia card you are using, minus 1 or 2 megabytes for safety

e.g. to create a 30mb file:

# dd if=/dev/urandom of=tempfile bs=1024 count=30000

(just alter the count= parameter to change the size)

find out the md5sum of this file, and record this:

# md5sum tempfile

copy the file to the smartmedia:

# cp tempfile /mnt/smartmedia

unmount

# umount /mnt/smartmedia

wait a few seconds, and unplug the reader.

wait a few more seconds, and plug it back in again

re-mount the device

# mount <whatever>

check md5sum of the file-on-device (might take a minute or so)

# md5sum /mnt/smartmedia/tempfile

copy file back over to local storage

# rm ~/tempfile

# cp /mnt/smartmedia/tempfile ~

# md5sum ~/tempfile

every "md5sum" command above should produce the same output. if this is the case, and you can complete the test ok, then i guess its working ok..

----------

## Frodg

Wow,,,, Now that is excellent.

I will try it tonight and let you know the results  :Smile: 

Thanks   :Razz:   :Razz:   :Razz:   :Razz:   :Very Happy:   :Very Happy: 

----------

## dsd

is it tonight yet?

i am very interested to hear the results  :Smile: 

----------

## Frodg

Well,

the patch worked - no errors on that score - all the hunks worked

set the zio function in the kernel OK

ran make - the same errors as previously when setting the usb dirvers and it would not complete ..... so

I may need to try this on a pristine kernel - after the number of times I have run the patch there are 6 identical options in make menuconfig for the ziio option - maybe this is cousing some problems.....

----------

## Frodg

OK 

I emerge dev-sources - got a clean kernel

ran the patch - perfect

make menuconfig - chose the new option for the card reader.

ran make:

code:

```
 CC [M]  drivers/usb/storage/zio_cf.o

drivers/usb/storage/zio_cf.c:47:22: raw_bulk.h: No such file or directory

drivers/usb/storage/zio_cf.c: In function `ziocf_raw_bulk':

drivers/usb/storage/zio_cf.c:144: error: structure has no member named `ep_in'

drivers/usb/storage/zio_cf.c:146: error: structure has no member named `ep_out'

drivers/usb/storage/zio_cf.c:148: warning: implicit declaration of function `usb_stor_bulk_msg'

drivers/usb/storage/zio_cf.c: In function `ziocf_read_data':

drivers/usb/storage/zio_cf.c:548: warning: implicit declaration of function `us_copy_to_sgbuf'

drivers/usb/storage/zio_cf.c: In function `ziocf_write_data':

drivers/usb/storage/zio_cf.c:617: warning: implicit declaration of function `us_copy_from_sgbuf'

drivers/usb/storage/zio_cf.c:618: warning: assignment makes pointer from integer without a cast

make[3]: *** [drivers/usb/storage/zio_cf.o] Error 1

make[2]: *** [drivers/usb/storage] Error 2

make[1]: *** [drivers/usb] Error 2

make: *** [drivers] Error 2

```

So... no success  yet - but I have every confidence in your skill and ability....

 :Wink: 

----------

## dsd

hmm

are you applying the patch from sourceforge.net first ??

if you are, dont..

remove the old /usr/src/linux-2.6.4 if in doubt, get a clean kernel (2.6.4), apply my patch only (usbat2-usb-driver.patch), and try again

my patch makes no reference to raw_bulk.h so im confused why you get that...

infact those errors are the exact errors that i had to deal with in my work..

----------

## Frodg

I didn't apply the soundforge patch.....

So you are saying that when i remegerd dev sources I should  have removed the old directory linux-2.6.3 first?????

Ok - next hing to do on my agenda  :Smile: 

I'll get back to you.....

----------

## dsd

 *Frodg wrote:*   

> So you are saying that when i remegerd dev sources I should  have removed the old directory linux-2.6.3 first?????

 

or just moved it out of the way, yes. by default, in a remerge, portage wont overwrite files that have changed since the original merge (IIRC).

btw: you should also try 2.6.4 (thats what i diffed against).

merge with:

```
emerge /usr/portage/sys-kernel/development-sources/development-sources-2.6.4.ebuild
```

just to clarify your method:

```
cd /usr/src/linux-2.6.4

wget http://www.reactivated.net/patches/linux-kernel/2.6.4/usbat2-usb-driver.patch

patch -p1 < usbat2-usb-driver.patch

make menuconfig

[select the zio thing and your other config options]

make bzImage modules modules_install
```

----------

## Frodg

I fully emerged dev-sources - I will try 2.6.4 next...

These are the messages:

doing make:

drivers/usb/storage/zio_cf.h:34: warning: 'drive' defined but not used

make config worked well...

plugged in the card reader.......

```
Mar 15 12:55:56 gentoo usb 2-1: USB disconnect, address 5

Mar 15 12:56:07 gentoo usb 2-1: new full speed USB device using address 6

Mar 15 12:56:07 gentoo usb-storage: USB Mass Storage device detected

Mar 15 12:56:07 gentoo usb-storage: act_altsetting is 0, id_index is 28

Mar 15 12:56:07 gentoo usb-storage: -- associate_dev

Mar 15 12:56:07 gentoo usb-storage: Vendor: SCM

Mar 15 12:56:07 gentoo usb-storage: Product: SCM USBAT-02

Mar 15 12:56:07 gentoo usb-storage: storage_probe() failed

Mar 15 12:56:07 gentoo usb-storage: -- dissociate_dev

Mar 15 12:56:07 gentoo usb-storage: -- usb_stor_release_resources finished

Mar 15 12:56:07 gentoo usb-storage: probe of 2-1:1.0 failed with error -5

```

This is a lot closer to where we want to be - no sda or sda1 created yet... :Smile: 

As I said - its 2.6.4 next....

I really appreciate the help - it has become a mission to get this working.

----------

## Frodg

 *Frodg wrote:*   

> I fully emerged dev-sources - I will try 2.6.4 next...
> 
> These are the messages:
> 
> doing make:
> ...

 

I emerged 2.6.4  and had exactly the same response as the last post....

This was the final output from tail -f /var/log/messages:

```
Mar 15 15:12:18 gentoo usb 2-1: new full speed USB device using address 4

Mar 15 15:12:18 gentoo usb-storage: USB Mass Storage device detected

Mar 15 15:12:18 gentoo usb-storage: act_altsetting is 0, id_index is 28

Mar 15 15:12:18 gentoo usb-storage: -- associate_dev

Mar 15 15:12:18 gentoo usb-storage: Vendor: SCM

Mar 15 15:12:18 gentoo usb-storage: Product: SCM USBAT-02

Mar 15 15:12:18 gentoo usb-storage: storage_probe() failed

Mar 15 15:12:18 gentoo usb-storage: -- dissociate_dev

Mar 15 15:12:18 gentoo usb-storage: -- usb_stor_release_resources finished

Mar 15 15:12:18 gentoo usb-storage: probe of 2-1:1.0 failed with error -5

```

there must be  need to define 'drive' as the kernel message states???

keep up the great work

Frogd[/quote]

----------

## dsd

ok... will look into this and post an updated patch a bit later on

----------

## dsd

ignore the drive warning thing, unused variables dont matter...

theres about 5 places where it could have failed to bring up that error message (in your kernel log), so this patch just tries to make it a bit more verbose, giving me more of an indiciation where it goes wrong.

while doing that, i noticed a chunk of code (from the original 2.5 patch) that is clearly in the wrong place for 2.6ism. it may well have been causing the problem.

so basically, this patch just tries to point out where it is failing. but on the offchance, it might even fix this problem.

dont bother remerging development-sources or anything this time, and dont revert out my first patch. this new one is just an incremental, designed to go over the top of the first one.

http://www.reactivated.net/patches/linux-kernel/2.6.4/usbat2-usb-driver+1.patch

patch in the normal way. recompile kernel, reboot.

BTW: i guess you might have already been doing so, but if not, could you please compile with "[*]     USB Mass Storage verbose debug" - CONFIG_USB_STORAGE_DEBUG - it may be handy in later debugging.

thanks, hope you are willing to stick with this  :Smile: 

----------

## Frodg

As soon as I get home from work I will apply the new patch and post the results  :Smile: 

I can't give up now - its a matter of pride (or is that hubris??)

----------

## Frodg

The patch output with this:

```
# patch -p1 < /root/usbat2-usb-driver+1.patch

patching file drivers/usb/storage/usb.c

patching file drivers/usb/storage/zio_cf.c

```

Everything fine

I haven't yet properly installed and rebooted because of this output when I run  make:

```
SPLIT   include/linux/autoconf.h -> include/config/*

make[1]: `arch/i386/kernel/asm-offsets.s' is up to date.

  CHK     include/linux/compile.h

  CC [M]  drivers/usb/storage/usb.o

drivers/usb/storage/zio_cf.h:34: warning: `drive' defined but not used

  CC [M]  drivers/usb/storage/zio_cf.o

drivers/usb/storage/zio_cf.h:34: warning: `drive' defined but not used

drivers/usb/storage/zio_cf.c:87:1: unterminated #if

make[3]: *** [drivers/usb/storage/zio_cf.o] Error 1

make[2]: *** [drivers/usb/storage] Error 2

make[1]: *** [drivers/usb] Error 2

make: *** [drivers] Error 2

```

I thought I would wait until you had a look.

If I knew a bit more about this I would try to identify the undetermined #if myself - but in my case a little knowledge has proved to be dangerous in the past

----------

## dsd

hrm, sorry about that. i thought i had tested compiling it, obviously not.

try this one please:

http://www.reactivated.net/patches/linux-kernel/2.6.4/usbat2-usb-driver+2.patch

again, its incremental - dont bother cleaning the tree, just apply this patch over the top of the last two.

----------

## Frodg

 *dsd wrote:*   

> 
> 
> try this one please:
> 
> http://www.reactivated.net/patches/linux-kernel/2.6.4/usbat2-usb-driver+2.patch
> ...

 

Absolutley Fabulous  !!!!!!!!!!!!!!!

(' :Laughing: ')

This patch worked.

I now have /dev/sda1 when I plug in the device......

I now can mount the usbat, copy files. umount, remount, copy back filles and all with the same md5sum.......... as per your earlier post..

The output from tail -f /var/log/messages http://members.optusnet.com.au/~pattong/message.txt when I plug the device in is very long with lots of strange debug info but eventually it stops and the card reader works perfectly..

Truely brilliant.

Now all that needs to be done is to combine all the patches and incremental patches into single patch and then you can post it to the universse    :Razz:   :Razz:   :Razz:   :Razz:   :Razz:   :Razz:   :Razz:   :Razz:   :Laughing:   :Laughing:   :Laughing:   :Laughing: 

If I knew how to send beer & pizza through the forum you'd be drunk and overwieght in days !  :Smile:  (maybe thats another post though)

----------

## dsd

erm.. wow..!

i couldnt see anything strange in the message.txt file you posted, could you point out the messages you mean?

i did purposely turn on the outputting of debug info to aid further debugging, i could see this thread going on for pages and pages before it worked.. so this is a nice suprise  :Smile: 

anyway, i'll clean up the code-damage I have done and create a rollup patch. please keep monitoring this thread - i would be very grateful if you could test the final rollup before i submit it to the author/maintainer

p.s. i think you deserve some of the credit, if you would like a name/nickname/email address to appear in the sources then let me know!

also please let me know the name and model of the device in case it needs adding to the help text

cheers.

----------

## dsd

ok, all done.

please reply to last post, and test the roll up driver.

To do this, you will either need to start with fresh kernel (rm -rf /usr/src/linux-2.6.4 && emerge development-sources-2.6.4) or alternatively just revert out the old patches first, e.g.

```
cd /usr/src/linux-2.6.4

patch -p1 -R < usbat2-usb-driver+2.patch

patch -p1 -R < usbat2-usb-driver+1.patch

patch -p1 -R < usbat2-usb-driver.patch

patch -p1 < usbat2-driver-working.patch
```

http://www.reactivated.net/patches/linux-kernel/2.6.4/usbat2-driver-working.patch

thanks!

----------

## Frodg

So it was the debugging that sent the pages of information I put in the text file?.

In that case it worked perfectly - I had not received that level of information before and assumed that it was too much...

Just arrived at work so when i get home I will remove all trace of previous patches and test the new one.

I am just pleased (too small a word) to get the thing working so leave me out of the sources - I was only the tester in any case  :Smile: 

Will test and reply as soon as I can

----------

## dsd

the message.txt file you have uploaded doesnt appear to contain any debugging info from the usbat/usb drivers.

however, i had uncommented some debugging statements, so i would not be suprised if the last patch you tried was very "noisy" (it would have printed messages on each read and write).

oh, and also, i previously asked you to compile with "USB storage verbose debug". this would have produced some noise too. when you try later on, please do not compile with this option selected

the driver is now in its original state - it should only print a lot of debug info if it runs into problems.

cheers

----------

## Frodg

I have tested the patch both ways -

Reversed the patches - that worked 

Removed the full 2.6.4 directory and emerged the development sources again - that worked

I also patched 2.6.3 dev-sources - and that worked

So from my point of veiw it works well.

The specific model of card reader is:

"Kodak USB Picture Card Reader"

model: CFS Bella USB

Part No 5E9510

As there are a lot of posts out there relating to this problem I would expect this patch to be very well received.

What more can I say?

Thank You[/list]

----------

## dsd

no probs. its a good learning experience for me as well  :Smile: 

i will submit my work to the maintainer, but i dont think in its current state it will be accepted into the kernel. i found a discussion where the USB maintainer said he wouldnt consider the 2.5 driver because it was a mess.

im considering tidying it up for inclusion in the kernel... but not just yet, plenty of other things to be getting on with

would you be ok with testing a cleaner driver at a later stage? i'll drop a PM when i need you  :Smile: 

----------

## Frodg

I'd be more than glad to test anything again...

I am in the middle of installing the mm-sources (2.6.4-mm2) and converting from devfs to udev only - now won't that be fun?

I have used your patch in this and I will let you know if it works with a purely udev file system.

----------

## Frodg

Update:

 *Quote:*   

> 
> 
> I am in the middle of installing the mm-sources (2.6.4-mm2) and converting from devfs to udev only

 

I have completed the changeover with a couple of hiccups - but I believe I have a devfs free system ...

The patch for the usb card reader works flawlessly in a pure udev environment.

(now where is that bloody USB scanner !!!!!!  .  :Twisted Evil: 

----------

