# Driver for USB NIC ST268 / dm9601

## Nethermancer

Hello,

I am trying to install a driver module for an USB NIC called ST268. The provided Driver CD has only the files for a 2.4-kernel, so I downloaded the latest driver from http://www.davicom.com.tw/big5/download/Driver/dm9601/dm9601-2.6.tgz

The instruction in the readme file is:

 *Quote:*   

>   DAVICOM Semiconductor Inc.                            11/24/2006
> 
>         A Davicom DM9601 USB Fast Ethernet driver for Linux.
> 
>         Copyright (C) 1997  Sten Wang
> ...

 

When I run make within the extraced directory, I get the following output:

```
make -C /lib/modules/2.6.20-gentoo-r8/build M=/root/non-gentoo/dm9601-2.6 LDDINCDIR=/root/non-gentoo/dm9601-2.6/../include modules

make[1]: Entering directory `/usr/src/linux-2.6.20-gentoo-r8'

  CC [M]  /root/non-gentoo/dm9601-2.6/dm9601.o

/root/non-gentoo/dm9601-2.6/dm9601.c:55:26: linux/config.h: No such file or directory

In file included from /root/non-gentoo/dm9601-2.6/dm9601.c:65:

/root/non-gentoo/dm9601-2.6/dm9601.h:100:1: warning: "ALIGN" redefined

In file included from include/asm/system.h:4,

                 from include/asm/processor.h:18,

                 from include/asm/thread_info.h:16,

                 from include/linux/thread_info.h:21,

                 from include/linux/preempt.h:9,

                 from include/linux/spinlock.h:49,

                 from include/linux/capability.h:45,

                 from include/linux/sched.h:46,

                 from /root/non-gentoo/dm9601-2.6/dm9601.c:56:

include/linux/kernel.h:35:1: warning: this is the location of the previous definition

/root/non-gentoo/dm9601-2.6/dm9601.c: In function `__check_reg5':

/root/non-gentoo/dm9601-2.6/dm9601.c:125: warning: return from incompatible pointer type

/root/non-gentoo/dm9601-2.6/dm9601.c: In function `__check_reg8':

/root/non-gentoo/dm9601-2.6/dm9601.c:126: warning: return from incompatible pointer type

/root/non-gentoo/dm9601-2.6/dm9601.c: In function `__check_reg9':

/root/non-gentoo/dm9601-2.6/dm9601.c:127: warning: return from incompatible pointer type

/root/non-gentoo/dm9601-2.6/dm9601.c: In function `__check_rega':

/root/non-gentoo/dm9601-2.6/dm9601.c:128: warning: return from incompatible pointer type

/root/non-gentoo/dm9601-2.6/dm9601.c: In function `__check_nfloor':

/root/non-gentoo/dm9601-2.6/dm9601.c:129: warning: return from incompatible pointer type

/root/non-gentoo/dm9601-2.6/dm9601.c: In function `get_registers':

/root/non-gentoo/dm9601-2.6/dm9601.c:192: warning: passing arg 7 of `usb_fill_control_urb' from incompatible pointer type

/root/non-gentoo/dm9601-2.6/dm9601.c: In function `set_registers':

/root/non-gentoo/dm9601-2.6/dm9601.c:230: warning: passing arg 7 of `usb_fill_control_urb' from incompatible pointer type

/root/non-gentoo/dm9601-2.6/dm9601.c: In function `set_register':

/root/non-gentoo/dm9601-2.6/dm9601.c:269: warning: passing arg 7 of `usb_fill_control_urb' from incompatible pointer type

/root/non-gentoo/dm9601-2.6/dm9601.c: In function `update_eth_regs_async':

/root/non-gentoo/dm9601-2.6/dm9601.c:303: warning: passing arg 7 of `usb_fill_control_urb' from incompatible pointer type

/root/non-gentoo/dm9601-2.6/dm9601.c:317: warning: passing arg 7 of `usb_fill_control_urb' from incompatible pointer type

/root/non-gentoo/dm9601-2.6/dm9601.c:331: warning: passing arg 7 of `usb_fill_control_urb' from incompatible pointer type

/root/non-gentoo/dm9601-2.6/dm9601.c: In function `read_bulk_callback':

/root/non-gentoo/dm9601-2.6/dm9601.c:486: warning: passing arg 6 of `usb_fill_bulk_urb' from incompatible pointer type

/root/non-gentoo/dm9601-2.6/dm9601.c: In function `dm9601_start_xmit':

/root/non-gentoo/dm9601-2.6/dm9601.c:605: warning: passing arg 6 of `usb_fill_bulk_urb' from incompatible pointer type

/root/non-gentoo/dm9601-2.6/dm9601.c: In function `dm9601_open':

/root/non-gentoo/dm9601-2.6/dm9601.c:804: warning: passing arg 6 of `usb_fill_bulk_urb' from incompatible pointer type

/root/non-gentoo/dm9601-2.6/dm9601.c:813: warning: passing arg 6 of `usb_fill_int_urb' from incompatible pointer type

/root/non-gentoo/dm9601-2.6/dm9601.c: In function `dm9601_disconnect':

/root/non-gentoo/dm9601-2.6/dm9601.c:1017: warning: ISO C90 forbids mixed declarations and code

/root/non-gentoo/dm9601-2.6/dm9601.c: At top level:

/root/non-gentoo/dm9601-2.6/dm9601.c:376: warning: 'write_eprom_word' defined but not used

make[2]: *** [/root/non-gentoo/dm9601-2.6/dm9601.o] Error 1

make[1]: *** [_module_/root/non-gentoo/dm9601-2.6] Error 2

make[1]: Leaving directory `/usr/src/linux-2.6.20-gentoo-r8'

make: *** [default] Error 2
```

In the first line LDDINCDIR indicates a path that does not exist. But which path is the correct one? I tried

```
/lib/modules/2.6.20-gentoo-r8/build/include/
```

and

```
/usr/src/linux-2.6.20-gentoo-r8/include
```

to no avail. Unfortunately, there are a lot of include directories as well as config.h files (see line 4).

I have never worked with drivers that are not included in gentoo portage. Can anybody help? Thanks in advance!

By the way, here is my lsusb output:

```
Bus 003 Device 002: ID 0a46:0268 Davicom Semiconductor, Inc.

Device Descriptor:

  bLength                18

  bDescriptorType         1

  bcdUSB               1.10

  bDeviceClass            0 (Defined at Interface level)

  bDeviceSubClass         0

  bDeviceProtocol         0

  bMaxPacketSize0         8

  idVendor           0x0a46 Davicom Semiconductor, Inc.

  idProduct          0x0268

  bcdDevice            1.01

  iManufacturer           1 ShanTou

  iProduct                2 ST268 USB NIC

  iSerial                 3 0268

  bNumConfigurations      1

  Configuration Descriptor:

    bLength                 9

    bDescriptorType         2

    wTotalLength           39

    bNumInterfaces          1

    bConfigurationValue     1

    iConfiguration          0

    bmAttributes         0xa0

      Remote Wakeup

    MaxPower              144mA

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        0

      bAlternateSetting       0

      bNumEndpoints           3

      bInterfaceClass         0 (Defined at Interface level)

      bInterfaceSubClass      0

      bInterfaceProtocol      0

      iInterface              0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x81  EP 1 IN

        bmAttributes            2

          Transfer Type            Bulk

          Synch Type               None

          Usage Type               Data

        wMaxPacketSize     0x0040  1x 64 bytes

        bInterval               0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x02  EP 2 OUT

        bmAttributes            2

          Transfer Type            Bulk

          Synch Type               None

          Usage Type               Data

        wMaxPacketSize     0x0040  1x 64 bytes

        bInterval               0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x83  EP 3 IN

        bmAttributes            3

          Transfer Type            Interrupt

          Synch Type               None

          Usage Type               Data

        wMaxPacketSize     0x0008  1x 8 bytes

        bInterval               1

```

Edit:

I forgot the contents of the Makefile:

```
##================================================================

##     Davicom Semiconductor Inc.       For DM9601 V0.00

##   --------------------------------------------------------

## Description:

##              Compile driver dm9601.c to dm9601.o

##

## Modification List:

## 09/05/2000   Fixed SMPFALGS wrong on smp & smp_mod

## 08/02/2000   Changed some description string & include file path

## 07/25/2000   Append smp_mod and changed some descriptions

## 01/25/2000   by Sten Wang

##================================================================

# Comment/uncomment the following line to disable/enable debugging

#DEBUG = y

# Add your debugging flag (or not) to CFLAGS

ifeq ($(DEBUG),y)

  DEBFLAGS = -O -g # "-O" is needed to expand inlines

else

  DEBFLAGS = -O2

endif

CFLAGS += $(DEBFLAGS) -I$(LDDINCDIR)

ifneq ($(KERNELRELEASE),)

# call from kernel build system

obj-m   := dm9601.o

else

KERNELDIR ?= /lib/modules/$(shell uname -r)/build

PWD       := $(shell pwd)

default:

        $(MAKE) -C $(KERNELDIR) M=$(PWD) LDDINCDIR=$(PWD)/../include modules

endif

clean:

        rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions

depend .depend dep:

        $(CC) $(CFLAGS) -M *.c > .depend

ifeq (.depend,$(wildcard .depend))

include .depend

endif
```

----------

## didymos

There is a driver for this device in the 2.6.21 kernel, it's under:

```

Device Drivers  --->

   USB support  --->

      USB Network Adapters  ---> 

            < > Multi-purpose USB Networking Framework  <--- Enable this or have it built as a module, or the driver won't be shown

            (snip other drivers)

            < >   Davicom DM9601 based USB 1.1 10/100 ethernet devices

```

I don't have any 2.6.20 source handy right now, so I don't know if 2.6.20 includes it as well.

----------

## didymos

Just checked.  It's not in 2.6.20.

----------

## Nethermancer

Thanks for this quick reply. I will try the latest kernel.

----------

