Re: usb_bulk_read return -22
Ze Hou Zhang <[email protected]> Tue, 7 Apr 2020 12:12:08 +0100
| Newsgroups | gmane.comp.lib.libusb.devel.windows |
|---|---|
| Message-ID | <CADt527jh0A74qbM-yPjO1jY8m7yJqq1v-M7hm1LJ8qHyy+odvQ@mail.gmail.com> |
--===============5281412028435347450== Content-Type: multipart/alternative; boundary="00000000000003a24605a2b1752a" --00000000000003a24605a2b1752a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Xiaofan I open and received device handler, and be able to use usb_control_msg to send and receive data. also checked device interface endpoints, but I can=E2=80=99t use usb_bulk_read to read big buffer from device which suppos= ed to be ready Thanks On Fri 3 Apr 2020 at 03:28, Xiaofan Chen <[email protected]> wrote: > On Thu, Apr 2, 2020 at 1:00 AM Ze Hou Zhang <[email protected]> wrote= : > > > > Hi All > > I dont have a lot experience for developping embedded system. > > I encounter this problem > > My hardware is : > > int vid =3D 0x24aa; > > int pid =3D 0x1000; > > std::string firmwarePartNum =3D "170003"; > > std::string firmwareDesc =3D "FX2 USB Board"; > > bool isSupported; > > unsigned int defaultPixels =3D 1024; > > unsigned int spectraBlockSize =3D 1024 * 2; > > unsigned int usbDelayMS =3D 0; > > bool hasDefaultTECSetpointDegC =3D false; > > int defaultTECSetpointDegC =3D 0; > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > int size =3D 512; > > char* buf =3D new char[size]; > > int endpoint =3D 130; > > int timeout =3D 150; > > > > int isok =3D usb_bulk_read(*deviceHandle, endpoint, bytes, > size, timeout); > > > > Output: ok =3D -22 > > Thanks > > > > You have to know the communication protocol of the device in order > to use libusb-win32. In your case, you need to make sure your device > is sending data. > > > -- > Xiaofan > > > _______________________________________________ > Libusb-win32-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel > --=20 __ S=C3=A9anadh R=C3=ADomhphoist/_ Email=C2=A0Disclaimer__ ** T=C3=A1 an r=C3=ADomhphost seo agus=20 aon chomhad a sheoltar leis faoi r=C3=BAn agus is lena =C3=BAs=C3=A1id ag a= n seola=C3=AD agus=20 sin amh=C3=A1in =C3=A9.=C2=A0Is f=C3=A9idir tuilleadh a l=C3=A9amh anseo.= =20 <https://www4.dcu.ie/iss/seanadh-riomhphoist.shtml>=C2=A0=20 <https://www4.dcu.ie/iss/seanadh-riomhphoist.shtml>* _ This e-mail and any=20 files transmitted with it are confidential and are intended solely for use= =20 by the addressee.=C2=A0Read more here.=20 <https://www4.dcu.ie/iss/email-disclaimer.shtml>=C2=A0_ *_ --00000000000003a24605a2b1752a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div><br></div><div><div dir=3D"auto">Hi Xiaofan</div><div dir=3D"auto">I o= pen and received device handler, and be able to use usb_control_msg to send= and receive data. =C2=A0also checked device interface endpoints, but I can= =E2=80=99t use usb_bulk_read to read big buffer from device which supposed = to be ready</div><div dir=3D"auto">Thanks</div><br><div class=3D"gmail_quot= e"><div dir=3D"ltr" class=3D"gmail_attr">On Fri 3 Apr 2020 at 03:28, Xiaofa= n Chen <<a href=3D"mailto:[email protected]">[email protected]</a>>= wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8= ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Apr 2, 2020 at 1:00= AM Ze Hou Zhang <<a href=3D"mailto:[email protected]" target=3D"_bl= ank">[email protected]</a>> wrote:<br> ><br> > Hi All<br> > I dont have a lot experience for developping embedded system.<br> > I encounter this problem<br> > My hardware is :<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0int vid =3D 0x24aa;<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0int pid =3D 0x1000;<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0std::string firmwarePartNum =3D "= ;170003";<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0std::string firmwareDesc =3D "FX= 2 USB Board";<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0bool isSupported;<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int defaultPixels =3D 1024;<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int spectraBlockSize =3D 102= 4 * 2;<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int usbDelayMS =3D 0;<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0bool hasDefaultTECSetpointDegC =3D fa= lse;<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0int defaultTECSetpointDegC =3D 0;<br> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 int size =3D 512;<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0char* buf =3D new char[= size];<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0int endpoint =3D 130;<b= r> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0int timeout =3D 150;<br= > ><br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0int isok =3D usb_bulk_r= ead(*deviceHandle, endpoint, bytes, size, timeout);<br> ><br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Output:=C2=A0 ok =3D -22<br> > Thanks<br> ><br> <br> You have to know the communication protocol of the device in order<br> to use libusb-win32. In your case, you need to make sure your device<br> is sending data.<br> <br> <br> -- <br> Xiaofan<br> <br> <br> _______________________________________________<br> Libusb-win32-devel mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blan= k">[email protected]</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel"= rel=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/l= istinfo/libusb-win32-devel</a><br> </blockquote></div></div> <br> <pre style=3D"background-color:rgb(255,255,255)"><i style=3D"color:rgb(146,= 146,146);font-family:Verdana;white-space:normal;font-size:10px"><div style= =3D"color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-= style:normal"><i style=3D"color:rgb(146,146,146);font-family:verdana;font-s= ize:10px"><p style=3D"font-style:normal;font-family:verdana,arial,helvetica= ,sans-serif;display:inline"><strong>S=C3=A9anadh R=C3=ADomhphoist/</strong>= </p></i><i style=3D"color:rgb(146,146,146);font-family:verdana;font-size:10= px"><p style=3D"font-style:normal;font-family:verdana,arial,helvetica,sans-= serif;display:inline"><strong>Email=C2=A0Disclaimer</strong></p></i></div><= pre style=3D"white-space:pre-wrap;color:rgb(34,34,34);font-style:normal"><i= ><div style=3D"font-family:arial,sans-serif;font-style:normal;white-space:n= ormal"><pre style=3D"white-space:pre-wrap"><i><p style=3D"display:inline"><= span style=3D"color:rgb(146,146,146);font-family:verdana,arial,helvetica,sa= ns-serif;white-space:normal">T=C3=A1 an r=C3=ADomhphost seo agus aon chomha= d a sheoltar leis faoi r=C3=BAn agus is lena =C3=BAs=C3=A1id ag an seola=C3= =AD agus sin amh=C3=A1in =C3=A9.=C2=A0<font color=3D"#1155cc"><a href=3D"ht= tps://www4.dcu.ie/iss/seanadh-riomhphoist.shtml" target=3D"_blank">Is f=C3= =A9idir tuilleadh a l=C3=A9amh anseo.</a></font></span><span style=3D"color= :rgb(146,146,146);font-family:verdana,arial,helvetica,sans-serif;font-style= :normal;white-space:normal"><a href=3D"https://www4.dcu.ie/iss/seanadh-riom= hphoist.shtml" target=3D"_blank">=C2=A0</a></span></p></i></pre></div><div = style=3D"font-family:arial,sans-serif;font-style:normal;white-space:normal"= ><i style=3D"white-space:pre-wrap"><p style=3D"color:rgb(146,146,146);font-= family:verdana,arial,helvetica,sans-serif;white-space:normal;font-style:nor= mal;display:inline"><em>This e-mail and any files transmitted with it are c= onfidential and are intended solely for use by the addressee.=C2=A0<font co= lor=3D"#1155cc"><a href=3D"https://www4.dcu.ie/iss/email-disclaimer.shtml" = target=3D"_blank">Read more here.</a></font>=C2=A0</em></p></i></div></i></= pre></i></pre> --00000000000003a24605a2b1752a-- --===============5281412028435347450== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============5281412028435347450== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Libusb-win32-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel --===============5281412028435347450==--