# usb 2 parallel cable-unable to compile MosChip 7705 driver

## mickyd

I recently upgraded my computer hardware which didn't come with a parallel port. So I picked up a USB to DB25 parallel cable (brand: Cables Unlimited, model:USB-1475-06). I'm my old hardware, I use to use the parallel port to communicate with my K74 PC Parallel Port Relay Board which allowed me to run my sprinkler system.

after connecting the device, lsusb shows the following device:

Bus 002 Device 003: ID 9710:7705 MosChip Semiconductor MCS7705 Parallel port adapter

However, the 2.6.39-gentoo-r3 kernel only has built in support for the mos 7720 and 7840 devices. The manufacturer of the cable provides a driver for the cable on their website. After downloading it, I tried to compile it using the "make" command and I got the following errors:

cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"

make[2]: *** [/home/user/Linux_7705_V1.0.0.3/mos7705.o] Error 1

make[1]: *** [_module_/home/user/Linux_7705_V1.0.0.3] Error 2

make[1]: Leaving directory `/usr/src/linux-2.6.39-gentoo-r3'

make: *** [default] Error 2

I not sure how to manually compile a kernel module and so I'm hoping someone can help me with this.

----------

## eccerr0r

I think that option is just to hide any messages with initialized but unused variables... but some versions of gcc seems to not have it.  What version of gcc are you using?

You should be able to just remove the -Wno-unused-but-set-variable from the Makefile.  Edit the makefile and remove that phrase wherever you see it.  It'll probably be in a CFLAGS or related line.  Then try building it again.

There may be other error messages earlier in the output, make sure there are none.  Warnings shouldn't trigger the bomb... unless the option to bomb on warnings set in the code...?

I didn't download the sourcecode to that driver so it's quite possible that warning enable isn't in the makefile and may need some grepping to find it...

BTW... yeah I'm kind of saddened that computers are omitting parallel and serial ports...they're awesome for homemade hacks - easy to interface and program, etc... *sigh*

----------

## mickyd

My gcc --version:

```
gcc (Gentoo 4.4.5 p1.3, pie-0.4.5) 4.4.5
```

I reviewed the Makefile but did not see any mention of "-Wno-unused-but-set-variable" option. This is the contents of the Makefile that came with the driver:

```
#########################################################

#             Makefile for MOS7705   LINUX 2.6          #

#########################################################

KDIR:=/lib/modules/$(shell uname -r)/build

EXTRA_CFLAGS += -I $(KDIR)/drivers/usb/serial

obj-m:=mos7705.o

default:

        $(MAKE) -C $(KDIR) $(EXTRA_CFLAGS) SUBDIRS=$(PWD) modules

clean:

        rm -rf *.mod.c *.o *.ko .*.cmd *.symvers .tmp_versions

load:

        -modprobe usbserial

        -modprobe lp

        insmod mos7705.ko

unload:

        rmmod lp

        rmmod mos7705

install:

        sh mosinstall

uninstall:

        sh mosuninstall

```

Is there anything I need to change in this makefile so that in works in the Gentoo environment?

I also checked the make output and did notice additional errors. I've attached the entire output here:

```
make -C /lib/modules/2.6.39-gentoo-r3/build -I /lib/modules/2.6.39-gentoo-r3/build/drivers/usb/serial SUBDIRS=/home/user/Linux_7705_V1.0.0.3 modules

make[1]: Entering directory `/usr/src/linux-2.6.39-gentoo-r3'

  CC [M]  /home/user/Linux_7705_V1.0.0.3/mos7705.o

/home/user/Linux_7705_V1.0.0.3/mos7705.c:203: error: unknown field 'num_interrupt_in' specified in initializer

/home/user/Linux_7705_V1.0.0.3/mos7705.c:204: error: unknown field 'num_bulk_in' specified in initializer

/home/user/Linux_7705_V1.0.0.3/mos7705.c:204: warning: missing braces around initializer

/home/user/Linux_7705_V1.0.0.3/mos7705.c:204: warning: (near initialization for 'moschip7705_parport_device.driver_list')

/home/user/Linux_7705_V1.0.0.3/mos7705.c:204: warning: initialization makes pointer from integer without a cast

/home/user/Linux_7705_V1.0.0.3/mos7705.c:205: error: unknown field 'num_bulk_out' specified in initializer

/home/user/Linux_7705_V1.0.0.3/mos7705.c:205: warning: initialization makes pointer from integer without a cast

/home/user/Linux_7705_V1.0.0.3/mos7705.c:207: warning: initialization from incompatible pointer type

/home/user/Linux_7705_V1.0.0.3/mos7705.c:208: warning: initialization from incompatible pointer type

/home/user/Linux_7705_V1.0.0.3/mos7705.c:209: warning: initialization from incompatible pointer type

/home/user/Linux_7705_V1.0.0.3/mos7705.c:210: warning: initialization from incompatible pointer type

/home/user/Linux_7705_V1.0.0.3/mos7705.c:212: error: unknown field 'shutdown' specified in initializer

/home/user/Linux_7705_V1.0.0.3/mos7705.c:212: warning: initialization from incompatible pointer type

/home/user/Linux_7705_V1.0.0.3/mos7705.c:213: warning: initialization from incompatible pointer type

/home/user/Linux_7705_V1.0.0.3/mos7705.c:214: warning: initialization from incompatible pointer type

/home/user/Linux_7705_V1.0.0.3/mos7705.c:215: warning: initialization from incompatible pointer type

/home/user/Linux_7705_V1.0.0.3/mos7705.c:216: warning: initialization from incompatible pointer type

/home/user/Linux_7705_V1.0.0.3/mos7705.c:217: warning: initialization from incompatible pointer type

/home/user/Linux_7705_V1.0.0.3/mos7705.c:218: warning: initialization from incompatible pointer type

/home/user/Linux_7705_V1.0.0.3/mos7705.c: In function 'mos7705_bulk_in_callback':

/home/user/Linux_7705_V1.0.0.3/mos7705.c:1241: error: 'struct usb_serial_port' has no member named 'tty'

/home/user/Linux_7705_V1.0.0.3/mos7705.c: In function 'mos7705_bulk_out_data_callback':

/home/user/Linux_7705_V1.0.0.3/mos7705.c:1365: error: 'struct usb_serial_port' has no member named 'tty'

/home/user/Linux_7705_V1.0.0.3/mos7705.c:1372: error: request for member 'write_wakeup' in something not a structure or union

/home/user/Linux_7705_V1.0.0.3/mos7705.c:1373: error: request for member 'write_wakeup' in something not a structure or union

/home/user/Linux_7705_V1.0.0.3/mos7705.c: In function 'mos7705_open':

/home/user/Linux_7705_V1.0.0.3/mos7705.c:1652: error: 'struct usb_serial_port' has no member named 'tty'

/home/user/Linux_7705_V1.0.0.3/mos7705.c:1653: error: 'struct usb_serial_port' has no member named 'tty'

/home/user/Linux_7705_V1.0.0.3/mos7705.c: In function 'mos7705_throttle':

/home/user/Linux_7705_V1.0.0.3/mos7705.c:2301: error: 'struct usb_serial_port' has no member named 'tty'

/home/user/Linux_7705_V1.0.0.3/mos7705.c: In function 'mos7705_unthrottle':

/home/user/Linux_7705_V1.0.0.3/mos7705.c:2368: error: 'struct usb_serial_port' has no member named 'tty'

/home/user/Linux_7705_V1.0.0.3/mos7705.c: In function 'mos7705_set_termios':

/home/user/Linux_7705_V1.0.0.3/mos7705.c:2443: error: 'struct usb_serial_port' has no member named 'tty'

/home/user/Linux_7705_V1.0.0.3/mos7705.c:2445: error: 'struct usb_serial_port' has no member named 'tty'

/home/user/Linux_7705_V1.0.0.3/mos7705.c:2445: error: 'struct usb_serial_port' has no member named 'tty'

/home/user/Linux_7705_V1.0.0.3/mos7705.c: In function 'get_number_bytes_avail':

/home/user/Linux_7705_V1.0.0.3/mos7705.c:2551: error: 'struct usb_serial_port' has no member named 'tty'

/home/user/Linux_7705_V1.0.0.3/mos7705.c: In function 'change_port_settings':

/home/user/Linux_7705_V1.0.0.3/mos7705.c:3068: error: 'struct usb_serial_port' has no member named 'tty'

/home/user/Linux_7705_V1.0.0.3/mos7705.c: In function 'mos7705_startup':

/home/user/Linux_7705_V1.0.0.3/mos7705.c:3358: error: implicit declaration of function 'init_MUTEX_LOCKED'

/home/user/Linux_7705_V1.0.0.3/mos7705.c: In function 'mos7705_shutdown':

/home/user/Linux_7705_V1.0.0.3/mos7705.c:3465: error: implicit declaration of function 'kill_proc'

/home/user/Linux_7705_V1.0.0.3/mos7705.c: In function 'moschip7705_init':

/home/user/Linux_7705_V1.0.0.3/mos7705.c:3578: error: implicit declaration of function 'info'

At top level:

cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"

make[2]: *** [/home/user/Linux_7705_V1.0.0.3/mos7705.o] Error 1

make[1]: *** [_module_/home/user/Linux_7705_V1.0.0.3] Error 2

make[1]: Leaving directory `/usr/src/linux-2.6.39-gentoo-r3'

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

----------

## eccerr0r

Yeah, that's more like the errors I'd expect to kill a build.  Unfortunately the errors are indication of API change and not compatible with the kernel you're using.  You probably will have to use in-kernel drivers if available, as they're more likely maintained than drivers provided by the manufacturer...

But in this case you may have to port the driver to the new kernel which requires some programming knowledge and kernel internals...  Unfortunately I don't know what has changed in the driver subsystem to port the driver to the new version of the kernel...

The 7705 is a parallel port, did you try the generic printer port USB driver?  The 7720 and 7840 are serial, which won't work of course.

MORE INFO:

Found http://www.centos.org/modules/newbb/print.php?form=1&topic_id=32750&forum=37&order=DESC&start=0 which someone indicates this is not a normal usbprinter adaptor.  Try looking for a newer version of the driver, it may be ported to newer kernels?

This might be an interesting cable to buy as it has a parallel db25 on it, though I already have a usbparallel cable it has the centronics36 on it.  I don't want to hook up a centronics36 to my protoboards...

----------

## mickyd

I tried the generic printer port USB driver but that did not work. I ended up returning this cable to Frys.

For about $25 I bought "Startech.com PCI1PECP EPP/ECP Parallel PCI Card (1-port)" from Amazon. That solution worked perfectly. I was able to hook up my parallel port relay to this PCI card. My system found the device and created a /dev/parport0 to which I can control my irrigation system from my gentoo box.

----------

## mmokrejs

There is a nice overview/download of drivers for these chipsets (MosChip, NetMos) at http://vbs.ddns.com.br:8000/drives/Drives/DRIVER LPT1/.

I have Axago ExpressCard Combo Adapter ECA-SP with 2 serial and 1 parallel port. Myself could compile the 99xx driver on linux-3.2.2 (but only the NonCascade driver, not the one named Cascade, whatever that means). The sources for 9901 chipset driver 99xx.c are fixed and a fix similar to http://izto.org/mcs9865/starex_2.6.28.patch.gz is already applied. 

Myself I got on a CDROM from Axago the following:

```
# find Axago_drivers_CDROM_v1.09/ -name Linux | xargs ls -la

Axago_drivers_CDROM_v1.09/ADD-Xx/LAN/Linux:

total 16

dr-xr-xr-x 3 root root 4096 Oct  5 13:42 .

dr-xr-xr-x 6 root root 4096 Oct  5 13:42 ..

-r-xr-xr-x 1 root root  361 Oct  5 12:17 Linux_Readme.txt

dr-xr-xr-x 2 root root 4096 Oct  5 13:42 MCS780x_Linux_driver_v1.11

Axago_drivers_CDROM_v1.09/ADE-X5/Linux:

total 20

dr-xr-xr-x  4 root root 4096 Oct  5 14:46 .

dr-xr-xr-x 11 root root 4096 Oct  5 15:03 ..

dr-xr-xr-x  2 root root 4096 Oct  5 14:46 LINUX_2.6.14

dr-xr-xr-x  2 root root 4096 Oct  5 14:46 LINUX_2.6.9

-r-xr-xr-x  1 root root  137 Oct  5 14:56 readme.txt

Axago_drivers_CDROM_v1.09/ECA-30/Linux:

total 24

dr-xr-xr-x 5 root root 4096 Aug 29 13:19 .

dr-xr-xr-x 8 root root 4096 Aug 29 13:19 ..

-r-xr-xr-x 1 root root  383 Jun  9  2011 ReadMe.txt

dr-xr-xr-x 2 root root 4096 Aug 29 13:19 Redhat73

dr-xr-xr-x 2 root root 4096 Aug 29 13:19 Redhat8

dr-xr-xr-x 2 root root 4096 Aug 29 13:19 Redhat9

Axago_drivers_CDROM_v1.09/ECA-Px_Sx/Linux:

total 20

dr-xr-xr-x 4 root root 4096 Oct  8 17:34 .

dr-xr-xr-x 7 root root 4096 Oct  8 17:34 ..

-r-xr-xr-x 1 root root  613 Oct  6 13:32 Linux_Readme.txt

dr-xr-xr-x 2 root root 4096 Oct  8 17:34 MCS99XX_Cascade

dr-xr-xr-x 2 root root 4096 Oct  8 17:34 MCS99XX_NonCascade

Axago_drivers_CDROM_v1.09/ECE-GR/Linux:

total 76

dr-xr-xr-x  2 root root  4096 Oct  6 15:35 .

dr-xr-xr-x 10 root root  4096 Oct  6 15:36 ..

-r-xr-xr-x  1 root root 61491 Oct  6 14:56 r8168-8.025.00.tar.bz2

Axago_drivers_CDROM_v1.09/PCEA-Px_Sx/Linux:

total 20

dr-xr-xr-x 4 root root 4096 Oct  6 13:21 .

dr-xr-xr-x 7 root root 4096 Oct  6 14:16 ..

-r-xr-xr-x 1 root root  613 Oct  6 13:32 Linux_Readme.txt

dr-xr-xr-x 2 root root 4096 Oct  6 13:39 MCS99XX_Cascade

dr-xr-xr-x 2 root root 4096 Oct  6 13:43 MCS99XX_NonCascade

Axago_drivers_CDROM_v1.09/PCEE-GR/Linux:

total 76

dr-xr-xr-x  2 root root  4096 Oct  6 15:18 .

dr-xr-xr-x 10 root root  4096 Oct  6 15:18 ..

-r-xr-xr-x  1 root root 61491 Oct  6 14:56 r8168-8.025.00.tar.bz2

Axago_drivers_CDROM_v1.09/PCIA-Px_Sx/Linux:

total 468

dr-xr-xr-x 2 root root   4096 Oct  5 17:19 .

dr-xr-xr-x 7 root root   4096 Oct  5 17:13 ..

-r-xr-xr-x 1 root root    365 Mar 10  2011 Linux_Readme.txt

-r-xr-xr-x 1 root root 333568 Feb  2  2010 MCS9865_Linux_UM_Ver1.1.pdf

-r-xr-xr-x 1 root root   1141 Mar 10  2011 Makefile

-r-xr-xr-x 1 root root   1702 Mar 10  2011 ReleaseNotes

-r-xr-xr-x 1 root root    137 Mar 10  2011 mcs9865

-r-xr-xr-x 1 root root   4938 Feb 26  2010 mcs9865-isa.c

-r-xr-xr-x 1 root root   1352 Feb 26  2010 mcs9865-isa.h

-r-xr-xr-x 1 root root  72069 May 18  2010 mcs9865.c

-r-xr-xr-x 1 root root   5107 Feb 26  2010 mcs9865.h

-r-xr-xr-x 1 root root   1544 Feb 26  2010 mcs9865_isa_installation

-r-xr-xr-x 1 root root   4588 Dec 17  2010 readme

-r-xr-xr-x 1 root root    253 May 18  2010 testreport

#
```

To get parallel port to work one needs to load these modules in this order:

modprobe 99x # load the driver for the MosChip 9901/9912

modprobe parport

modprobe parport_pc # attaches the parport but in memory-mapped IO mode (slow)

modprobe parport_serial # ensures the parport gets IRQ, enables ECP/EPP/FIFO if I understand correctly

modprobe ppdev # creates /dev/parport*

modprobe lp # creates /dev/lp*

It is helpful to have these as modules, the ExpressCards easily slips out of the slot and reinserting the cards yields a new /dev/lp# device created. That is not optimal. It is better to rmmod lp and ppdev a reload them.

```
Feb  6 14:21:09 vostro kernel: pciehp 0000:00:1c.7:pcie04: Card present on Slot(7)

Feb  6 14:21:10 vostro kernel: pci 0000:11:00.0: BAR 1: assigned [mem 0xf6c00000-0xf6c00fff]

Feb  6 14:21:10 vostro kernel: pci 0000:11:00.0: BAR 1: set to [mem 0xf6c00000-0xf6c00fff] (PCI address [0xf6c00000-0xf6c00fff])

Feb  6 14:21:10 vostro kernel: pci 0000:11:00.0: BAR 5: assigned [mem 0xf6c01000-0xf6c01fff]

Feb  6 14:21:10 vostro kernel: pci 0000:11:00.0: BAR 5: set to [mem 0xf6c01000-0xf6c01fff] (PCI address [0xf6c01000-0xf6c01fff])

Feb  6 14:21:10 vostro kernel: pci 0000:11:00.1: BAR 1: assigned [mem 0xf6c02000-0xf6c02fff]

Feb  6 14:21:10 vostro kernel: pci 0000:11:00.1: BAR 1: set to [mem 0xf6c02000-0xf6c02fff] (PCI address [0xf6c02000-0xf6c02fff])

Feb  6 14:21:10 vostro kernel: pci 0000:11:00.1: BAR 5: assigned [mem 0xf6c03000-0xf6c03fff]

Feb  6 14:21:10 vostro kernel: pci 0000:11:00.1: BAR 5: set to [mem 0xf6c03000-0xf6c03fff] (PCI address [0xf6c03000-0xf6c03fff])

Feb  6 14:21:10 vostro kernel: pci 0000:11:00.2: BAR 2: assigned [mem 0xf6c04000-0xf6c04fff]

Feb  6 14:21:10 vostro kernel: pci 0000:11:00.2: BAR 2: set to [mem 0xf6c04000-0xf6c04fff] (PCI address [0xf6c04000-0xf6c04fff])

Feb  6 14:21:10 vostro kernel: pci 0000:11:00.2: BAR 5: assigned [mem 0xf6c05000-0xf6c05fff]

Feb  6 14:21:10 vostro kernel: pci 0000:11:00.2: BAR 5: set to [mem 0xf6c05000-0xf6c05fff] (PCI address [0xf6c05000-0xf6c05fff])

Feb  6 14:21:10 vostro kernel: pci 0000:11:00.0: BAR 0: assigned [io  0xc000-0xc007]

Feb  6 14:21:10 vostro kernel: pci 0000:11:00.0: BAR 0: set to [io  0xc000-0xc007] (PCI address [0xc000-0xc007])

Feb  6 14:21:10 vostro kernel: pci 0000:11:00.1: BAR 0: assigned [io  0xc008-0xc00f]

Feb  6 14:21:10 vostro kernel: pci 0000:11:00.1: BAR 0: set to [io  0xc008-0xc00f] (PCI address [0xc008-0xc00f])

Feb  6 14:21:10 vostro kernel: pci 0000:11:00.2: BAR 0: assigned [io  0xc010-0xc017]

Feb  6 14:21:10 vostro kernel: pci 0000:11:00.2: BAR 0: set to [io  0xc010-0xc017] (PCI address [0xc010-0xc017])

Feb  6 14:21:10 vostro kernel: pci 0000:11:00.2: BAR 1: assigned [io  0xc018-0xc01f]

Feb  6 14:21:10 vostro kernel: pci 0000:11:00.2: BAR 1: set to [io  0xc018-0xc01f] (PCI address [0xc018-0xc01f])

Feb  6 14:21:10 vostro kernel: pcieport 0000:00:1c.7: PCI bridge to [bus 11-16]

Feb  6 14:21:10 vostro kernel: pcieport 0000:00:1c.7:   bridge window [io  0xc000-0xdfff]

Feb  6 14:21:10 vostro kernel: pcieport 0000:00:1c.7:   bridge window [mem 0xf6c00000-0xf7cfffff]

Feb  6 14:21:10 vostro kernel: pcieport 0000:00:1c.7:   bridge window [mem 0xf0000000-0xf10fffff 64bit pref]

Feb  6 14:21:10 vostro kernel: serial 0000:11:00.0: enabling device (0100 -> 0103)

Feb  6 14:21:10 vostro kernel: serial 0000:11:00.0: PCI INT A -> GSI 19 (level, low) -> IRQ 19

Feb  6 14:21:10 vostro kernel: 0000:11:00.0: ttyS0 at I/O 0xc000 (irq = 19) is a ST16650V2

Feb  6 14:21:11 vostro kernel: serial 0000:11:00.1: enabling device (0100 -> 0103)

Feb  6 14:21:11 vostro kernel: serial 0000:11:00.1: PCI INT B -> GSI 16 (level, low) -> IRQ 16

Feb  6 14:21:11 vostro kernel: 0000:11:00.1: ttyS1 at I/O 0xc008 (irq = 16) is a ST16650V2

Feb  6 14:21:11 vostro kernel: parport_serial 0000:11:00.2: enabling device (0100 -> 0103)

Feb  6 14:21:11 vostro kernel: parport_serial 0000:11:00.2: PCI INT C -> GSI 17 (level, low) -> IRQ 17

Feb  6 14:21:11 vostro kernel: parport0: PC-style at 0xc010 (0xc018), irq 17, using FIFO [PCSPP,TRISTATE,COMPAT,ECP]

Feb  6 14:21:11 vostro kernel: parport0: Printer, HEWLETT-PACKARD OFFICEJET R45

Feb  6 14:21:11 vostro kernel: lp0: using parport0 (interrupt-driven).
```

```
# lspci

[cut]

11:00.0 Serial controller: NetMos Technology Device 9912

11:00.1 Serial controller: NetMos Technology Device 9912

11:00.2 Parallel controller: NetMos Technology Device 9912

# lspci -v

[cut]

11:00.0 Serial controller: NetMos Technology Device 9912 (prog-if 02 [16550])

        Subsystem: Device a000:1000

        Physical Slot: 7

        Flags: fast devsel, IRQ 19

        I/O ports at c000 [size=8]

        Memory at f6c00000 (32-bit, non-prefetchable) [size=4K]

        Memory at f6c01000 (32-bit, non-prefetchable) [size=4K]

        Capabilities: [50] MSI: Enable- Count=1/8 Maskable- 64bit+

        Capabilities: [78] Power Management version 3

        Capabilities: [80] Express Legacy Endpoint, MSI 00

        Capabilities: [100] Virtual Channel

        Capabilities: [800] Advanced Error Reporting

        Kernel driver in use: serial

11:00.1 Serial controller: NetMos Technology Device 9912 (prog-if 02 [16550])

        Subsystem: Device a000:1000

        Physical Slot: 7

        Flags: fast devsel, IRQ 16

        I/O ports at c008 [size=8]

        Memory at f6c02000 (32-bit, non-prefetchable) [size=4K]

        Memory at f6c03000 (32-bit, non-prefetchable) [size=4K]

        Capabilities: [50] MSI: Enable- Count=1/8 Maskable- 64bit+

        Capabilities: [78] Power Management version 3

        Capabilities: [80] Express Legacy Endpoint, MSI 00

        Capabilities: [100] Advanced Error Reporting

        Kernel driver in use: serial

11:00.2 Parallel controller: NetMos Technology Device 9912 (prog-if 03 [IEEE1284])

        Subsystem: Device a000:2000

        Physical Slot: 7

        Flags: fast devsel, IRQ 17

        I/O ports at c010 [size=8]

        I/O ports at c018 [size=8]

        Memory at f6c04000 (32-bit, non-prefetchable) [size=4K]

        Memory at f6c05000 (32-bit, non-prefetchable) [size=4K]

        Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+

        Capabilities: [78] Power Management version 3

        Capabilities: [80] Express Legacy Endpoint, MSI 00

        Capabilities: [100] Advanced Error Reporting

        Kernel driver in use: parport_serial

        Kernel modules: parport_serial

#
```

----------

