On Friday 03 January 2003 01:07, you wrote:
> Am Donnerstag, 2. Januar 2003 22:43 schrieben Sie:
> > On Thursday 02 January 2003 18:38, Oliver Neukum wrote:
> > > > I am trying to reset any device with the ioctl from the subject.
> > > >
> > > > RESET should be disconnect/probe as seen in usbdev_resetdevice from
> > > > devio.c ?
> > > >
> > > > So far I have tried it on printer, isdn base station and custom
> > > > device but all I get is device being disconnected. Probe is not being
> > > > called.
> > >
> > > 2.4 or 2.5 ?
> > >
> > > Both seem to be broken in different ways.
> >
> > 2.4. (19) . So no luck ? :(
>
> That is very odd. What does ioctl() return?
> There's no code path that could cause a disconnect without
> a following probe in proc_resetdevice().

I agree, but it is not called nevertheless...

ioctl returns 0, like everything is ok. Below are some details...

test program:
<attached>

output:

open: fd=3, filename=/proc/bus/usb/003/004
ioctl rc=0

log:
Jan  3 11:43:01 equinoxe kernel: usb.c: USB disconnect on device 4


After this, another test:

bash # ls /proc/bus/usb/003/
.  ..  001

Just the root hub.

Regards,
Tvrtko A. Ursulin



#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>

#include <linux/usbdevice_fs.h>

int main ( int argc, char *argv[] )
{
	if ( argc < 2 )
	{
		printf("bad usage!\n");
		exit(-1);
	}

	int fd = open(argv[1],O_RDWR);

	printf("open: fd=%d, filename=%s\n",fd,argv[1]);

	if ( fd < 0 )
	{
		printf("open: (%d) %s\n",errno,strerror(errno));
		exit(-2);
	}

	int rc = ioctl(fd,USBDEVFS_RESET);

	if ( rc )
	{
		printf("ioctl error: (%d) %s!\n",errno,strerror(errno));
		exit(-3);
	}


	printf("ioctl rc=%d\n",rc);

	close(fd);

	return 0;
}

Reply via email to