Add the usbtmc driver patch.

merge-requests/1/head
Teuniz 2015-05-30 16:38:54 +02:00
rodzic 9f02bb18bd
commit 5fa2303dc1
2 zmienionych plików z 90 dodań i 0 usunięć

9
kernel/Makefile 100644
Wyświetl plik

@ -0,0 +1,9 @@
obj-m += usbtmc.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

81
kernel/README 100644
Wyświetl plik

@ -0,0 +1,81 @@
usbtmc driver patch
===================
It seems that Rigol oscilloscopes send big data (like screenshots) in an unusual way
that corrupts the data at the receiving end. The driver has been patched to deal with
this behaviour but only when the id of the device is found in a hardcoded list.
"These patches implement a modification of the USBTMC protocol to allow operation with Rigol equipment.
The usbtmc_read function is modified so if the quirk is active, the TMC header is sent with the size
of the data as the whole size of the request. If the quirk is inactive, the TMC request is sent once
per bulk transfer and with size limited to the bulk transfer size. In the case of the quirk, only the
first response contains the TMC header and the others are just data."
https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/log/drivers/usb/class/usbtmc.c
Unfortunately, the latest line of oscilloscopes of Rigol (with product id 0x04b0) has not been
added to the list into this driver.
In order to do this, we have to make a small modification to the driver sourcecode and
compile it.
Compiling:
----------
Install: kernel-desktop-devel kernel-source
In the following commands, replace the part "linux-3.16.7-21" with your actual kernel version.
The easiest way to get this version is to use the command uname -r.
cp /usr/src/linux-3.16.7-21/include/uapi/linux/usb/tmc.h .
cp /usr/src/linux-3.16.7-21/drivers/usb/class/usbtmc.c .
Somewhere around line 110 of the file usbtmc.c you will find the following code:
static const struct usbtmc_ID_rigol_quirk usbtmc_id_quirk[] = {
{ 0x1ab1, 0x0588 },
{ 0, 0 }
};
Change it into:
static const struct usbtmc_ID_rigol_quirk usbtmc_id_quirk[] = {
{ 0x1ab1, 0x0588 },
{ 0x1ab1, 0x04b0 },
{ 0, 0 }
};
Now compile it:
make
Unload the old driver using the command:
sudo rmmod usbtmc
Load the new driver using the command:
sudo insmod usbtmc.ko
Now test the driver.
When everything is ok, you can replace the old kernel module with the new one:
sudo mv /lib/modules/3.16.7-21-desktop/kernel/drivers/usb/class/usbtmc.ko \
/lib/modules/3.16.7-21-desktop/kernel/drivers/usb/class/usbtmc.ko.backup
sudo cp ./usbtmc.ko /lib/modules/3.16.7-21-desktop/kernel/drivers/usb/class/
The whole procedure must be repeated after a kernel update.