OpenWrt Forum Archive

Topic: New OpenWrt package: Driver for Velleman K8055 USB I/O board

The content of this topic has been archived on 3 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I have written a driver for the Velleman K8055 USB Experiment Interface Board.
The K8055 is an USB device which gives the user several digital and analog inputs and outputs.

The package is hosted on sourceforge and named 'K8055 Driver' (k8055d).
http://sourceforge.net/projects/k8055d/

From the package description:

In need of (extra) gpio ports? If you have an openwrt compatible
router with USB ports like the Asus WL500gP then this may
no longer be a problem. This driver provides a /proc interface for
the in- and outputs of the Velleman K8055. Up to 4 boards are supported,
A single K8055 provides 5 inputs and 8 outputs (digital), 2 analog in-
and 2 analog outputs with 8bit resolution and 2 16bit counters.
The /proc interface allows the inputs and outputs to be read from and
written to as if they were a file.

I have only been able to test the driver on my own OpenWrt device (Asus WL500gP) that is running Kamikaze 7.09 (kernel 2.4 bcrm). 2.6 support will hopefully be finished in the next release but is currently completely untested.

I just uploaded version 0.1.1

Changelog:

- OpenWrt: Added linux 2.6 support for kamikaze 7.09.
- OpenWrt: Now loads k8055d __before__ usbhid.
- i386 PC: Added 'make install'
- Fixed some typos in, and updated the README.

I have tried to install the ipkg: kmod-k8055d_0.1.2_2.4.34-brcm-1_mipsel.ipk on WL500GP running openwrt-brcm-2.4-squashfs.trx. (Kamikaze 7.09)
Everything appears to load ok, - the proc interfaces are created nicely.
However if i do a:

cat /proc/k8055/0/in1       it fails with:
cat: read error: bad address

and

echo 255 > /proc/k8055/0/outputs        does not set any of the outputs

Any ideas?

(Last edited by pfugl on 28 Feb 2008, 18:37)

Hi,

thanks for doing this work. I look forward to the support for the 2.6 kernel.

In my setup which is an Asus WL500gP that is running Kamikaze 7.09 (kernel 2.6 bcrm), the driver install nicely and it creates the /proc/k8055 folder but it does not create the rest of the folders and I dont think it recognizes the k8055 board.

knut

Hello pfugl and knutigro, thank you for posting your experiences with this driver.

pfugl: I am unable to reproduce the error that you get (I upgraded to the 2.6 kernel). Perhaps you can post your kernel log (dmesg | grep k8055d). I would also like to see the output of 'lsusb', but I believe the usbutils package is X-wrt only.

knutigro: I can reproduce the error that you get in two ways;

- The k8055 board needs to be connected directly to your router, NOT through an usb hub.
  For some reason usb1 devices don't work when connected via a hub.

- USB v1 devices need the kmod-uhci (or kmod-uhci-iv) package.
  The k8055 driver depends on the following packages:
    - kmod-usb-core
    - kmod-uhci or kmod-uhci-iv

In both your cases the kernel log should contain the following messages:

'usbcore: registered new interface driver k8055d'
This means that the driver is loaded and creates /proc/k8055.

'k8055d: Velleman K8055 #0 now attached'
'k8055d: New interface created in /proc/k8055/0/...'
This means that the k8055 was detected and creates the /proc/k8055/0/ directory.

I hope this helps.

Thank you for trying to help. In the meantime I have upgraded to 2.6 kernel, and my K8055 works ok now.

Yippi,

As you suggested I had missed installing the the kmod-uhci. Now it works!

Thank you  :-)

Unfortunately I need to go back to linux 2.4.35.4, as I need the WIFI interface, which as you may know, does not work on kernel 2.6 with ASUS WL-500GP and Broadcom wifi card.
So I am back to the old problem (I compiled latest SVN 10926):

root@OpenWrt:/proc/k8055/0# ls
adc1       dac1       in1        in5        out3       out7
adc2       dac2       in2        inputs     out4       out8
counter1   debounce1  in3        out1       out5       outputs
counter2   debounce2  in4        out2       out6
root@OpenWrt:/proc/k8055/0# cat in1
cat: read error: Bad address

I have compiled it with debug on, and posted the info you requested earlier in the thread:

root@OpenWrt:/proc/k8055/0# dmesg | grep k8055
usb.c: registered new driver k8055d
k8055d debug: usb_k8055_send_msg: CMD 0x05, retv = -22 bytes written = 500
k8055d debug: usb_k8055_send_msg: CMD 0x05, retv = -22 bytes written = 500
k8055d debug: usb_k8055_send_msg: CMD 0x03, retv = -22 bytes written = 500
k8055d debug: usb_k8055_send_msg: CMD 0x04, retv = -22 bytes written = 500
k8055d: Velleman K8055 #0 now attached
k8055d: New interface created in /proc/k8055/0/...
k8055d debug: usb_k8055_read_msg: retv = -22 bytes written = 0
k8055d debug: proc_k8055_read: Could not read from K8055 #0
root@OpenWrt:/proc/k8055/0# lsusb
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 002 Device 002: ID 10cf:5500 Velleman Components, Inc. 8055 Experiment Interface Board (address=0)
Bus 001 Device 001: ID 0000:0000

I know you are using 2.6 kernel, but if you have any suggestions, i am able to make changes to the source and recompile it her for 2.4 kernel.
I hope the debug output can give you a hint.

/Peter

I found the problem: I had both the kmod-usb-uhci and the kmod-usb-uhci-iv packages installed. When I uninstalled the kmod-usb-uhci package, leaving only the kmod-usb-uhci-iv,  the k8055 worked ok.

/Peter

I'll try to fix dependancy problems like this in the next release...

First of all thanks for the k8055 code, i was looking for something like this for a long time.
I recently installed the 8.09 release and the .ipk packages where not working for that release. So i installed the buildroot and tried compiling it myself.
After a lot of try and error i succeeded. The only thing that in i needed was :
nico@nico-desktop:~/kamikaze/package/k8055d-0.1.2/src$ diff k8055-drv.c k8055-drv.c-org
52d51
< #include <linux/init.h>

Maybe someone can make a patch or contribute this compiled package to the repository because I don't have the knowledge nor the credentials to do this.
Regards,
Nico

BTW I used the brcm image for my asus wl500g deluxe.

Hello,
everything works fine with backfire 10.03 , kernel 2.6.32.10
I compiled myself the package with buildroot ,   only 1 problem:
when i do a cat  /proc/k8055/0/in3   or cat /proc/k8055/0/outputs    then it displays a value , and then keeps on scrolling !!
cursor is not coming back  until  ctrl-c

what can it be ?

I have the same problem both on nslu2 and asus-wl500.
This problem appear with release k8055d-0.1.5.
I use release k8055d-0.1.3 and this works fine with trunk 2.6.32.27-1.
release k8055d-0.1.4 does not compile.

The discussion might have continued from here.