On Sat, 10 Mar 2007, Gene Heskett wrote:

> >I think there is alternative for you that can be done completely in 
> >userland, without seeding mess into the kernel driver - do you think it 
> >would be feasible that you create a trivial and small library, that
> I'm not up to writing a library. 15 years ago maybe, before the wet ram 
> started to fade (I'm 72 now), I was pretty good with the 8 bit machines 
> and wrote code & built boards in 1980 for an 1802 machine that was used 
> till the later 90's, and repeated that in 1989 which we used till 2002, 
> but linux is a whole new concept even if I have been running it since 
> rh5.1 days. Are you aware of something that might serve as a starting 
> framework to be hacked into doing this?

This is really failry trivial thing to do. Just cook up a fake wrapper 
ioctl() library, something like this:

== ioctl.c ==
#define _GNU_SOURCE
#include <dlfcn.h>

long ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
{
        long (*orig_ioctl)(unsigned int, unsigned int, unsigned long) = 
dlsym(RTLD_NEXT, "ioctl");

        if (cmd == /* put here the evil ioctl number the app is calling */)
                return 0;
        else
                return orig_ioctl(fd, cmd, arg);
}
==

Then compile this like

        gcc -shared -ldl ioctl.c -o ioctl.so

and then just execute your strange_application by

        LD_PRELOAD=ioctl.so /path/to/broken/strange_application

Every ioctl() the application issues will then first pass through your 
wrapper, where you can catch all the broken ioctl(), and let the correct 
one pass through glibc to kernel on its usual way.


I am still however pretty far from being convinced that this will make 
your application work. But as I absolutely don't know what your 
application is expecting to obtain from serial port and how does this 
compare to what it is getting from usb hiddev, it's just wild guesses.

-- 
Jiri Kosina

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to