|
From: <ste...@we...> - 2007-08-08 19:10:50
|
Thanks for the patch, Rob! I'll add this soon.
Stephan
>=20
> >=20
> > I had to fix the code that comprises the function create=5Furb() in the
> > file transfer.c for proper handling of the packet=5Fsize parameter for
> > isochronous reads (see below). Also, I added proper handling for
> > num=5Fpackets as well. I had previously neglected to fill in packet=5Fsiz=
e
> > prior to this fix and zero was being passed in as packet=5Fsize resultin=
g
> > in a divide-by-zero error in the driver and the BSD.
> >=20
> >=20
> > static NTSTATUS create=5Furb(libusb=5Fdevice=5Ft *dev, URB **urb, int
> > direction,=20
> > int urb=5Ffunction, int endpoint, int
> > packet=5Fsize,=20
> > MDL *buffer, int size)
> > {
> > USBD=5FPIPE=5FHANDLE pipe=5Fhandle =3D NULL;
> > int num=5Fpackets =3D 0;
> > int i, urb=5Fsize;
> >=20
> > *urb =3D NULL;
> >=20
> > if(!get=5Fpipe=5Fhandle(dev, endpoint, &pipe=5Fhandle))
> > {
> > DEBUG=5FERROR("create=5Furb(): getting endpoint pipe failed");
> > return STATUS=5FINVALID=5FPARAMETER;
> > }
> >=20
> > /* isochronous transfer */
> > if(urb=5Ffunction =3D=3D URB=5FFUNCTION=5FISOCH=5FTRANSFER)
> > {
> > if (packet=5Fsize <=3D 0)
> > {
> > DEBUG=5FERROR("create=5Furb(): invalid packet size =3D %d",
> > packet=5Fsize);
> > return STATUS=5FINVALID=5FPARAMETER;
> > }
> >=20
> > num=5Fpackets =3D (size + packet=5Fsize - 1) / packet=5Fsize;
> >=20
> > if (num=5Fpackets <=3D 0)
> > {
> > DEBUG=5FERROR("create=5Furb(): invalid number of packets =3D %d",
> > num=5Fpackets);
> > return STATUS=5FINVALID=5FPARAMETER;
> > }
> >=20
> > if(num=5Fpackets > 255)
> > {
> > DEBUG=5FERROR("create=5Furb(): transfer size too large");
> > return STATUS=5FINVALID=5FPARAMETER;
> > }
> >=20
> > urb=5Fsize =3D sizeof(struct =5FURB=5FISOCH=5FTRANSFER)
> > + sizeof(USBD=5FISO=5FPACKET=5FDESCRIPTOR) * num=5Fpackets;
> > }
> > else /* bulk or interrupt transfer */
> > {
> > urb=5Fsize =3D sizeof(struct =5FURB=5FBULK=5FOR=5FINTERRUPT=5FTRANSFER);
> > }
> >=20
> > *urb =3D ExAllocatePool(NonPagedPool, urb=5Fsize);
> >=20
> > if(!*urb)
> > {
> > DEBUG=5FERROR("create=5Furb(): memory allocation error");
> > return STATUS=5FNO=5FMEMORY;
> > }
> >=20
> > memset(*urb, 0, urb=5Fsize);
> >=20
> > (*urb)->UrbHeader.Length =3D (USHORT)urb=5Fsize;
> > (*urb)->UrbHeader.Function =3D (USHORT)urb=5Ffunction;
> >=20
> > /* isochronous transfer */
> > if(urb=5Ffunction =3D=3D URB=5FFUNCTION=5FISOCH=5FTRANSFER)
> > {
> > (*urb)->UrbIsochronousTransfer.PipeHandle =3D pipe=5Fhandle;
> > (*urb)->UrbIsochronousTransfer.TransferFlags=20
> > =3D direction | USBD=5FSHORT=5FTRANSFER=5FOK |
> > USBD=5FSTART=5FISO=5FTRANSFER=5FASAP;
> > (*urb)->UrbIsochronousTransfer.TransferBufferLength =3D size;
> > (*urb)->UrbIsochronousTransfer.TransferBufferMDL =3D buffer;
> > (*urb)->UrbIsochronousTransfer.NumberOfPackets =3D num=5Fpackets;
> >=20
> > for(i =3D 0; i < num=5Fpackets; i++)
> > {
> > (*urb)->UrbIsochronousTransfer.IsoPacket[i].Offset =3D i *
> > packet=5Fsize;
> > (*urb)->UrbIsochronousTransfer.IsoPacket[i].Length =3D
> > packet=5Fsize;
> > }
> > }
> > /* bulk or interrupt transfer */
> > else
> > {
> > (*urb)->UrbBulkOrInterruptTransfer.PipeHandle =3D pipe=5Fhandle;
> > (*urb)->UrbBulkOrInterruptTransfer.TransferFlags=20
> > =3D direction | USBD=5FSHORT=5FTRANSFER=5FOK;
> > (*urb)->UrbBulkOrInterruptTransfer.TransferBufferLength =3D size;
> > (*urb)->UrbBulkOrInterruptTransfer.TransferBufferMDL =3D buffer;
> > }
> >=20
> > return STATUS=5FSUCCESS;
> > }
> >=20
> > Rob Krakora
> > Software Engineer
> > Delphi Electronics & Safety
> > e-mail: rob...@de...
> > phone: 765-451-8574
> >=20
> > -----Original Message-----
> > From: lib...@li...
> > [mailto:lib...@li...] On Behalf Of=
> > lib...@li...
> > Sent: Wednesday, July 25, 2007 3:04 PM
> > To: lib...@li...
> > Subject: Libusb-win32-devel Digest, Vol 14, Issue 10
> >=20
> > Send Libusb-win32-devel mailing list submissions to
> > lib...@li...
> >=20
> > To subscribe or unsubscribe via the World Wide Web, visit
> > https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
> > or, via email, send a message with subject or body 'help' to
> > lib...@li...
> >=20
> > You can reach the person managing the list at
> > lib...@li...
> >=20
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of Libusb-win32-devel digest..."
> >=20
> >=20
> > Today's Topics:
> >=20
> > 1. Not working, vista32 (Carl Kenner)
> >=20
> >=20
> > ----------------------------------------------------------------------=
> >=20
> > Message: 1
> > Date: Wed, 25 Jul 2007 22:08:39 +0930
> > From: "Carl Kenner" <car...@gm...>
> > Subject: [Libusb-win32-devel] Not working, vista32
> > To: lib...@li...
> > Message-ID:
> > <fab...@ma...>
> > Content-Type: text/plain; charset=3DISO-8859-1; format=3Dflowed
> >=20
> > Installing the latest filter driver (0.1.12.1) on my vista32 laptop
> > gives no error, but causes HID devices in device manager to have error=
> > 39, and the test program gives version -1,-1,-1,-1 for the driver (but=
> > gives the correct version for the dll).
> >=20
> > Uninstalling the filter driver makes it go back to normal.
> >=20
> > On the other hand, installing the device driver version (for the Sony
> > SIXAXIS) gives no error, everything looks right in device manager, and=
> > the test program gives the right version. But it finds a single bus,
> > and no devices. Oh, and the inf file can't be installed by
> > right-clicking and choosing "install", it can only be installed with
> > Add New Hardware, All Devices, Have Disk.
> >=20
> > In case you are wondering, the SIXAXIS is a HID joystick device which
> > doesn't describe itself correctly. It doesn't send any buttons or axis=
> > data until you read a specific feature report, but that feature report=
> > isn't listed as one it supports (although it does support/require it),=
> > so trying to read that feature report in windows with HidD=5FGetFeature
> > always fails. Which is why I need libusb to work.
> >=20
> > So... WHY isn't libusb-win32 working for me=3F There is, literally, zero=
> > documentation, which doesn't help. I don't even know if it is supposed=
> > to work on Vista.
> >=20
> > And if you don't know how to fix the bugs in libusb-win32, do you know=
> > of any other way to read a feature report from a USB HID device
> > without using HidD=5FGetFeature=3F
> >=20
> >=20
> >=20
> > ------------------------------
> >=20
> > ----------------------------------------------------------------------=
--
> > -
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems=3F Stop.
> > Now Search log events and configuration files using AJAX and a browser=
.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> >=20
> > ------------------------------
> >=20
> > =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F
> > Libusb-win32-devel mailing list
> > Lib...@li...
> > https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
> >=20
> >=20
> > End of Libusb-win32-devel Digest, Vol 14, Issue 10
> > **************************************************
> >=20
> >=20
> ************************************************************************=
****************
> >=20
> > Note: If the reader of this message is not the intended recipient,=20
> > or an employee or agent responsible for delivering this message to=20
> > the intended recipient, you are hereby notified that any=20
> > dissemination, distribution or copying of this communication is=20
> > strictly prohibited. If you have received this communication in=20
> > error, please notify us immediately by replying to the message and=20
> > deleting it from your computer. Thank you.=20
> >=20
> >=20
> ************************************************************************=
****************
> >=20
> >=20
> ------------------------------------------------------------------------=
-
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems=3F Stop.
> > Now Search log events and configuration files using AJAX and a browser=
.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F
> > Libusb-win32-devel mailing list
> > Lib...@li...
> > https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
>=20
>=20
=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F
Jetzt neu! Sch=FCtzen Sie Ihren PC mit McAfee und WEB.DE. 3 Monate
kostenlos testen. http://www.pc-sicherheit.web.de/startseite/=3Fmc=3D022220
|