| 
      
      
      From: Krakora, R. V <rob...@de...> - 2007-09-03 13:57:50
      
     | 
| 
Amin:
=20
It looks like there is possibly a bug in your code.  The variable i=
 contains the size of reading blocks and that is passed in to=
 usb_bulk_read().  However, if the size of reading blocks is greater than=
 the size of the allocated buffer then there can be a buffer overrun in the=
 driver causing a blue screen or PC reboot (based on how you have Windows=
 configured to handle the exception blue screen vs. automatic reboot).  To=
 fix this, malloc() the buffer after calculating the size of reading blocks=
 (do not forget to free it).  You can configure Windows to show a blue=
 screen instead of automatically rebooting.  The blue screen will indicate=
 in which driver the exception occurred and show a dump of registers and=
 memory.
=20
Best Regards,
=20
Rob Krakora
Software Engineer
Delphi Electronics & Safety
e-mail: rob...@de...
phone: 765-451-8574
________________________________
From: lib...@li... on behalf of=
 lib...@li...
Sent: Sat 9/1/2007 3:04 PM
To: lib...@li...
Subject: Libusb-win32-devel Digest, Vol 16, Issue 1
Send Libusb-win32-devel mailing list submissions to
        lib...@li...
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...
You can reach the person managing the list at
        lib...@li...
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Libusb-win32-devel digest..."
Today's Topics:
   1. Re: libUsb Windows XP 64-bit (Xiaofan Chen)
   2. USB_BULK_READ() (amin mosayyebzadeh)
----------------------------------------------------------------------
Message: 1
Date: Sat, 1 Sep 2007 11:01:21 +0800
From: "Xiaofan Chen" <xia...@gm...>
Subject: Re: [Libusb-win32-devel] libUsb Windows XP 64-bit
To: lib...@li...
Message-ID:
        <a27...@ma...>
Content-Type: text/plain; charset=3DWINDOWS-1252
On 8/31/07, Spiro Trikaliotis <an-...@sp...>=
 wrote:
> * On Thu, Aug 30, 2007 at 07:54:14PM +0800 Xiaofan Chen wrote:
> > On 8/30/07, Bachelier, Georges <geo...@at...> wrote:
> > > We provide the libUsb-Win32 driver and DLL to our customers within=
 our
> > > software package (Atmel ? In-System Programming application). One of=
 our
> > > customers is asking for an XP 64-bit version of libUsb. Is there=
 anything
> > > available or planned?
> >
> > According to the forum archive, XP 64bit is  supported but not Vista=
 64bit.
>
> Unless someone is willing to contribute his Verisign (or similar) key to
> sign a 64 bit driver, it is unlikely that this will change soon. That
> is, this holds true as long as there is no new implementation that
> utilizes the built-in driver winusb.sys.
I am not an USB expert but even with winusb.sys one still needs to
provide an INF file. Does that mean the situation will be any better
unless the INF is WHQLed? I do not have Vista now.
For example, people still need to provide an inf file for CDC-ACM
device even though they use the default usbser.sys in Windows.
The safe bet is HID which does not need an inf file in most cases.
> Citing Stephan in Message-Id: <206...@we...>:
>
> * On Mon, Jun 25, 2007 at 09:03:58PM +0200 Stephan Meyer wrote:
> >
> > The current version (0.1.12.1) works without any problems
> > on vista-32bit but NOT on vista-64bit.
> > Furture versions of the DLL will use vista's built-in winusb.sys
> > driver and will therefore work on both platforms. If you're
> > interrested in a pre-pre-alpha version then grab the latest sources
> > from the SVN and try it out.
> >=
 http://libusb-win32.svn.sourceforge.net/viewvc/libusb-win32/trunk/libusb1/
>
> So, you might want to help Stephan in getting the new version done in
> order to get the Vista 64-bit version.
>
I would like to help but I do not know much about programming. I
can certainly help for testing. I've tested the HID backend and
it is only partially working. Not so sure anout the WinUSB
backend since I am still learning how to use WinUSB. There
are very few WinUSB examples on the web. For example, I am
having problems with WinUSB here.
http://forum.microchip.com/tm.aspx?m=3D264046
Now I have an WinUSB host example in Visual C++ 2005
Express so I am learning how to use it.
Hopefully some other person will help Stephan to get the HID
and WinUSB backend to work. That would be really nice.
Regards,
Xiaofan
------------------------------
Message: 2
Date: Sat, 1 Sep 2007 15:50:05 +0330
From: "amin mosayyebzadeh" <sir...@gm...>
Subject: [Libusb-win32-devel] USB_BULK_READ()
To: lib...@li...
Message-ID:
        <e71...@ma...>
Content-Type: text/plain; charset=3D"iso-8859-1"
hi all,
I use usb_bulk_read() for reading usb device sending data, but if I try to
read once again, PC will be reseted.(in below code, when I change prime
value of k to 2).
if I plug device out then plug in to pc, I can read again. Do you know why?
thanks.
int usb_test(usb_dev_handle *udev, int cnt) {
    time_t start, end;
    double dif=3D0;
    ofstream ofile;
    ofile.open("result.txt");
    time (&start);
    time (&end);
   //PROBLEM IS HERE
    for(int k =3D 1; k>0; k--){
        char* rb;
        char* wb;
        int i=3D0, result;
        rb =3D new char[4096];
        wb =3D new char[2048];
        int count =3D cnt;
        //getting size of reading blocks;
        ifstream ifile;
        ifile.open("test.txt");
        while(!ifile.eof()){
           ifile.get();
            i++;
        }
        ifile.close();
        //reading received data
        result =3D usb_bulk_read (udev, 2, rb, i, 1000);
        if (result < 0) {
            printf("\nCould not read: %s", usb_strerror());
            return result;
        } else {
            count -=3D result;
            printf("\nread %d bytes ", result);
        }
        //print read buffer
        for (int j=3D0; j<result; j++) {
            ofile << rb[j];
        }
        time(&end);
        dif =3D difftime(end , start);
        delete rb;
        delete wb;
    }
    ofile.close();
    return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
------------------------------
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
------------------------------
_______________________________________________
Libusb-win32-devel mailing list
Lib...@li...
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
End of Libusb-win32-devel Digest, Vol 16, Issue 1
*************************************************
***************************************************************************=
*************
Note:  If the reader of this message is not the intended recipient, or an=
 employee or agent responsible for delivering this message to the intended=
 recipient, you are hereby notified that any dissemination, distribution or=
 copying of this communication is strictly prohibited. If you have received=
 this communication in error, please notify us immediately by replying to=
 the message and deleting it from your computer. Thank you.=20
***************************************************************************=
*************
 |