Thanks for the suggestions but so far I am still having the same problem
with the usb_control_msg. I tried kmalloc-ing buf but this made no
difference. I also tried ksymoops on the crash file but I don't
understand the output- it seems to have a lot of messages having nothing
to do with usb. Maybe I'm not using it correctly.
I have found that the problem appears to be caused by the 'usbrcvpipe'
part of the usb_control_msg command. I defined pipe =
usbrcvpipe(dev-udev,0)
and replaced the usb_conrtol_msg(dev->udev, usbrcvpipe(dev->udev,0),
0x8a, 0xc1, 0, 0, buf, 0x02, PENCAM_TIMEOUT) with
info("setting pipe");
pipe = usb_control_msg(dev->udev,0);
info("pipe set");
if ((i = usb_control_mag(dev->udev, pipe, 0x8a, ...) < 0) {
.. error msgs and return i;
}
When I insmod pendrv.o, I get the "settng pipe" message, and then the
crash
invalid operand: 0000
etc (see below)
I never get the "pipe set" message. The libusb functions (which work) do
not apppear to use the usb(snd/rcv)pipe(..) commands. I am trying to use
the libusb version of the usb_control_msg command, which uses an ioctl
command. I can't seem to get the right include file for this;
<linux/ioctl.h> and <linux/usbdevice_fs.h> do not have it (I get
unresolved symbol for ioctl after a make) and including <sys/ioctl.h>
which is used in libusb, give me errors about conflicting defines of
some names. Any idea as to why the usbrcvpipe(.. is causing the crash?
Or about how I could implement the libusb type of fuction, avoiding the
reference to usbrcvpipe?
Kevin
> > /************************************************************/
> > static void pencam_set_camera(struct usb_pencam *dev)
> > {
> > unsigned char buf[40];
>
> This <buf> should be kmalloc-ed (as Roman just wrote as I was
> writing this).
>
Did that; no effect
> > int i;
> > unsigned int pipe;
> > unsigned char request_type = 0xc1;
> >
> > memset(buf,0,sizeof(buf));
> >
> [snip]
> >
> > /* Now the linux code */
> >
> > if (usb_set_configuration(dev->udev, 1) < 0)
> > info("FAILED to set config");
> > else
> > info("Set configuration OK");
> >
> > if (usb_set_interface(dev->udev, 0,0) < 0)
> > info("FAILED to set interface");
> > else
> > info("Set interface OK");
>
> It would be good practice to save the return values from usb_set_xyz()
> above and include it in the info() calls in the failure cases,
> to see why they failed (when they do fail).
Changed the code to save the return values- not shown here
>
> > if ((i = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev,0),
> > 0x8a, 0xc1, 0, 0, buf, 0x02, PENCAM_TIMEOUT)) < 0)
> > return i;
> >
> > /* commented out everything below until I figure out what is wrong */
And the crash log:
> >
> > invalid operand: 0000
> > CPU: 0
> > EIP: 0010:[<c88f165d>]
> > EFLAGS: 00010202
> > eax: 00000300 ebx: c4c79dec ecx: c29c2c00 edx: 04000300
> > esi: c541af60 edi: c29c2c00 ebp: 00000000 esp: c4c79dc4
> > ds: 0018 es: 0018 ss: 0018
> > Process insmod (pid: 1551, stackpage=c4c79000)
> > Stack: 0000008a 000000c1 00000000 00000000 c4c79dec 00000002 000003e8
> > 00000000
> > 00000000 00000086 00000000 00000000 00000000 00000000 00000000
> > 00000000
> > 00000000 00000000 00000000 00000000 c0113e93 c88f2130 c88f2130
> > 00000000
> > Call Trace: [<c0113e93>] [<c88f2130>] [<c88f2130>] [<c88f197e>]
> > [<c0129463>] [<c88f22a4>] [<c88f2360>]
> > [<c8851ae9>] [<c88f22a4>] [<c88f2494>] [<c88f237c>] [<c885c340>]
> > [<c885186c>] [<c8851845>] [<c8851845>]
> > [<c885c348>] [<c88f1a50>] [<c8851116>] [<c88f2360>] [<c88510f3>]
> > [<c88f1000>] [<c88f1a5d>] [<c88f2360>]
> > [<c012972e>] [<c0129754>] [<c0114aa8>] [<c8851000>] [<c8851000>]
> > [<c88f2480>] [<c88fe000>] [<c88f1060>]
> > [<c0106f23>]
> >
> > Code: 0f 44 c2 0d 80 00 00 80 50 8b 0e 51 e8 2a 0b f6 ff 83 c4 30
>
> Needs to be run thru ksymoops.
Did it; don't understand the output. I'm probably doing something wrong
with that too.
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel