Hi, you need to include the new kernel header files when you build. The JNI has
#include <linux/usbdevice_fs.h> which is where the #define for USBDEVFS_DISCONNECT is located, it's a macro so the actual number is something arbitrary. You should just make sure, during build, that the file is included correctly. The compiler automatically includes the /usr/include directory, which has a linux/ directory matching whatever kernel was installed with your system. You need to either update the link by doing: cd /usr/include mv linux linux-old ln -s /usr/src/linux/include/linux where /usr/src/linux is a link to the 'real' directory, i.e. cd /usr/src rm linux ln -s linux-2.4.23-pre7 linux or, you can put the directory directly on the compile line (by editing the Makefile or calling gcc yourself), e.g. gcc -I/usr/src/linux/include ...whatever... including linux header files can get complicated though...if you are really interested in the details, search google or search the linux-kernel archives. For this simple program either of the above will work. On Tue, 21 Oct 2003, Aaron Metzger wrote: >Dan and Aurelien: > >Thank you for the info regarding the use of UsbInterfacePolicy to >allow a "forceClaim". > >I have recently upgraded to 2.4.23-pre7 to get a kernel with support >for the disconnect behavior. > >Apparently, a minor native code change in the reference implementation >is also required to enable support for forceClaim in addition to using >a recent kernel version. > >It appears that "USBDEVFS_DISCONNECT" needs to be defined during the >native code compilation. > >However, a simple #define is not enough. > >The code > >void disconnect_interface_driver(JNIEnv *env, int fd, int interface) >{ > struct usbdevfs_ioctl *disc_ioctl = NULL; > > > > if (!(disc_ioctl = malloc(sizeof(*disc_ioctl)))) { > log( LOG_CRITICAL, "Out of memory!" ); > return; > } > > > > disc_ioctl->ifno = interface; > disc_ioctl->ioctl_code = USBDEVFS_DISCONNECT; > disc_ioctl->data = NULL; > >actually makes use of the VALUE of the define to initialize the >ioctl_code. > >Is "disc_ioctl->ioctl_code" supposed to be set to 1 here or is some >other value expected? > >Is a direct edit of JavaxUsb.h the intended place to enable the >disconnect functionality or is there some other configuration or make >file option that I missed? > >Thanks. > > > >Dan Streetman wrote: > >> I think using the UsbInterfacePolicy.forceClaim() is the best way to do >> things, and the Linux implementation can keep up with changes the Linux >> kernel makes in how it's done at a low level. Also, it hopefully will be >> somewhat portable to other OSes... >> >> >> On Sat, 11 Oct 2003, Aurelien Godin wrote: >> >> >>>In a previous archive, Dan Streetman wrote that : >>> >>>>>The most interesting change is the UsbInterfacePolicy. An interesting >>>>>side note to the policy is the 'forceClaim' option, which allows you (on >>>>>certain Linux kernels, 2.5 and from 2.4.23-pre2) to remove existing USB >>>>>drivers from any usb interface, so you can drive the interface from >>>>>userspace. >>> > > > >------------------------------------------------------- >This SF.net email is sponsored by OSDN developer relations >Here's your chance to show off your extensive product knowledge >We want to know what you know. Tell us and you have a chance to win $100 >http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54 >_______________________________________________ >javax-usb-devel mailing list >[EMAIL PROTECTED] >https://lists.sourceforge.net/lists/listinfo/javax-usb-devel > -- Dan Streetman [EMAIL PROTECTED] --------------------- 186,272 miles per second: It isn't just a good idea, it's the law! ------------------------------------------------------- This SF.net email is sponsored by OSDN developer relations Here's your chance to show off your extensive product knowledge We want to know what you know. Tell us and you have a chance to win $100 http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54 _______________________________________________ javax-usb-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/javax-usb-devel