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

6 comments
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:

Dta1xx.c:
---------
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
ioctl: Dta1xxIoCtl,
#else
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
{ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
struct inode *inode = file->f_dentry->d_inode;
#else
struct inode *inode = file->f_path.dentry->d_inode;
#endif
// 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:
IoCtl.c
Dta1xx.c
Dta1xx.h
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.
Copyright © IT pages