Xiaofan Chen | 1 Aug 18:07 2015
Picon

Alternative to libusb-win32

Hi all,

I am not so sure how many people are still using libusb-win32. I will
still be able to spend time on this mailing list to support technical
questions but I do not think any new release will be done. It is quite
mature and I think people can still use it (I have not tested Windows
10 yet).

For the libusb-win32 driver portion, other than some legacy device,
I think it is probably better to use WinUSB whenever possible. As
for libusb-win32 library portion (extended libusb-0.1 API), it is probably
better to migrated to libusb-1.0 API (by libusb project). The only missing
function for libusb Windows is currently the isochronous transfer which
I believe will eventually be incorporated.

So I guess if you are happy with libusb-win32 you can continue to use
it. If not, better start to switch to libusb.

--

-- 
Xiaofan

------------------------------------------------------------------------------
Xiaofan Chen | 1 Aug 17:59 2015
Picon

libusbK Google Code repo exported to Github

Hi all,

Google code will close down soon. I have take the liberty of exported
the libusbK repo to Github.

I am not so sure how many people are still interested in libusbK
driver portion now that WinUSB has gained isochronous transfer
functionality (after Windows 8.1).

I am also not so sure how many people are still interested in
libusbK library (libusbk.dll) since most likely you can use
WinUSB API directly (for Windows) or libusb API (for
cross-platform application).

In any case, the license of libusbK is pretty liberal. You can
easily fork libusbK if you want.

Regards,
Xiaofan

---------- Forwarded message ----------
From: Google Code Exporter <mdb.google-code-export-noreply <at> google.com>
Date: Fri, May 1, 2015 at 5:31 PM
Subject: Google Code project export complete for usb-travis
To: xiaofanc <at> gmail.com

Code

Export to GitHub

(Continue reading)

Xiaofan Chen | 30 Jul 16:07 2015
Picon

Fwd: [Libusbx-devel] Announcing libusb-1.0.20-rc1

FYI as well.

---------- Forwarded message ----------
From: Chris Dickens <christopher.a.dickens <at> gmail.com>
Date: Thu, Jul 30, 2015 at 1:48 AM
Subject: [Libusbx-devel] Announcing libusb-1.0.20-rc1
To: "libusb-devel <at> lists.sourceforge.net"
<libusb-devel <at> lists.sourceforge.net>, libusbx-devel
<libusbx-devel <at> lists.sourceforge.net>

Hi All,

I'm pleased to announce the libusb-1.0.20-rc1 release.

It has been over a year since the last release, and a lot of changes
have gone in during that time (86 commits).

2015-07-29: v1.0.20
* Add Haiku support
* Fix multiple memory and resource leaks (#16, #52, #76, #81)
* Fix possible deadlock when executing transfer callback
* New libusb_free_pollfds() API
* Darwin: Fix devices not being detected on OS X 10.8 (#48)
* Linux: Allow larger isochronous transfer submission (#23)
* Windows: Fix broken builds Cygwin/MinGW builds and compiler warnings
* Windows: Fix broken bus number lookup
* Windows: Improve submission of control requests for composite devices
* Improve efficiency of event handling
* Improve speed of transfer submission in multi-threaded environments
* Various other bug fixes and improvements
(Continue reading)

Tim Hutt | 23 Jul 09:12 2015
Picon

Missing isochronous packets

I'm trying to transmit 64 byte isochronous USB packets over a USB high speed link from a SAM3X (in an Arduino Due) to a libusbk program (basically the example benchmark program it comes with).

I have one isochronous endpoint on the device and it sends data in a tight loop like this (using Atmel's SDK):

uint8_t buffer[UDI_VENDOR_EPS_SIZE_ISO_HS]; // 64 bytes. for (int i = 0; i < sizeof(buffer); ++i) buffer[i] = i; for (;;) { led = !led; udi_vendor_iso_in_run(buffer, sizeof(buffer), nullptr); // TODO: How to wait until it is finished? buffer[0]++; if (buffer[0] == 0) buffer[1]++; }

The receiving program is basically the example iso read program from libusbk. It writes data to a log file, including the first two bytes of each packet which I increment as shown above. It requests 128 packets per frame, and outputs data like this:

#6: StartFrame=00DDE360h LastFrameCount=16 TransferLength=8192 BPS-average:390409.30 #0000: Length=64 C0h 3Dh #0001: Length=64 E1h 3Dh #0002: Length=64 01h 3Eh #0003: Length=64 23h 3Eh #0004: Length=64 44h 3Eh #0005: Length=64 64h 3Eh #0006: Length=64 85h 3Eh #0007: Length=64 A6h 3Eh #0008: Length=64 C7h 3Eh ... snip ... #0120: Length=64 34h 4Dh #0121: Length=64 55h 4Dh #0122: Length=64 76h 4Dh #0123: Length=64 97h 4Dh #0124: Length=64 B8h 4Dh #0125: Length=64 D9h 4Dh #0126: Length=64 FAh 4Dh #0127: Length=64 1Bh 4Eh

As you can see, it works but is skipping loads of the packets. I'd like to know why! The data rate is really low compared to what USB 2 can do. I'm kind of at a loss here as I don't know how to wait until a transfer is completed in a tight loop on the SAM3X. Also... it should work right?

Here are the USB descriptors (I snipped some unused endpoints):

Device Power State: PowerDeviceD0 ---===>Device Information<===--- English product name: "" ConnectionStatus: Current Config Value: 0x01 -> Device Bus Speed: High Device Address: 0x05 Open Pipes: 0 *!*ERROR: No open pipes! ===>Device Descriptor<=== bLength: 0x12 bDescriptorType: 0x01 bcdUSB: 0x0200 bDeviceClass: 0x00 -> This is an Interface Class Defined Device bDeviceSubClass: 0x00 bDeviceProtocol: 0x00 bMaxPacketSize0: 0x40 = (64) Bytes idVendor: 0x1111 = Dade Behring, Inc. // Screw the USB-IF! idProduct: 0x2223 bcdDevice: 0x0100 iManufacturer: 0x01 English (United States) "" iProduct: 0x02 English (United States) "" iSerialNumber: 0x00 bNumConfigurations: 0x01 ---===>Full Configuration Descriptor<===--- ===>Configuration Descriptor<=== bLength: 0x09 bDescriptorType: 0x02 wTotalLength: 0x0045 -> Validated bNumInterfaces: 0x01 bConfigurationValue: 0x01 iConfiguration: 0x00 bmAttributes: 0x80 -> Bus Powered MaxPower: 0x32 = 100 mA ===>Interface Descriptor<=== bLength: 0x09 bDescriptorType: 0x04 bInterfaceNumber: 0x00 bAlternateSetting: 0x00 bNumEndpoints: 0x00 bInterfaceClass: 0xFF -> Interface Class Unknown to USBView bInterfaceSubClass: 0xFF bInterfaceProtocol: 0xFF iInterface: 0x00 ===>Interface Descriptor<=== bLength: 0x09 bDescriptorType: 0x04 bInterfaceNumber: 0x00 bAlternateSetting: 0x01 bNumEndpoints: 0x06 bInterfaceClass: 0xFF -> Interface Class Unknown to USBView bInterfaceSubClass: 0xFF bInterfaceProtocol: 0xFF iInterface: 0x00
(snipped irrelevant endpoints) ===>Endpoint Descriptor<=== <---- This is the endpoint I'm using. bLength: 0x07 bDescriptorType: 0x05 bEndpointAddress: 0x81 -> Direction: IN - EndpointID: 1 bmAttributes: 0x01 -> Isochronous Transfer Type, Synchronization Type = No Synchronization, Usage Type = Data Endpoint wMaxPacketSize: 0x0040 = 1 transactions per microframe, 0x40 max bytes bInterval: 0x01

Does anyone have any ideas?

Cheers,

Tim

------------------------------------------------------------------------------
_______________________________________________
Libusb-win32-devel mailing list
Libusb-win32-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
michel | 13 Jul 09:14 2015
Picon

ibusbk claim interface fail after 32 loops

I'm doing a simple repetitive open/close test using libusb 1.0.19 and libusbk
3.0.7

The target device is a composite device based on CDC/ACM  (2 interface MI0
and MI1) type configuration but with vendor specific class code 

basically what i'm doing 

libusb_open(device, &handle);
libusb_claim_interface(handle,1);

libusb_release_interface(handle,1);
libusb_close(handle);

After 32 loops claim interface will fail with error -3 
this doesn't happen with 3.0.6  thousand loops can be execuetd without any
problem

i'm using win-7 64 

failure occur in both 32/64 bits (mingw32/64) . 

--
View this message in context: http://libusb.6.n5.nabble.com/ibusbk-claim-interface-fail-after-32-loops-tp5714845.html
Sent from the LibUSB Dev - Win32 mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
gallegretto | 30 Jun 20:51 2015

Callback timing issue BULK TRANSFERS

 Hi, I have an issue I can't explain.

I submit two bulk transfers:

   1. transfer OUT
   2. transfer IN

Tranafer IN is submitted only when transfer OUT is submitted successfully.

Sometimes I enter in the callback of the transfer OUT after the callback of
the transfer-IN....  
They have same buffer size.

I am sending 1. and 2. continuously and I have this issue only with the
first two transfers.

If somebody can help thanks

--
View this message in context: http://libusb.6.n5.nabble.com/Callback-timing-issue-BULK-TRANSFERS-tp5714839.html
Sent from the LibUSB Dev - Win32 mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
Chris E | 6 Jun 08:42 2015
Picon

Simple iso code isn't sending any data at all (not even a request)?

Basically just using a slightly altered version of the example iso code to try and communicate to a USB device I'm making.  It works absolutely fine when I send a control tranfsfer.

However, when I try an iso transfer it fails.  Firstly, the pipe doesn't reset (returns error 57h), and then the wait ans release fails (returns error 490h).  Absolutely nothing, IN or OUT, is visible in the packet sniffer (USBPcap).

To be honest, I don't fully understand why this is the case and have almost zero experience programming with Windows (or any OS at all - I'm an electrical engineer and most of the stuff I do is "barebones" programming on FPGAs or microcontrollers).

Attempt to reset the pipe is done through UsbK_ResetPipe(handle, pipeID);
Reading the iso pipe is attempted through UsbK_IsoReadPipe(handle, pipeID, isoBuffer, sizeof(isoBuffer), ovlkHandle, isoCtx);
In both occasions, I can't see why any input would be considered dodgy.  The handle works fine for control transfers and the pipeID is checked by Usb.QueryPipe.

Is this a simple noob mistake or something more serious?

Thanks,
~Chris

P.S. Yes, the application requires that I use iso.  It's a USB oscilloscope!

Full output from CMD is:
Looking for device vid/pid 03EB/A000.. 
Using 03EB:A000 (5&15D9C317&0&4): USBGobindar Dummy Device - Atmel Corp. 
Device opened successfully! 
Pipe Information: 
  PipeId=0x81 PipeType=0x01 Interval=1 MaximumPacketSize=256 
READING ISO PACKET 
&ovlPool= 1702336 
&ovlkHandle= 1702348 
UsbK_ResetPipe failed. ErrorCode: 00000057h 
IsoReadPipe failed. ErrorCode: 00000490h 









Full code is:
#include "examples.h"
#include <string.h>

#define mode 1  //0 for control test, 1 for iso test
#define ISO_PACKETS_TO_READ 4
#define ISO_PACKET_SIZE 256

KUSB_DRIVER_API Usb;

DWORD __cdecl main(int argc, char* argv[])
{
KLST_HANDLE deviceList = NULL;
KLST_DEVINFO_HANDLE deviceInfo = NULL;
KUSB_HANDLE handle = NULL;
DWORD ec = ERROR_SUCCESS;
UCHAR pipeIndex = 0;
WINUSB_PIPE_INFORMATION pipeInfo;
WINUSB_SETUP_PACKET setupPacket;

//ISO only
PKISO_CONTEXT isoCtx = NULL;
KOVL_HANDLE ovlkHandle = NULL;
KOVL_POOL_HANDLE ovlPool = NULL;
unsigned char isoBuffer[32 * 256];
BOOL success;
UCHAR pipeID = 0x81;
ULONG transferred = 0;
DWORD errorCode = ERROR_SUCCESS;



BOOL controlSuccess;
unsigned char controlBuffer[64];
UINT bytesTransferred = 0;
ULONG VIDin, PIDin;
int command;
ULONG deviceCount = 0;

//Read in parameters from CMD
strcpy(controlBuffer, argv[1]);
sscanf(argv[2], "%d", &command);
sscanf(argv[3], "%4x", &VIDin);
sscanf(argv[4], "%04x", &PIDin);

//Commands to send to device
switch (command){
case 1:  //Print to LCD
setupPacket.RequestType = 0x40;
setupPacket.Request = 0xa0;
setupPacket.Value = 0x00;
setupPacket.Index = 0x00;
setupPacket.Length = 64;
break;
case 2: //Backlight off
setupPacket.RequestType = 0x40;
setupPacket.Request = 0xa1;
setupPacket.Value = 0x00;
setupPacket.Index = 0x00;
setupPacket.Length = 0;
break;
case 3:  //Backlight on
setupPacket.RequestType = 0x40;
setupPacket.Request = 0xa1;
setupPacket.Value = 0x01;
setupPacket.Index = 0x00;
setupPacket.Length = 0;
break;
default:
printf("Yeah Nah");
goto Done;
}


//Init device list!
if (!LstK_Init(&deviceList, 0)) {
printf("Error initializing device list.\n");
return 0;
}

//Check if device list is empty
LstK_Count(deviceList, &deviceCount);
if (!deviceCount) {
printf("Device list empty.\n");
LstK_Free(deviceList); // If LstK_Init returns TRUE, the list must be freed.
return 0;
}

printf("Looking for device vid/pid %04X/%04X..\n", VIDin, PIDin);

//Set device info to the info specified by the INF that belongs to said VID/PID pair
LstK_FindByVidPid(deviceList, VIDin, PIDin, &deviceInfo);
if (deviceInfo){
printf("Using %04X:%04X (%s): %s - %s\n",
deviceInfo->Common.Vid,
deviceInfo->Common.Pid,
deviceInfo->Common.InstanceID,
deviceInfo->DeviceDesc,
deviceInfo->Mfg);
}
else printf("Yeah nah kent couldn't find the device aye\n");

//Tell LibusbK to intercept everything related to this device
LibK_LoadDriverAPI(&Usb, deviceInfo->DriverID);

// Initialize the device
if (!Usb.Init(&handle, deviceInfo)){
ec = GetLastError();
printf("Usb.Init failed. ErrorCode: %08Xh\n", ec);
goto Done;
}
printf("Device opened successfully!\n");

// while the device is opened, query information on the endpoints
// of the first alternate setting of the current interface.
printf("Pipe Information:\n");
while (Usb.QueryPipe(handle, 0, pipeIndex++, &pipeInfo)){
printf("  PipeId=0x%02X PipeType=0x%02X Interval=%u MaximumPacketSize=%u\n",
      pipeInfo.PipeId, pipeInfo.PipeType, pipeInfo.Interval, pipeInfo.MaximumPacketSize);
}

#if mode == 0
//Send Control Packet
printf("SENDING CONTROL PACKET\n");
controlSuccess = Usb.ControlTransfer(handle, setupPacket, controlBuffer, setupPacket.Length, &bytesTransferred, NULL);
if (controlSuccess) printf("%d BYTES TRANSFERRED", bytesTransferred);
else printf("ERROR");
#elif mode == 1 
printf("READING ISO PACKET\n");
//Define Iso Context
IsoK_Init(&isoCtx, ISO_PACKETS_TO_READ, 0);
IsoK_SetPackets(isoCtx, ISO_PACKET_SIZE);

//What is this overlapped pool?  Virtual Addresses for I/O?  Black magic?  The source of my errors.
OvlK_Init(&ovlPool, handle, 4, 0);
printf("&ovlPool= %d\n", &ovlPool);
OvlK_Acquire(&ovlkHandle, ovlPool);
printf("&ovlkHandle= %d\n", &ovlkHandle);

//Reset Pipe fails!
success = UsbK_ResetPipe(handle, pipeID);
if (~success){
errorCode = GetLastError();
printf("UsbK_ResetPipe failed. ErrorCode: %08Xh\n", errorCode);
}

//Set up iso pipe for n reads.
UsbK_IsoReadPipe(handle, pipeID, isoBuffer, sizeof(isoBuffer), ovlkHandle, isoCtx);
//Wait for it all to finish!
success = OvlK_WaitAndRelease(ovlkHandle, 1000, &transferred);
if (!success) {
errorCode = GetLastError();
printf("IsoReadPipe failed. ErrorCode: %08Xh\n", errorCode);
goto Done;
}
#endif



Done:
// Close the device handle
// if handle is invalid (NULL), has no effect
Usb.Free(handle);

// Free the device list
// if deviceList is invalid (NULL), has no effect
LstK_Free(deviceList);

// Free the iso context.
IsoK_Free(isoCtx);

// Free the overlapped pool.
OvlK_Free(ovlPool);

return ec;
}
------------------------------------------------------------------------------
_______________________________________________
Libusb-win32-devel mailing list
Libusb-win32-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
Xiaofan Chen | 1 May 11:10 2015
Picon

Fwd: Main outstanding Windows backend patches

Not so sure if anyone here is interested in the following
work for libusb Windows backend. I myself can help on
the testing but I do not know much about programming
and will not be able to review the patches.

It will also be good that someone can work on to help
to improve the integration of libusb0.sys support under
libusb Windows backend. Right now it is not really usable.

Regards,
Xiaofan

---------- Forwarded message ----------
From: Xiaofan Chen <xiaofanc <at> gmail.com>
Date: Fri, May 1, 2015 at 5:08 PM
Subject: Main outstanding Windows backend patches
To: "libusb-devel <at> lists.sourceforge.net" <libusb-devel <at> lists.sourceforge.net>

There are a few major outstanding Windows backend patch series.
1. Hotplug
2. Isochronous transfer for libusbK (not yet WinUSB under Windows 8.1)
3. UsbDk backend

Hopefully someone will step in and work on the integration. Pete
mentioned that he would not have much time on libusb.

--
Xiaofan

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
Isaac Abbott | 30 Apr 15:28 2015

WinUSB WCID driver automatically installs but libusbK does not see the device

After following the steps outlined by Pete Patard here (https://github.com/pbatard/libwdi/wiki/WCID-Devices), my device successfully enumerates as a “WinUSB Generic Device” on my Windows 7 Pro x64 system. Unfortunately LstK_Init in lisbusbK no longer finds the device. It works correctly when I use Zadig to install the driver (non-WCID).
 
I did not implement the Device Interface GUID descriptor, is this necessary?
 
~Isaac
 
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Libusb-win32-devel mailing list
Libusb-win32-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
Pradeepa Senanayake | 24 Apr 13:06 2015
Picon

LibusbK debug messages

Hello,

I have been using the libusbK library for more than one year for one of the projects I am involved in. It works very well. Recently I have encountered an issue in one of the devices. I still could not find the origin of the issue. 

I have access to the low level device firmware and the application which communicates with it. We decided to go with libusbK as the USB driver for the devices.

Basically what should happen is when we switch on the device it should ideally enumerate three USB devices in the device manager. This is not a composite USB device. But a device which has three separate child devices connected to an internal hub. First it enumerates as bootloader devices and when the PC application sends it the relevant data it will switch to the firmware. . 

Sometimes I can see that one of these three deivce does not get enumerated properly. It gives a code10 error in device manager. I think it comes when DeviceEntry fails in the driver code. May be the firmware is not responding to a standard query properly.

I would like to know to which query it is not responding properly. I was wandering whether there is any method to enable some sort of debug messages in the libusbK. What are the debugging options available in the library? I basically would like to see where the driver fails to enumerate the device. 

Since this is not always happening I am still unsure where the issue is.

Best Regards,
Pradeepa Senanayake.
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Libusb-win32-devel mailing list
Libusb-win32-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
Simon Thiebaut | 23 Apr 09:00 2015
Picon

WinUSB Microsoft OS descriptors

Hi,

Please forgive me if this has already been answered, but I was not able to fin any related topic inside the previous posts.

I'm writing an application for monitoring sensor data through a USB link.
I can modify both the PC application (USB host) and the acquisition board firmware(USB device).

The PC app USB part is written with libusb, as the app is intended to be cross platform, though it is first developed under Windows.
The first version of the board firmware implements the HID class, but this is too limitating for the requirements of the app, and I want to change the class.

Therefore I was looking for a generic USB device driver that would automatically loads when the device is plugged in.
I have to do a choice between WinUSB or libusbK drivers.

After a few researches on WinUSB, I found this:
https://msdn.microsoft.com/en-us/library/windows/hardware/hh450799%28v=vs.85%29.aspx

That states that a WinUSB generic device must have in its firmware specific Microsoft OS Descriptors to work.

My question is: does libusbK have such requirements ? Will I have to add specific descriptors to make my device work ? Or nothing special is required (other than configuring properly the existing common descriptors) ?
The point is I do not wish to embed useless and not generic code in the firmware if there a is generic enough PC driver (for the Windows portage)...


Thank you very much for your answers.

Have a nice day,



Simon THIEBAUT

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Libusb-win32-devel mailing list
Libusb-win32-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel

Gmane