This is a note to let you know that I’ve just added a driver for the Velleman K8055/K8061 USB board to the linux kernel.
The code interacts with the USB subsystem of the kernel and the COMEDI (comedi.org/).
The driver can manage all features what the boards has to offer + support up to 48! boards.
At this time you will need to patch the latest (next-)kernel to get the driver to build properly.
For a HOWTO take a look at kernel.org/pub/linux/kernel/ … hes/README
Path and name of the driver module:
linux/drivers/staging/comedi/drivers/vmk80xx.c
In the future you will only need a linux kernel to control your board…no internet conn. required to get a driver or lib
It would be nice if you could post your experiences with this driver or send me an email.
Nice work, i’m sure this will be very useful to fellow linux users
One small question, where does the 48 board restriction come from? Mind that my understanding of linux driver development is rather basic, it’s been a while since I’ve even read about it + all the kernel differences
#define VMK8055_MAX_BOARDS 16
static struct vmk80xx_usb vm_boards[VMK8055_MAX_BOARDS];
This piece of code stems by the first patch file. At this time the driver had support up to 16 boards.
The newest patch (staging-comedi-vmk80xx-add-k8061-support.patch) contains an update:
P.S.
You will find all patches in the gregkh’s staging tree kernel.org/pub/linux/kernel/ … 5-staging/
There are three patches:
staging-comedi-add-vmk80xx-usb-driver.patch
staging-comedi-vmk80xx.c-get-the-driver-to-build-properly.patch
staging-comedi-vmk80xx-add-k8061-support.patch
Good work, I bought a VM110 from Maplin’s a couple of days ago and I already have flashing LEDs!
It works almost out of the box with Ubuntu 9.10 (Karmic); the kernel comes with the staging drivers built, and libcomedi-dev is in the repositories. However, I didn’t get a /dev/comedi0, and it seems that the usbhid module is claiming the device. I have the following couple of workarounds in place:
And a setup script which I run before starting work. I’ve hardcoded the USB device ID here; I’m sure there must be a better way to extract the right one from /sys but haven’t got around to it yet:
$ cat vm110_setup
#!/bin/bash
if [ `id -u` -gt 0 ]
then
echo "Must be root"
exit 1
fi
modprobe -r vmk80xx
modprobe -r comedi
usbid="4-1:1.0"
echo "$usbid" > /sys/bus/usb/drivers/usbhid/unbind
modprobe comedi
modprobe vmk80xx
comedi_config /dev/comedi0 vmk80xx
If there’s an easier workaround then I’d be happy to hear about it!
Comedi does not create a corresponding device file under ‘/dev’ (/dev/comedi0) per default.
So, you need to do that. Either, as you writes, with a config file to load comedi at startup
or you call:
modprobe comedi comedi_num_legacy_minors=1
While working with Comedi I don’t have any problems in combination with usbhid. In case of
need you could put an entry to ‘/etc/modprobe.d/blacklist’ to disallow modprob’ing usbhid.
As you maybe already know, vmk80xx based on Comedi,
or interacts with Comedi, respectively. Comedi itself
provides a library (Comedilib) which allows you to do
some useful with the corresponding data acquisition card.
For instance, read from or write to an analog channel,
counter or something else.
Comedilib is implemented in C, so you need to be familiar
with the C programming language. Take a look at comedi.org/doc/index.html to get an overview
about the application development with Comedilib.
Thanks for the response MG.
I did actually start looking down the lines you suggest, but, given the example program…
[code]#include <stdio.h> /* for printf() */ #include <comedilib.h>
int subdev = 0; /* change this to your input subdevice /
int chan = 0; / change this to your channel /
int range = 0; / more on this later /
int aref = AREF_GROUND; / more on this later */
int main(int argc,char *argv[])
{
comedi_t *it;
lsampl_t data;
return 0;
}[/code]
I realised I didn’t know what channels, for example, map to which inputs and outputs on the K8055 board (I assume that’s how it works but haven’t had a great deal of time to devote to it, which is why I was hoping there was some simple example code kicking around I’ll keep reading the comedi docs!
I am trying to enable a Velleman Card k8055 with Comedi , with a bash
script but it sends me
root@virk-desktop:/home/virk# ./k8055_setup.sh
Configure failed!: No such device
Check kernel log for more information
Possible reasons for failure:
Unknown
This is the script (k8055_setup.sh)
Someone can help me?
Thanks
[code]#!/bin/bash
if [ id -u -gt 0 ]
then
echo “Must be root”
exit 1
fi
have you read the post from mallux on page 1 of this topic? He used
a setup script similar to yours, but it also prevents that the ‘usbhid’
module claims the device.
#!/bin/bash
if [ `id -u` -gt 0 ]
then
echo "Must be root"
exit 1
fi
modprobe -r vmk80xx
modprobe -r comedi
usbid="4-1:1.0"
echo "$usbid" > /sys/bus/usb/drivers/usbhid/unbind
modprobe comedi
modprobe vmk80xx
comedi_config /dev/comedi0 vmk80xx
Note that the device ID is hardcoded, so you need to
determine your devid.
How come the driver for the k8055 is still not in the kernel 2.6.34-gentoo-r1 ??
What exact kernel to use ?
There is no ebuild for compiling the comedi and k8055 drivers ?
With this driver, will it be detected by labview for linux ?
Without this driver and using libk8055, will it be usable with labview for linux ?
Is there any .vi to use with k8055 and labview 8.5 for linux ?