How to patch the latest Dektec Linux SDK for Linux KERNEL 2.6.38+

If you get the latest Dektec SDK for Linux that was released in May 2011,
you will get compilation problems under Ubuntu 11.04 which is now using
the latest Linux kernel 2.6.38

I spent some time trying to understand what was the problems.
The main two problems are refactored methods under the kernel:
- MUTEX methods renamed to stick to semaphore stuff
- IOCTL redefinitions (ioctl -> compat_ioctl -> unlocked_ioctl)

Therefore for example in the directory Dta1xx (for cards 1xx but
this is exactly the same patch for Dtu2xx and Dta1xxNw), you just have to patch
those 3 files in order to compile the kernel module:

ioctl: Dta1xxIoCtl,
unlocked_ioctl: Dta1xxNewIoCtl,
#endif #ifdef CONFIG_COMPAT
compat_ioctl: Dta1xxCompatIoCtl,
#endif Dta1xx.h: --------- // PATCH for new kernel 2.6.38+ to avoid: error: implicit declaration of function ‘init_MUTEX’ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
#ifndef init_MUTEX
#define init_MUTEX(_m) sema_init(_m,1);
#endif // #ifndef init_MUTEX
#endif ... Int Dta1xxIoCtl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); Int Dta1xxNewIoCtl(struct file *file, unsigned int cmd, unsigned long arg); #ifdef CONFIG_COMPAT long Dta1xxCompatIoCtl(struct file *filp, unsigned int cmd, unsigned long arg); #endif IoCtl.c: -------- ... int Dta1xxNewIoCtl(
struct file *file, // Represents file object
unsigned int cmd, // Command
unsigned long arg) // Pointer to the IoCtl parameter
struct inode *inode = file->f_dentry->d_inode;
struct inode *inode = file->f_path.dentry->d_inode;
// Just call the regular IOCTL handler
return Dta1xxIoCtl(inode, file, cmd, arg);

I hope it will help you.

As it seems far better to provide the full source code than patches
so here are the file links on the Dta1xx files to replace in the Dektec SDK:
You will see that a "make" and "make install" will work and then you will be able to call the driver launch command "sh ./Dta1xxInit start" as explained in their ReadMe file.
To see if the driver is fully loaded you can check the linux log using "dmesg" command.

I also tried on Linux MINT distro too.
Those patches have also been sent to Dektec that they will integrate in their next release.


amertum said...

T'es vraiment trop balaise ! ;-)

Conan_Fr said...

This guy did have the same problem:

I contacted him and he will try ...

Anonymous said...

Hm. I still have compile-time errors after patching:

Anonymous said...

Does this patch works for you? And what is your kernel version - mine is 2.6.38-r7 (Gentoo).

Conan_Fr said...

Hi Tim. I've seen your comments and I suppose that my patch explanation was not so easy. Here are the files that will help and avoid those copy and paste errors.
I will burn the Gentoo LiveDVD and check ...

Right here under Mint distro, my kernel is 2.6.38-8-generic (same one as the Ubuntu 11.04)

Ricardo Martinez said...

In case anybody run into the same problem with newer kernels.
For kernel 3.11 I had to do the following additional changes:

$(CXX) $(CPPFLAGS) $^ $(LDLIBS) $(LDFLAGS) -o $@



Post a Comment

Copyright © IT pages