DSRemote/kernel
Teuniz a1f19eb472 Work in progress. 2015-06-02 16:20:56 +02:00
..
Makefile Add the usbtmc driver patch. 2015-05-30 16:38:54 +02:00
README Work in progress. 2015-06-02 16:20:56 +02:00
patch Added the kernel patch file. 2015-05-31 09:42:23 +02:00

README

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 "3.16.7-21-desktop" with your actual kernel version.
The easiest way to get this version is to use the command uname -r.

cp /lib/modules/3.16.7-21-desktop/source/include/uapi/linux/usb/tmc.h .

cp /lib/modules/3.16.7-21-desktop/source/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.