First, I should have changed the subject for the last email with the patch, sorry.
Also, below is an example/proof program which connects/disconnects an interface using Dave's ioctl (as contained in the last email's patch). On Mon, 22 Oct 2001 [EMAIL PROTECTED] wrote: >On Mon, 22 Oct 2001, David Brownell wrote: > >>> Someone proposed an ioctl() some time ago to force a kernel-module to >>> release an interface, but I never saw it implemented. >> >>It was implemented, and I hope to dust off the patch this week. Check >>list archives for January. > >The original posting is here: > >http://marc.theaimsgroup.com/?l=linux-usb-devel&m=98002097701710&w=2 > >and below is the patch updated to 2.4.12, with additions. [removed] #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <errno.h> #include <string.h> #include <sys/ioctl.h> #include <linux/usbdevice_fs.h> #define EXIT_ERR(err) do {\ printf("%s\n", strerror(err));\ printf("Usage :\n");\ printf(" %s <devnode> [-|+]<interface number>\n\n", argv[0]);\ printf(" Use negative interface number to disconnect, positive (default) to connect.\n");\ return -err;\ } while(0) #define CONNECT 1 #define DISCONNECT 2 int main( int argc, char *argv[] ) { struct usbdevfs_ioctl *connect_ioctl; int iface_num, fd, mode; char *devnode, **endptr; char *modestr, *disconnect = "disconnect", *connect = "connect"; if (argc != 3) EXIT_ERR( EINVAL ); if (!(endptr = malloc(sizeof(*endptr)))) EXIT_ERR( ENOMEM ); if (!(connect_ioctl = malloc(sizeof(*connect_ioctl)))) { free(endptr); EXIT_ERR( ENOMEM ); } devnode = argv[1]; mode = CONNECT; if ('-' == argv[2][0]) mode = DISCONNECT; errno = 0; iface_num = strtol( argv[2], endptr, 10 ); if (errno) EXIT_ERR( errno ); if (*endptr == argv[2]) EXIT_ERR( EINVAL ); free(endptr); modestr = mode == DISCONNECT ? disconnect : connect; connect_ioctl->ifno = abs( iface_num ); connect_ioctl->ioctl_code = mode == DISCONNECT ? USBDEVFS_DISCONNECT : USBDEVFS_CONNECT; connect_ioctl->data = NULL; errno = 0; if (0 > (fd = open( devnode, O_RDWR ))) EXIT_ERR( errno ); errno = 0; if (ioctl( fd, USBDEVFS_IOCTL, connect_ioctl )) { fprintf( stderr, "Could not %s interface %d : %s\n", modestr, connect_ioctl->ifno, strerror( errno ) ); free(connect_ioctl); return -errno; } printf( "%sed interface %d\n", modestr, connect_ioctl->ifno ); if ( CONNECT == mode ) printf( " (Connecting always succeeds)\n" ); free(connect_ioctl); return 0; } _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel