|
Hi all,
I am currently developing a small utility for checking a USB Hard disk drive for its surface integrity and I am having a problem with libusb that when sending a mass storage read command (0x28, w/ data transfer) to a device pointed to a bad sector/LBA, it does not return an error. However, when sending a verify command (0x2f, w/o data transfer) with the same LBA the libusb handles it correctly and returns an error. Can someone please point out how to correctly handle a mass storage command with data transfer errors. PS: I also tried using the xusb (modified some parts ex: buffer_size .. etc) and getting the same result. Thanks in advance! |
|
On Tue, Jun 28, 2011 at 8:45 PM, h <[hidden email]> wrote:
> Hi all, > > I am currently developing a small utility for checking a USB Hard disk drive > for its surface integrity and I am having a problem with libusb that when > sending a mass storage read command (0x28, w/ data transfer) to a device > pointed to a bad sector/LBA, it does not return an error. However, when > sending a verify command (0x2f, w/o data transfer) with the same LBA the > libusb handles it correctly and returns an error. > > Can someone please point out how to correctly handle a mass storage command > with data transfer errors. > > PS: I also tried using the xusb (modified some parts ex: buffer_size .. > etc) and getting the same result. > I think this question may be better answered in some other mailing list which deals with SCSI command or USB Mass Storage. What about this one? It seems to offer a package for Windows as well. http://sg.danny.cz/sg/sg3_utils.html -- Xiaofan ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ Libusb-win32-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel |
|
I have an experience in ASPI and ATA development and I am quite confident of my knowledge with it. I also have tried other programs using SPTI in their backend and I am getting my expected results. Could it be that libusb have some problems with handling I/O errors on some commands?
|
|
On Tuesday, June 28, 2011, h <[hidden email]> wrote:
> I have an experience in ASPI and ATA development and I am quite confident of > my knowledge with it. I also have tried other programs using SPTI in their > backend and I am getting my expected results. Could it be that libusb have > some problems with handling I/O errors on some commands? > Unlikely. But you can always send us the debug view log. Please search list archive to see how to do that. -- Xiaofan ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ Libusb-win32-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel |
|
Hi Chen, below is the debug log for the read command:
Attempting to read 131072 bytes: (sending read command) libusb:debug [winusb_submit_bulk_transfer] matched endpoint 02 with interface 0 libusb:debug [usbi_create_fd] could not duplicate handle for CancelIo - using original one libusb:debug [winusb_submit_bulk_transfer] writing 31 bytes libusb:debug [usbi_add_pollfd] add fd 4 events 4 libusb:debug [libusb_get_next_timeout] next timeout in 4.996368s libusb:debug [handle_events] poll() 2 fds with timeout in 4997ms libusb:debug [handle_events] poll() returned 1 libusb:debug [windows_handle_events] checking fd 3 with revents = 0000 libusb:debug [windows_handle_events] checking fd 4 with revents = 0004 libusb:debug [usbi_remove_pollfd] remove fd 4 libusb:debug [windows_transfer_callback] handling I/O completion with errcode 0 libusb:debug [bulk_transfer_cb] actual_length=31 sent 10 CDB bytes (send read command completed) (begin incoming bulk transfer) libusb:debug [winusb_submit_bulk_transfer] matched endpoint 81 with interface 0 libusb:debug [usbi_create_fd] could not duplicate handle for CancelIo - using original one libusb:debug [winusb_submit_bulk_transfer] reading 131072 bytes libusb:debug [usbi_add_pollfd] add fd 4 events 1 libusb:debug [libusb_get_next_timeout] next timeout in 4.996648s libusb:debug [handle_events] poll() 2 fds with timeout in 4997ms libusb:debug [handle_events] poll() returned 1 libusb:debug [windows_handle_events] checking fd 3 with revents = 0000 libusb:debug [windows_handle_events] checking fd 4 with revents = 0001 libusb:debug [usbi_remove_pollfd] remove fd 4 libusb:debug [windows_transfer_callback] handling I/O completion with errcode 0 libusb:debug [bulk_transfer_cb] actual_length=131072 READ: received 131072 bytes (end incoming bulk transfer) (begin to retrieve CSW) libusb:debug [winusb_submit_bulk_transfer] matched endpoint 81 with interface 0 libusb:debug [usbi_create_fd] could not duplicate handle for CancelIo - using original one libusb:debug [winusb_submit_bulk_transfer] reading 13 bytes libusb:debug [usbi_add_pollfd] add fd 4 events 1 libusb:debug [libusb_get_next_timeout] next timeout in 4.996648s libusb:debug [handle_events] poll() 2 fds with timeout in 4997ms libusb:debug [handle_events] poll() returned 1 libusb:debug [windows_handle_events] checking fd 3 with revents = 0000 libusb:debug [windows_handle_events] checking fd 4 with revents = 0001 libusb:debug [usbi_remove_pollfd] remove fd 4 libusb:debug [windows_transfer_callback] handling I/O completion with errcode 31 libusb:debug [windows_transfer_callback] detected endpoint stall libusb:debug [bulk_transfer_cb] actual_length=0 libusb:debug [libusb_clear_halt] endpoint 81 libusb:debug [winusb_clear_halt] matched endpoint 81 with interface 0 libusb:debug [winusb_submit_bulk_transfer] matched endpoint 81 with interface 0 libusb:debug [usbi_create_fd] could not duplicate handle for CancelIo - using original one libusb:debug [winusb_submit_bulk_transfer] reading 13 bytes libusb:debug [usbi_add_pollfd] add fd 4 events 1 libusb:debug [libusb_get_next_timeout] next timeout in 4.996927s libusb:debug [handle_events] poll() 2 fds with timeout in 4997ms libusb:debug [handle_events] poll() returned 0 libusb:debug [libusb_get_next_timeout] next timeout in 0.001117s libusb:debug [handle_events] poll() 2 fds with timeout in 2ms libusb:debug [handle_events] poll() returned 0 libusb:debug [libusb_cancel_transfer] libusb:debug [winusb_abort_transfers] will use interface 0 libusb:debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout! libusb:debug [handle_events] poll() 2 fds with timeout in 60000ms libusb:debug [handle_events] poll() returned 1 libusb:debug [windows_handle_events] checking fd 3 with revents = 0000 libusb:debug [windows_handle_events] checking fd 4 with revents = 0001 libusb:debug [usbi_remove_pollfd] remove fd 4 libusb:debug [windows_transfer_callback] handling I/O completion with errcode 995 libusb:debug [windows_transfer_callback] detected timeout libusb:debug [bulk_transfer_cb] actual_length=0 get_mass_storage_status: Operation timed out (end retrieve CSW) libusb:debug [libusb_clear_halt] endpoint 2 libusb:debug [winusb_clear_halt] matched endpoint 02 with interface 0 |
|
On Wed, Jun 29, 2011 at 10:30 AM, h <[hidden email]> wrote:
> Hi Chen, below is the debug log for the read command: Your log is for libusb-1.0 Windows, currently it is better to ask in the libusb mailing list for issues related to libusb-1.0 Windows. But it is okay to have occasional posts about it. I think you need to post your code snippets. What I am asking for is actually your libusb-win32 codes and the debugview log for it. You can use the debug version of 1.2.4.0 release. http://libusb.6.n5.nabble.com/usb-set-configuration-problem-in-1-2-3-0-tp4283671p4283819.html -- Xiaofan ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ Libusb-win32-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel |
|
In reply to this post by Xiaofan Chen
On Tue, Jun 28, 2011 at 10:49 PM, Xiaofan Chen <[hidden email]> wrote:
> On Tuesday, June 28, 2011, h <[hidden email]> wrote: >> I have an experience in ASPI and ATA development and I am quite confident of >> my knowledge with it. I also have tried other programs using SPTI in their >> backend and I am getting my expected results. Good to know that. I think that many USB mass storage device out there are kind of buggy so they may not follow the specifications very well. http://www.lvr.com/device_errors.htm http://lxr.free-electrons.com/source/drivers/usb/storage/unusual_devs.h >> Could it be that libusb have >> some problems with handling I/O errors on some commands? >> > Unlikely. Take note both libusb-win32 and libusb-1.0 are quite low level USB libraries. They do not handle the upper level protocol for you. If your I/O errors mean upper level protocol defined errors, libusb will not handle it for you and you have to deal with that by yourself. It will report lower level error pertain to the USB transfer level. > But you can always send us the debug view log. Please search list > archive to see how to do that. > For libusb-1.0 Windows, you should use xusb example first to see if that works for you. -- Xiaofan ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ Libusb-win32-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel |
|
In reply to this post by Xiaofan Chen
Hi chen,
I am quite confused here, I managed to install the debug filter as per your instructions but can't seem to get any logs when running my test program or xusb. And I'd like to clarify, what is the difference of WinUSB and libusb? Are they different driver filters? Since xusb requires WinUSB driver to detect devices, I am not getting any debug logs from the debugview when I run it. |
|
On Wed, Jun 29, 2011 at 12:19 PM, h <[hidden email]> wrote:
> Hi chen, > > I am quite confused here, I managed to install the debug filter as per your > instructions but can't seem to get any logs when running my test program or > xusb. And I'd like to clarify, what is the difference of WinUSB and libusb? > Are they different driver filters? Since xusb requires WinUSB driver to > detect devices, I am not getting any debug logs from the debugview when I > run it. > Sorry I was confused by your first message and then subsequently confused you. I thought you use both libusb-win32 API (your program) and libusb-1.0 API (xusb). I think I am wrong here. If you use libusb-win32 API, you will need to use libusb0.sys device driver. In that case, you can use the debug version of the device driver, and then use debugview to get the debug message print out. But apparently you are not using this. If you use libusb-1.0 API with libusb-1.0 Windows backend, then you will need to use winusb.sys driver (as of now). In that case, my suggestion to use debugview is totally off. WinUSB (winusb.sys and winusb.dll) is the driver/library base for the current libusb-1.0 Windows backend operation. libusb-1.0 is a separated project from libusb-win32. They have their own mailing list. http://www.libusb.org/ In any case, you may want to post your libusb-1.0 based codes in order to get more help, even if you go to the libusb mailing list for help. -- Xiaofan ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ Libusb-win32-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel |
| Powered by Nabble | Edit this page |
