Re: [Libusbx-devel] bulk transfer error centos 6.5 (32-bit) on VirtualBox running on Windows 7 (64-bit)

2014-06-24 Thread Tim Roberts
Igor Furlan wrote:
 On Mon, Jun 23, 2014 at 10:50 AM, Tim Roberts t...@probo.com wrote:
 One of the advantages of libusb is that it crosses platforms.  Why don't you 
 run your code on Windows?
 Yes I could,,, but I wrote already few other utilities on LINUX
 (mostly GPIB related). I would like to continue on Linux. On top of
 that, licensing is free, no virues,  upgrading linux require just a
 recompile of my utilities, stability, reliability, abundance of
 programming/scripting tools   so, the users can use my utilities
 within any programming environment they are comfortable with. Like
 octave, shells,c, C++, Ruby, Perl, Pascal adn as a command line.

OK, but you are intentionally overlooking the very important point that
YOUR USERS ARE ALREADY RUNNING WINDOWS.  You said this yourself.  They
already have licenses.  They already have virus checkers.  They already
know how to launch programs and interact.  They do not know Octave,
bash, Ruby, Perl, or Pascal.  You are asking them to run an additional
rather intrusive tool (VirtualBox) so they can run an entirely
unfamiliar environment just so you can feel religiously pure in your
development.

Your upgrade argument is also silly.  An upgrade of Windows doesn't
require ANY recompiling of your tools and utilities.  The old binaries
just keep on working.  Microsoft has spent a vast fortune to ensure that
the Fortune 100 companies don't have to do any work on their
line-of-business tools to slip in an operating system upgrade.  Linux
developers, on the other hand, tend to favor purity over compatibility.


 Working remotely is a plus...  etc ..Stuff I wrote in 2002/03 in
 my former company is still in use today, 12 years later. It was
 written for RedHat 8 2012 and just recompiled on CentOS 6.

You're just making stuff up that doesn't have any basis in fact.  The
Windows remote access tools are just as good or better than the remote
access tools on Linux.  I'm still running Windows tools that I wrote and
last compiled in 1995.  Now that I'm running a 64-bit Windows, my
25-year-old 16-bit tools no longer run, but I've known that was coming
for 10 years.

It's interesting that you tried to use backwards compatibility as an
argument.  As a driver writer, I know that Windows has the best
backwards compatibility behavior of ANY of the major operating systems. 
The video capture driver BINARIES that I wrote for Windows 98SE way back
in the 20th Century still run in Windows 8.  With a Linux kernel driver,
you often don't even get SOURCE compatibility between version x.y.z and
x.y.z+1.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] bulk transfer error centos 6.5 (32-bit) on VirtualBox running on Windows 7 (64-bit)

2014-06-23 Thread Tim Roberts
On Jun 22, 2014, at 1:00 PM, Igor Furlan igor.fur...@gmail.com wrote:
 
 Now I am facing another problem.
 
 A call to  usb_claim_interface returns 0 (meaning call was OK).
 
 The next call, after the usb_claim_interface, is a call to usb_control_msg.
 
 It returns -110 (aka it fails).

You know that -110 tells you more than just “it fails”, right?  Errno 110 is 
ETIMEDOUT.  Do you have a very short timeout?  Timing in a VM is somewhat 
“flexible”.


 Reminder:
 I am running this on a CentOS 6.5 as the __guest__ using VirtualBOX on
 WIN7 as the host.
 
 Running the program on CentOS 6.5 on  REAL hardware works flawlessly.

At some point, you have to decide what this is worth to you.  Some of the VM 
managers don’t do a perfect job of USB forwarding.
-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing  Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] bulk transfer error centos 6.5 (32-bit) on VirtualBox running on Windows 7 (64-bit)

2014-06-23 Thread Tim Roberts
Igor Furlan wrote:

 On Sun, Jun 22, 2014 at 11:41 PM, Tim Roberts t...@probo.com
 mailto:t...@probo.com wrote:

 On Jun 22, 2014, at 1:00 PM, Igor Furlan igor.fur...@gmail.com
 mailto:igor.fur...@gmail.com wrote:
 .
  It returns -110 (aka it fails).

 You know that -110 tells you more than just “it fails”, right?
  Errno 110 is ETIMEDOUT.  Do you have a very short timeout?
  Timing in a VM is somewhat “flexible”.


 ​No, I did not know. To be honest with you, I did not look for. My
 bad. Sorry.

 About ​Do you have a very short timeout?
 I do not know. How do I change (increase) the 'timeout' ?

Did you check the API documentation?  The last parameter to
usb_control_msg is the timeout in milliseconds.

To a certain extent, however, I am just blowing smoke.  Control messages
usually complete very quickly.  Your symptoms seem to indicate some more
fundamental problem, and I don't know what to suggest.

One of the advantages of libusb is that it crosses platforms.  Why don't
you run your code on Windows?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing  Easy Data Exploration
http://p.sf.net/sfu/hpccsystems___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] bulk transfer error centos 6.5 (32-bit) on VirtualBox running on Windows 7 (64-bit)

2014-06-22 Thread Tim Roberts
On Jun 21, 2014, at 9:01 PM, Igor Furlan igor.fur...@gmail.com wrote:
 I am trying to run I2C interface board
 (http://nanorivertech.com/viperboard.html) on CentOS 6.5 installed on
 virtual machine (VirtualBox) which runs on MS WINDOWS 7.
 
 When I run my small CLI program, I get back
 
 libusb: error [op_set_configuration] failed, error -1 errno 110
 libusb: error [submit_bulk_transfer] submiturb failed error -1 errno=2
 libusb: error [submit_bulk_transfer] submiturb failed error -1 errno=2
 
 The very same CLI program runs flawlessly on CentOS 6.5 on  real
 hardware. It runs on 32-bit and 64-bit machine.

Windows does a SetConfiguration when the driver loads.  Some hardware doesn’t 
like getting multiple SetConfiguration requests.  Try removing the call to 
usb_set_configuration.
-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing  Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Isochronous packets request result in 8byte garbage at the end of accumulated packets

2014-06-02 Thread Tim Roberts
Kuldeep Singh Dhaka wrote:

 Im facing a weird problem.
 i have a ST uC (FS usb) that send data of ADC (12 bit) at 176Kilo
 samples at bInterval=1; (2bytes for 1 sample)
 ie 352byte isochronous endpoint requested every 1ms

 when i request 1000 packets (each of 352 bytes), i received 8byte
 garbage value (mostly 0x00) at the end of the 999th packet (assuming
 packet index start from 0).
 when i request 500 packets (each of 352 bytes), i received 8byte
 garbage value (mostly 0x00) at the end of 499th packet.
 when i request 100 packets (each of 352 bytes), i received 8byte
 garbage value (mostly 0x00) at the end of 99th packet.
 when i request 10 packets (each of 352 bytes) i received 8byte byte
 garbage value (mostly 0x00 | non-zero on offset 1 byte of garbage
 start) at the end of 9th packet. (non-zero garbage value position is
 352 - 8 + 1).

Can you show us your code?  It's difficult to imagine how anything below
your application could cause this.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

--
Learn Graph Databases - Download FREE O'Reilly Book
Graph Databases is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] [libusb] Clarification of LibusbK windows driver architecture.

2014-03-27 Thread Tim Roberts
Pradeepa Senanayake wrote:

 The way the kernel is handling both IOCTLs and the ReadFile/WriteFile
 requests are almost the same. But then why different functions? 

Partly, tradition and history.  The five original Unix primitives were
open, read, write, ioctl, and close, and most operating systems since
then have kept those primitives.

On Windows, ReadFile and WriteFile get additional handling when the
device is actually a file system.  For example, both of them maintain a
current position, which DeviceIoControl does not do.  That difference
doesn't matter when there isn't a real file behind the handle.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Major problems using libusbx on CentOS 5

2014-01-27 Thread Tim Roberts
Judd Taylor wrote:
 I've got a big (and late) project that needs to use libusb/libusbx to
 ingest data from a satellite demodulator.

 I need async capability, as well as the ability to talk via two
 different logical interfaces via different processes, even through
 they are on the same USB interface (logical interface 1 is a control
 channel, with an IN/OUT EP, and logical interface 2 is the data
 channel with an IN endpoint). I know it's retarded they are on the
 same USB interface, but I can handle this with forking after
 claim_interface() (I think).

 My main problem is in getting a working version of this library. I'm
 using CentOS5 (which can't be changed for other reasons),...

CentOS 5 uses the 2.6.18 Linux kernel.  It's not impossible that your
troubles are due to the antiquity of your kernel, and not the interface
you are using to get to it.  The USB kernel support evolved rather
dramatically through the 2.6 kernels.


 So it seems I'm stuck between a rock and a hard place here. I can't
 use the old version of libusb (1.0.8) because it's async stuff is
 racy/broken, and I can't use the new libusbx stuff since it won't get
 past libusb_init().

It may be sacrilege to mention it here, but it's not really all that
hard to code directly to the usbfs ioctls, and that way you have
complete control over your destiny.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments  Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431iu=/4140/ostg.clktrk___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] 3 warnings in git master from Xcode

2014-01-21 Thread Tim Roberts
Nathan Hjelm wrote:
  

 Ah. Ok. Wasn't aware of that case. The code is question is ISO C89 to
 support MSVC. Do you know if the C89 standard also guarantees the rest
 of the struct is zeroed?

Yes.  That C99 wording was copied from the C89 spec, section 3.5.7.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments  Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] 3 warnings in git master from Xcode

2014-01-21 Thread Tim Roberts
Tim Roberts wrote:
 Nathan Hjelm wrote:
  
 Ah. Ok. Wasn't aware of that case. The code is question is ISO C89 to
 support MSVC. Do you know if the C89 standard also guarantees the rest
 of the struct is zeroed?
 Yes.  That C99 wording was copied from the C89 spec, section 3.5.7.

HAVING SAID ALL OF THAT, however, I don't actually have an objection to
the modification.  It serves no purpose to the compilation, but if it
satisfies an anal-retentive lint checker and does no damage, that's OK.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments  Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] 3 warnings in git master from Xcode

2014-01-20 Thread Tim Roberts
Sean McBride wrote:
 With 1.0.18 coming, I though I'd try building git master with the latest 
 Xcode.  I see 3 warnings:

 (1) core.c:1910:27: Missing field 'tv_usec' initializer

 can we just change:
   struct timeval tv = { 0, };
 to:
   struct timeval tv = { 0, 0 };

 is there any platform where this struct is not 2 elements?

Even if there isn't, the standard guarantees that those two constructs
are identical.  Any elements that don't have initializer values get zeroed.

In other places (see line 2156), the code assumes that the structure
contains tv_sec and tv_usec, so there must be at least two elements. 
Thus, your change is safe, although superfluous.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments  Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] sending data containig 0xFFFF results in crc error

2014-01-06 Thread Tim Roberts
hgs16 wrote:
 I am using libusbx-1.0.17-win to communicate with our usb device(based on
 stm32). It runs stm32 usb library adapted to behave as winusb device. 

 When sending data which contains 0x (say 0x, which is of 4 bytes
 in length), usb monitor software says USBD_STATUS_CRC (0xc001). Attached
 the screenshot the captured results.

The screenshot shows that you're sending 12 bytes, not 4 bytes.

It's not clear from the screenshot whether USB Monitor Pro knows the
difference between IRP status codes and URB status codes.  The problem
is that the two spaces overlap.  C120 is an IRP status code
(STATUS_CANCELLED), and it is displayed correctly.  C001 is
URB_STATUS_CRC as an URB status code, but it is STATUS_UNSUCCESSFUL as
an IRP status code.  Because CRC errors are essentially non-existent
these days, my guess is that the monitor is diagnosing the wrong code,
and you're actually seeing STATUS_UNSUCCESSFUL, which means there is
another code in the URB that we aren't seeing here.

I notice that this is happening immediately after the first abort
request after a series of successful transfers.  My guess is that your
device got into a weird state and halted the pipe, and that the actual
data you used here is irrelevant.  Do you have any visibility into the
device to see its status at this point?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Get file description and call sync transfer functions after a poll/select.

2014-01-06 Thread Tim Roberts
Joaquim Duran wrote:

 I'm new to this e-mail list. In the current project, I would like use
 a 3rd party library to monitor the IO events on file descriptors,
 including libusb library (I would like to use the reactor patter).

 To do the integration, I've the following questions:

 1 - It is possible to get de file descriptor of a device handle
 without calling to libusb_get_pollfds? I would like to get the FD for
 a device handle and avoid to allocate dynamic memory.

No.  The whole FD list is an internal implementation detail.  As the
documentation tells you, there is not necessarily a single FD per
device.  You might get a set of FDs, and you need to poll for them all.


 2 - After calling polling/select system calls, it is possible to call
 synchronous transfer functions to read or send data to the USB device?

Not exactly.  Remember that USB traffic never happens unless there is a
pending request.  A USB device cannot send data on its own, and it
cannot signal that it is ready to receive.  Everything starts with the
host application/driver.  What the poll lets you do is learn when a
previously-submitted asynchronous request has completed.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] vendor specific control requests failing, error 87

2013-12-27 Thread Tim Roberts
Jason Kotzin wrote:
 you can change that to the following:

 libusb_control_transfer(handle, 0x42, 0x3, variable1, variable2, buf[1], 1, 
 500);

 Maybe that answers my question. I don’t have endpoint 3 on my device, so 
 maybe winusb is restricting communication where libusbk is not?

That is correct.  Your request is not a valid USB request, and WinUSB
happens to enforce that.  When you have a control request aimed at an
endpoint (even a vendor request, which is what 0x42 is), then the
bRequest byte must contain the endpoint number that is the target of the
request.

If you want to use bRequest for your own purposes, then you should use a
vendor request to the device, which is 0x40 instead of 0x42.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] vendor specific control requests failing, error 87

2013-12-26 Thread Tim Roberts
Jason Kotzin wrote:
 In windows, 8.1, I’m sending a vendor specific control request that looks 
 like the following:

 Broken down, this is what an example looks like where variable1 and variable2 
 can be 0-255

 rq = fl_send_msg(0x42, 0x3, variable1, variable2, buf[1], 1, 500)

Since we don't know what fl_send_msg is, it's a little hard to make an
assessment.   Are those parameters RequestType, Request, Index, and
Value?  Are you trying to send a buffer there?


 The result is that the transfer fails with error code 87, “the parameter is 
 incorrect”.

You are sending an outgoing vendor request to an endpoint.  If the
second parameter is Request, then you are sending to endpoint 3.  To do
that, Windows requires that you actually own the interface that
contains endpoint 3.  Have you already done that?  It looks like you
claimed interface 1.  Does that hold endpoint 3?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] [libusbx] Fix super-speed isoc packet size (#163)

2013-12-12 Thread Tim Roberts
Hans de Goede wrote:

 the isoc endpoint is only created when changing to alt setting 1

 Ah, that is what saves your bacon then, most devices have the isoc eps
 in altsetting 0 too, with a maxpacketsize of 0.


No, they don't.  Or at least they aren't supposed to.  Alt setting 0
should not contain any isochronous endpoints at all.  Having an endpoint
with a max packet size of 0 is silly.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] [libusbx] Windows: field wIndex in SETUP packet always 0 (#161)

2013-12-09 Thread Tim Roberts
Kerdo Link wrote:

 Shouldn't 3 be 0x03? because of uint16_t?


You don't honestly think there is any difference between 3 and 0x03, do you?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] [libusbx] Windows: field wIndex in SETUP packet always 0 (#161)

2013-12-09 Thread Tim Roberts
ccier wrote:

 I want to send the following control transfer:

 |r = libusb_control_transfer(handle,
 LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE | 
 LIBUSB_ENDPOINT_OUT,
 0, 0, 3, packet, size, 2000);
 |

 However, the USB sniffer always shows the field wIndex as 0 instead of 3.
 The other field of struct libusb_control_setup are correct.
 Only wIndex always shows 0.


Have you claimed interface 3?  For a Class/Interface request like this,
WinUSB will automatically set the wIndex field to the number of the
interface that you are currently working with.

What request are you trying to send here?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631iu=/4140/ostg.clktrk___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] [libusbx] Windows: field wIndex in SETUP packet always 0 (#161)

2013-12-09 Thread Tim Roberts
ccier wrote:

 Ok, thanks for the info.

 Yes, i am claiming interface 0 and interface 3 on the same handle.
 It is a Huawei USB modem. The driver is installed on the parent
 device. In this way I would assume that I have total control over the
 device using libusbx.


Yes, this is a subtlety in WinUSB that libusbx does not properly
handle.  When you send a control request, libusbx finds the first valid
interface handle in its list and uses that.  That does not work for
INTERFACE requests.  It would have to search for the MATCHING interface
handle.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] [libusbx] Windows: field wIndex in SETUP packet always 0 (#161)

2013-12-09 Thread Tim Roberts
ccier wrote:

 And libusbx handles this situation differently if libusbK is used?


libusbx does not handle the situation at all.  That's the issue.  This
is a WinUSB feature that libusbK does not have and libusbx did not
anticipate.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] ceusbkwrapper driver and HID driver

2013-12-06 Thread Tim Roberts
Liang Zhu wrote:
  

 It looks whenever the firmware is in the DFU mode,  my HID driver is
 not able to find the USB slave device.  Is that normal?


This depends ENTIRELY in your device.  Often, when a device is in DFU
mode, it only exposes the DFU interface and not the normal interface. 
In that case, then of course the HID driver cannot be found, because it
is no longer a HID device.

Some drivers do expose both interfaces all the time.


 what do I have to do to inter-connect the ceusbkwrapper driver and HID
 driver so I can send the new firmware to the slave device.


You will not use the HID driver in DFU mode.  You will use a DFU
driver.  Which, by the way, you will have to write.


 Also,  is there way to enable DFU mode on demand,  the firmware is in
 the DFU mode soon as the wince os started.  I would like to know if
 there is any way to turn on and turn off the DFU mode.


Again, that's entirely up to your device.  Sometimes the device will
have a special command that tells it to switch to DFU mode.  In that
case, it might drop off of the bus and comes back up with only the DFU
interface.  Then, after firmware is loaded, the device again drops off
the bus and comes back up with its normal (e.g., HID) interface.  Two
entirely separate personalities.

Sometimes, both interfaces are exposed all of the time.  In that case,
you will still drop off the bus after firmware loading and re-enumerate.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631iu=/4140/ostg.clktrk___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] DFU Mode

2013-12-02 Thread Tim Roberts
Liang Zhu wrote:
  

 I would like to know how to ensure my usb device to be programmed
 comes up in DFU mode.


That's entirely up to your device.  It is your device that decides
whether to expose its regular working interface, or its DFU interface.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351iu=/4140/ostg.clktrk___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] [libusbx] libusb_interrupt_transfer Segmentation fault. (#160)

2013-11-21 Thread Tim Roberts
Kerdo Link wrote:

 I have set a timeout 500ms in libusb_interrupt_transfer().
 ...
 libusbx: debug [windows_transfer_callback] handling I/O completion
 with errcode 995, size 0


I was wrong, you are right.  CancelIo does, indeed, result in
ERROR_OPERATION_ABORTED.  This does look like a bug in
hid_copy_transfer_data.

Is libusbx still being maintained, or is all the energy focused on the
great rejoining?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] [libusbx] libusb_interrupt_transfer Segmentation fault. (#160)

2013-11-20 Thread Tim Roberts
Kerdo Link wrote:

 I have a problem with libusb_interrupt_transfer under cygwin. When I
 want to read data from a USB device and there is nothing to receive, I
 get a Segmentation fault. I managed to backtrace the fault to
 hid_copy_transfer_data() in windows_usb.c, line:
 memcpy(transfer_priv-hid_dest, transfer_priv-hid_buffer+1,
 corrected_size);

 The problem starts in windows_usb.c from windows_handle_events() where
 GetOverlappedResult(transfer_priv-pollable_fd.handle,
 transfer_priv-pollable_fd.overlapped, io_size, false) sets io_size
 to 0 and io_result = ERROR_OPERATION_ABORTED.


I'm confused by this.  If you are using the HID backend, which it seems
you are, you should never see ERROR_OPERATION_ABORTED.  The HID backend
uses CancelIo in case of a timeout, not AbortPipe.  Are you specifying a
timeout?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] [libusbx] Report error for bogus string descriptors (#156)

2013-11-05 Thread Tim Roberts
Peter Wu wrote:

 The documentation says:

 number of bytes returned in data, or LIBUSB_ERROR code on failure

 In my opinion in makes perfectly sense for the API to return an error
 when the format does not conform to the USB standard.


This is an interesting policy question.  As you yourself pointed out,
the USB spec does not specifically address this behavior.  That is, it
does not explicitly require that the length be = 2.  It says that the
length of the string is the descriptor length minus 2, so one might
debate the meaning of a string with negative length, but again that is
not prohibited.

Thus, what you have here is your interpretation.  We've debated before
whether it is up to the library to try to present meaningful results
when given broken devices.  In this particular case, I would argue that
the most flexible response is for the library to return exactly what it
got, unless the user has requested interpretation (that is, the _ascii
version).  In that case, we can be free to reject bad data.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

--
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231iu=/4140/ostg.clktrk___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] [libusbx] Report error for bogus string descriptors (#156)

2013-11-04 Thread Tim Roberts
Peter Wu wrote:

 This Ralink device returns bogus values for some string descriptors
 (iSerial, iInterface). The bDescriptorType and everything following that
 changes every time, but at least the first byte stays consistently 0.
 The USB 2.0 spec (9.6.7 String) does not define the behavior for
 bLengths 0 and 1, so let's assume that string descriptors following that
 are completely junk.


I'm not sure I agree with this philosophy.  As you say, the spec does
not define the behavior, so why should the library impose a penalty?  It
seems to me that libusb_get_string_descriptor ought to return exactly
what it got.  I do agree that the convenience wrapper
(libusb_get_string_descriptor_ascii) can have a more sophisticated
policy, but I don't think you should be lying in the lower-level interface.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Problems running libusbx on nonrooted Android

2013-10-24 Thread Tim Roberts
Rasmus Bisschop-Larsen wrote:

 I am trying to run libusbx on an unrooted android phone (Sony Ericson
 Xperia Active (Android 4.0.4)). But I have hit a major problem I
 cannot open the device. After looking at the libusbx code I can see
 that even though I know the device address and vid+pid I hit an error
 as [libusb_open] open 1.2 returns -3. (see debug code below). I do not
 have root access to my phone and I thought libusbx did not need this. 

Did you read the Android README in the libusbx distribution?  If you are
not rooted, and you cannot rebuild the system image, then you can try
using Java code to call android.hardware.usb.UsbManager to request the
permission you need.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60135991iu=/4140/ostg.clktrk___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] [libusbx] Windows: hotplug/unplug support (#9)

2013-10-08 Thread Tim Roberts
On Oct 8, 2013, at 6:34 PM, Manuel Francisco Naranjo 
notificati...@github.commailto:notificati...@github.com wrote:

@mcueehttps://github.com/mcuee is '\.\USB#VID_413CPID_2513#62DA1330102' a 
USB hub attached to a PCI hub? Or is it a composite device? I'm trying to 
figure out if I broke something here


Google is your friend.

That's the ID of the internal USB hub in Dell's port replicator.
--
Tim Roberts, t...@probo.commailto:t...@probo.com
Providenza  Boekelheide, Inc.

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60134071iu=/4140/ostg.clktrk___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] How to access multiple interfaces on windows is different to linux?

2013-09-26 Thread Tim Roberts
Kano wrote:
 I didn't spot the obvious that an endpoint is unique across a device
 thus it also indirectly identifies the interface.
 i.e. all transfers do indeed infer the interface (via the endpoint)

This is an interesting philosophical point about USB that is important
but not well understood.

Interfaces in USB are nothing more than a software convention.  It's a
way to gather related endpoints together.  That's all.  At the hardware
level, interfaces are irrelevant.  Packets refer to endpoints -- never
interfaces.  If you have a device with 9 endpoints in 1 interface, the
wire transfers would be exactly identical to the same device with 9
interfaces.

The interfaces are only there to allow the operating system drivers to
manage ownership.  The bus doesn't care.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60133471iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] [libusbx] Windows: hotplug/unplug support (#9)

2013-09-20 Thread Tim Roberts
Manuel Francisco Naranjo wrote:

  Be mindful that
 
  |int a;
  a = 1;
  int b;
  b = a+1;
  |
 
  Will not work on MS compilers. All the variable declarations must be
  at the top.
  Thus windows_usb.c lines 584  2366 also break MSVC compilation.

 Really? Is that stupid?

No, it's smart, it's just smart C89.  Microsoft has not implemented C99,
and has not given a timeline for doing so.  Virtually all important
Windows code is done in C# or C++.

On a related note, I've never understood why the Linux world clings so
tightly to C.  Many of the improvements in C99 were introduced because
of C++.  In the C++ world, the delta between MSVC and gcc is very, very
small.  You don't have to dive hip-deep into templates and
metaprogramming and inheritance; it's quite viable to use C++ as a
better C.  In my experience, most programming solutions are more clearly
expressed in C++ than in C.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Accessing composite devices using interface association

2013-08-18 Thread Tim Roberts
On Aug 16, 2013, at 1:14 PM, Jan Becvar j...@groget.org wrote:
 
 I wonder if this fully applies from the libusbx point of view.
 
 My understanding of its interface (but please mind my so far limited 
 experience with the library) was that it enumerates really the 
 physical devices, even if composite. I.e. the composite device is 
 still enumerated as single device with multiple interfaces rather than 
 multiple devices invented by usbccgp.sys. Am I wrong?

Unless I missed a staff meeting, libusbx can be used in either mode -- either 
matching the composite device (meaning all interfaces) or matching one of the 
interfaces.  If you match the composite device, then you get the entire 
configuration descriptor, including the IADs.


 Also, the config descriptor seems to be queried through the parent hub's 
 driver using IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION thus 
 bypassing usbccgp.sys or any other driver associated with the composite 
 parent.

Hmm.  That would, in fact, bypass the composite parent rewriting.
-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with 2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Accessing composite devices using interface association

2013-08-14 Thread Tim Roberts
Pete Batard wrote:
 On 2013.08.14 00:21, Xiaofan Chen wrote:
 The 2nd option is not possible without changes in libusbx. Right now
 it is not possible to access the other interfaces other than the first
 interface in an interface collection of a USB IAD device as of
 now, even though the supported driver (eg: WinUSB) is used to
 associate with the interface collection.
 I'm also worried about this part from [1]:
 Client drivers cannot access IAD descriptors directly.

That's not an issue.  If you are driving the composite device, then you
get the entire configuration descriptor, which includes the IAD descriptors.

If you are not driving the composite device, then usbccgp.sys rewrites
the configuration descriptors.  If you have a driver for MI_01, then the
configuration descriptor that driver reads contains only interface #1. 
If you had an IAD that groups interfaces 3, 4, and 5, the PDO will be
created for MI_03, but the rewritten configuration descriptor only
includes interfaces 3, 4 and 5. You don't need the IAD, because you can
enumerate the interfaces you got.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with 2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Accessing composite devices using interface association

2013-08-13 Thread Tim Roberts
Xiaofan Chen wrote:
 I think there is a way to hack the inf-file generated by
 Zadig to install WinUSB driver for each interface.

 Interface 0 -- MI_00
 Interface 1 -- MI_01
 Interface 2 -- MI_02

No, that won't work.  When you have an IAD that wraps those three
interfaces, usbccgp only creates a PDO for MI_00.  You'll only get one
driver, and that driver is assigned ownership of all three interfaces. 
There will never be an opportunity to load MI_01 and MI_02, because it
won't create those PDOs.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with 2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] LitteWire libusb library help

2013-08-06 Thread Tim Roberts
Vaclav wrote:

 I would like to have a private contact with someone who could give me
 some pointers about BASIC libusb build and usage in Windows MFC.

MFC is not relevant.  That's just a framework for building GUI
applications.  Did you mean Visual C++?


 I have been told by expert to use libusb0.1  but the software I am
 using clearly loads libusb0.dll

Yes, libusb0.dll is the interface for libusb-win32, which is a Windows
version of libusb 0.1.  There is a separate mailing list for
libusb-win32, if that's what you currently have.


 Basically whatever I am using is refusing to detect more than one USB
 bus - whatever that is,  and none USB devices. I can detect the
 device in question using other applications, but I am stuck ( at least
 for now) to get libusb going so I can control the device.

Yes, libusb in Windows can only access devices that are using the libusb
driver, libusb0.sys.  There has to be a driver package with an INF file
that matches your USB device identifier to the libusb0.sys driver.  If
you haven't assigned a driver to your device, then it will not be
found.  If this is a package you inherited, then there may already be a
driver package somewhere.


 I would prefer to build the whatever dll from source so I can debug my
 app ( I have not figured out how to debug “build” dll) and learn how
 it works. I think I am missing the relations between MFC .lib ( which
 I can build and the required libusb0.dll.

There is no relationship between MFC and libusb, except that your
application happens to use both.  Libusb0.dll is just like any other DLL
(like gdi32.dll or user32.dll or the C run-time library).  You shouldn't
really need to be debugging inside of it.  You just use the services it
provides.

What kind of device is this?  How much data will be you be transferring?


 I am basically lost which libusb to use ( libusb0.1, 0, libusbx,
 libusb_win32 ) but I need some basic know-how to be able to build and
 use library from source.

If you already have code that uses libusb_win32, then it's probably not
worth the trouble to start over.  If you are starting from scratch, then
it might be worth considering an upgrade.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with 2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031iu=/4140/ostg.clktrk___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] libusb_open_device_with_vid_pid fails on Windows 7 on USB 3.0 ports

2013-07-25 Thread Tim Roberts
Juan Lang wrote:

 I've got a little test program that I'm running against a device I
 have, which is supported by the winusb driver. Here's my little test
 program:
 ...
 The program produces the following output when my device is inserted
 into a USB 3.0 port:
 ...
 [ 0.069014] [1f10] libusbx: debug [windows_get_device_list]
 allocating new device for session [19D]
 [ 0.070014] [1f10] libusbx: error [init_device] device
 '\\.\USB#VID_1050PID_0211#6BB821803' is no longer connected!
 ...
 Naturally it succeeds when the device is inserted in a USB 2.0 port.
 I've verified the problem on an HP z420 with a TI USB 3.0
 controller/drivers, and on a ThinkPad T430 with Intel-provided
 controller/drivers.

 Any idea what gives?

My guess is that your device violates the USB 3.0 specs.  There are lots
of devices that implemented the USB spec sloppily.  Many of them got
away with it because of forgiving USB 2 implementations, but USB 3 is
stricter.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Improved logging v2

2013-06-27 Thread Tim Roberts
Hans de Goede wrote:
 You're right, and I'm sorry. I guess I'm to much of a rero person sometimes.

 Although win32 is far from my specialty I think the attach patch should fix
 it. Any chance you could give it a try?

This is micro-optimization, of course, but it would be more efficient to
do this instead:
fputs(str, stderr);

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] RFC: Add libusb_get_vendor_n_product_string function

2013-05-28 Thread Tim Roberts
Hans de Goede wrote:
 Sorry no code (yet), as I would first like to get some buy in for
 the concept before spending time on coding this.

 For apps which show a list of usb devices to the user, it is useful
 to have some userfriendly description of the device to show.

 I've code for this in spice-gtk, which I think really should be in
 libusb, as it is useful for other apps too.

 Therefor I would like to suggest to add these functions:

 char *libusb_get_vendor_string(libusb_device *device);
 char *libusb_get_product_string(libusb_device *device);

I'm not fond of this concept.  In USB terms, the vendor string is the
string descriptor designated by iManufacturer in the device descriptor,
and product string is the string descriptor designated by iProduct in
the device descriptor.  This is extending the meaning of those terms in
a possibly unexpected way.

Apps that need the usb.ids lookup should go do the lookup.  Beyond that,
this becomes a maintenance headache.

However, I may not be in the majority.  I also think the project will
come to regret the introduction of  libusb_strerror.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with 2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Bulk transfer queueing order problem

2013-05-28 Thread Tim Roberts
qse drf wrote:
 I checked the inf created by Zadig, and it claims the entire device.  I
 assumed this had to be the case, since libusbx is able to acces both
 interfaces.

You can modify that INF...


 I'm going to keep trying to figure out how to use WinUSB directly.

WinUsb_GetAssociatedInterface should be the magic you need.


 So this seems like a bug in libusbx that it doesn't seem to honor the
 synchronous API expectations in this case, as evidenced by the concatenating 
 of the
 buffers from multiple calls.  Or am I missing something?

It's still hard for me to figure out understand how this could happen. 
If you don't SEND the second buffer until you have RECEIVED the first
result, how could you even get the first result unless the first buffer
was already gone?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with 2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] RFC: Add libusb_get_vendor_n_product_string function

2013-05-28 Thread Tim Roberts
Hans de Goede wrote:
 I would like to give libusb using applications to os cached string
 descriptors, so that those can be accessed without the need to open a
 device and do io on it.

The device is already open, because your API requires a libusb_device,
right?  So, you're saving the cost of one device descriptor read, and
two string descriptor reads.

I don't know.  The API is well-defined and simple enough, but it doesn't
require any information private to the library.  Would it be used often
enough to justify including it in the library, as opposed to having it
in a code sample?  I can't judge that.  I am, admittedly, a minimalist.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with 2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Bulk transfer queueing order problem

2013-05-24 Thread Tim Roberts
qse drf wrote:
 I just installed the driver with Zadig. Yes there are two interfaces, 
 interface 0 has a single endpoint and interface 1 has the two bulk end 
 points. What confused me was that using libusbx I am able to use the bulk 
 endpoints, but with the WinUSB API I can't.

I don't know how Zadig creates the INF file.  Windows allows you to
write an INF file that claims the entire device:
%MyDeviceDesc% = install.section, USB\VID_1PID_
With that, you can get a handle to the other interfaces using
WinUSB_GetAssociatedInterface.

But Windows also allows you to write an INF that only claimes one interface:
%MyDeviceDesc% = install.section, USB\VID_1PID_MI_00
or
%MyDeviceDesc% = install.section, USB\VID_1PID_MI_01

If you use that option, then the system rewrites the descriptors so that
your driver doesn't even KNOW there is a second interface.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Try New Relic Now  We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app,  servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] winusb, can't open device

2013-04-18 Thread Tim Roberts
Daniel Goertzen wrote:
 I have libusbx compiling under cygwin now and can look at the device
 descriptors for all attached devices, but I cannot libusb_open() my
 device.  The error given is -12 (LIBUSB_ERROR_NOT_SUPPORTED).

 I ran zadig and bound my device to WinUSB, but still no luck (I have
 to admit, I don't exactly understand how that all works).

 One thing of note, zadig shows the WinUSB version number as
 6.1.76000.16385, whereas the version number on my Windows 8 system
 is 6.2.9200.16384.

7600 is the master build number for Win 7.  9200 is the master build
number for Win 8.  The WinUSB installation process only installs the DLL
and driver if the version is newer than what's already on the system.


 Also of note, I am trying to connect to a LPC11u24 with unproven
 firmware.  The uC is seeing GET_DESCRIPTOR and SET_ADDRESS commands
 and nothing else.  My device descriptor is below.

What does the configuration descriptor look like?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis  visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] [RFC] Windows event handling improvements

2013-04-12 Thread Tim Roberts
Toby Gray wrote:
 The only numbers which would probably make sense to others are that we 
 noticed that there was a long time between the short packet of the end 
 of a transfer and the host issuing the next IN token for that endpoint. 
 The gap is multiple milliseconds in length on WinCE, but not when the 
 same board is running a Linux image.

There must be about a dozen causes behind that, and Libusbx's event
handling has to be about #11 on that list in terms of importance.  My
guess is that the #1 cause is the design of the USB host controller
driver.  The WinCE USB stack is primitive.  It hasn't received anywhere
NEAR the attention or the real-world stress testing that either the
Windows or the Linux USB stack has had.  I suspect, for example, that it
only asks for an interrupt at end of frame, and it submits the next
frame's schedule immediately.  In that case, unless you have multiple
concurrent requests, you will NEVER get more than one request every two
milliseconds.  It's impossible, and there is nothing you can do in
user-mode code to fix that.


 We have finally got around to making sure that we have multiple 
 concurrent bulk in transfers to eliminate this latency. I know that we 
 should have been doing this from the start, but higher priority things 
 had always got in the way and the event handling in Linux was fast 
 enough for us to get away with it.

Sometimes.  Even when it works, it's very delicate, and highly dependent
on system load.  It wouldn't take an awful lot of competing CPU activity
to make it break on Linux as well.  The ONLY robust solution is multiple
pending requests.


 So it's now a case of reducing the CPU time that we see in the 
 processing of events. We've not drilled down fair enough yet to discover 
 exactly where the time goes.

You are free to chase this line of investigation if you want, of course,
but it is my educated opinion that you are wasting your time.  You are
solving a problem that simply cannot be solved in the general case.  You
are bucking Amdahl's Law here.  The libusbx event handling is such a
small part of the problem that, even if you completely eliminated all of
the libusbx overhead, you would have improved the overall performance so
slightly that it makes no difference.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis  visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] [RFC] Windows event handling improvements

2013-04-11 Thread Tim Roberts
Toby Gray wrote:
 We've been looking into the performance of the Windows desktop and 
 Windows CE versions of libusbx compared to Linux on the same hardware. 
 The event handling in Windows and Windows CE appears to take 
 considerably longer than for Linux.

 This is understandable given the way that the windows backends need to 
 pretend to have fds for the core of libusbx to process.

Can you share with the performance numbers you have and a short
description of how you got them?  You've made me really curious here. 
Intuitively, I would have guessed that whatever fd futzing was going on
was absolutely insignificant when compared to the overhead of
user/kernel transitions and user event processing.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis  visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Strange warning when enumerating device

2013-04-09 Thread Tim Roberts
Pete Batard wrote:
 On 2013.04.08 19:12, Tim Roberts wrote:
 For example, in this snippet:
 Opening device 0403:CFF8...
 libusbx: error [init_device] device 
 '\\.\USB#VID_0403PID_CFF8MI_01#6222886B8
 1' is no longer connected!
 the MI_01 implies that you have a separate driver for each interface.
 In that case, I don't understand the log entries about claiming
 interface 0 and interface 1.
 That's just how xusb is set [1]. It'll always try to claim all 
 interfaces. 

Yes, but if this is a driver matching MI_01, then there will only be one
interface, numbered 0.  The usbccgp driver, which owns the composite
device, rewrites the configuration descriptor.  When the MI_01 driver
goes to read the configuration descriptor, it will only contain
interface 0 (which is really interface 1).  The other interface will
simply not appear.

That's my confusion.  If libusbx has (also) claimed the composite
device, then I believe this.  If not, then it shouldn't be possible for
the MI_01 driver to learn or access the other interfaces.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis  visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] OT Right clickable .inf file for usbser.sys on Win7

2013-04-01 Thread Tim Roberts
Orin Eman wrote:


 I didn't think right-click/Install worked for driver inf files.  It
 never has for me anyway.

Specifically, right-click install cannot be used for plug-and-play
driver packages.  All that a right-click install does is run the section
called [DefaultInstall].  You can copy files, create services, and
create registry entries, but it will not associate your driver with the
device you're trying to drive.

Right-click installs can be used for so-called legacy drivers, but it
doesn't do anything that can't also be done with a batch script or a
trivial C program.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Own the Future-Intelreg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] How libusb(x) know which interface to talk to

2013-04-01 Thread Tim Roberts
Wander Lairson Costa wrote:
 You mean, I cannot have endpoint 1 both on interface 0 and interface
 1? I was not aware of that.

Correct.  Endpoints are global, and interfaces are just a software
mechanism for collecting the endpoints into related groups.  Packets on
the USB wire do not have an interface number in them.  All they get are
an endpoint number.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Own the Future-Intelreg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] [PATCH] Fix HID descriptor creation code in Windows backend

2013-03-22 Thread Tim Roberts
Toby Gray wrote:
 Hi,

 I've been investigating a STATUS_STACK_BUFFER_OVERRUN (0xc409) 
 exception when running the latest libusbx in Windows XP. I believe it's 
 due to a bug in how the fake USB descriptors for HID devices are 
 created. The location of the second endpoint was being calculated 
 incorrectly in _hid_get_config_descriptor.

 I've attached a fix for it. The only thing I'm not entirely happy with 
 about the fix is the use of ed2 as a variable name, feel free to suggest 
 a better alternative.

Do we need the additional pointer at all?  It seems like it violates 3rd
Normal Form.  Why not just advance the pointer in place?
ed = (struct libusb_endpoint_descriptor *)((unsigned char *)ed +
LIBUSB_DT_ENDPOINT_SIZE);

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Samples: Add FX3 firmware upload support for fxload

2013-03-14 Thread Tim Roberts
Pete Batard wrote:
 Absolutely. It shouldn't be that difficult to produce a CY7C68013A like 
 FX3-based board, and sell it for at least an order of magnitude less 
 than the CYUSB3KIT.

I don't know about that.  The chips themselves are still running about
$30 in volume.  Plus, the circuit board and connector tolerances are a
LOT less forgiving at 5 GHz than they are at 480 MHz.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Feature request: plug-in notification.

2013-03-13 Thread Tim Roberts
Bent Bisballe Nyeng wrote:
 In the time I have been using libusb there has always been a single
 feature that I was missing: The ability to get a notification when a new
 device is connected (or disconnected for that matter), and thereby
 remove the need for continuous rescans of the usb bus.

 In a specific project that I once made a rescan actually interrupted an
 active filetransfer on a MSD. Probably due to a bug in the MSD (some
 custom thiny, not made by me) but it still points to the fact tha a bus
 rescan is a quite agrssive thing to do in order to simply find out if
 a device has been connected.

Well, I guess this depends on your level of abstraction.  SOMEONE has to
rescan the bus.  In Windows, for example, you can subscribe to a 
device changed event from the PnP provider.  However, that merely
tells you that, somewhere in the system, some bus driver has reported a
change in its set of child devices.  The only way to find out WHICH
devices came or went is to go rescan the bus you're interested in and
compare the current list to your own list.

Further, the notion of reattaching to a lost device is a tricky one. 
You're talking to a driver.  That driver happens to be assigned to a
particular hardware device.  When that hardware device goes away, that
driver instance is unloaded (or at least orphaned).  When that hardware
device comes back, it's seen as a brand-new device, and gets a brand-new
driver set, with absolutely no connection to the orphaned driver you
were talking to before.  Certainly at the kernel level, there is simply
no way to move those old driver connections to the new driver.  Someone
in user mode has to be using heuristics to make that connection.  Some
apps wouldn't want to be automatically reconnected.  Thus, this ends up
being an application-specific process.

This is why hotplug has not already been added to libusb/libusbx.  You
have suggested a mechanism that would work for your application, but
it's not at all clear that it is the right solution for every
application.  It's a very tricky problem.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Problem with Vendor class

2013-03-07 Thread Tim Roberts
GORAN RADIVOJEVIC wrote:
 uC is Atmel UC3A0512. According to Atmel docs USB controller is Low/Full speed
 device capable to do ISO transfer with up to 256 bytes for endpoint 
 (wizard created INT and BULK endpoints 64 byte and ISO 256 byte). After many
 experiment I can make it work with only 64byte for ISO plus 64byte INT but
 without BULK. Maximum average speed is around 670KB/s for BULK write 
 and only 58KB/s for ISO write (libusb-win32 1.2.6.0 driver and LibUsbDotNet 
 Benchmark example).

If your iso packet size is 64 bytes, then you obviously can't do any
better than 64kB/s, but you should be able to do exactly 64kB/s.


 I have a question: is ISO transfer works with libusbx or not?

Yes.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] libftdi async transfer

2013-03-01 Thread Tim Roberts
Xiaofan Chen wrote:
 Ref thread: 
 http://developer.intra2net.com/mailarchive/html/libftdi/2013/msg00157.html

 libftdi1 git repo source:
 http://developer.intra2net.com/git/?p=libftdi;a=blob;f=src/ftdi.c
 Just need to read the following functions:
  ftdi_write_data_submit(), ftdi_read_data_submit() and
 ftdi_transfer_data_done().

 I need a sanity check whether the assesment that current libftdi1 codes
 will limit to only have one outstanding async read request. Is this
 correct? I admit I have not a good understanding of libusbx's
 async API and event handling.

I don't see anything in that code that serializes read requests.
 
 If not, then what could be the problem?

That FTDI code does set the default read buffer size to 4096.  That's
settable, using ftdi_read_data_set_chunksize.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] OT driver signing in Win7 / Win8

2013-02-27 Thread Tim Roberts
Kustaa Nyholm wrote:
 sorry to abuse this list with OT but since
 I know a few  members know about the driver
 signing so I was hoping for a helpful word.

 I'm using a home brew USB CDC AMC virtual
 serial port like device on Windows with
 the Windows serial.sys driver and my own
 .inf file.

 Now will this approach work out of the box
 in W7 / W8 and if not what can / should I do?

There are two signing requirements in Windows.

The KMCS (kernel mode code signing) requirement will prevent a driver
from being loaded unless the driver or the driver package is signed. 
This check is done every time the driver loads, but is only done on the
64-bit systems.  Since you are using Microsoft's driver, which is
already signed, this is not a problem for you.

The PnP check is done when your driver is installed.  This is what puts
up the dreaded unsigned driver! warning, or the less dreaded do you
trust this publisher? warning.  This check is done on all systems, but
ONLY at installation time, and as long as the user agrees to the dialog,
things proceed smoothly.

So, as long as you know you'll get the unsigned driver warning, your
driver should work fine.  Note that Windows 8 now requires a CAT file
for all driver packages.  Look up the inf2cat tool.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] OT driver signing in Win7 / Win8

2013-02-27 Thread Tim Roberts
Xiaofan Chen wrote:
 On Thu, Feb 28, 2013 at 2:32 AM, Tim Roberts t...@probo.com wrote:
 Note that Windows 8 now requires a CAT file
 for all driver packages.
 Does this cat file needs to be signed? Where is
 this documented?

I couldn't find it written down.  I learned it empirically.

 
 I find one info here which states that the cat
 file needs to be signed for Windows 8 64bit.
 Is that true?

To be honest, I don't know, because I always sign both the SYS and the
CAT.  In previous systems, one or the other had to be signed in order to
pass 64-bit KMCS, but you had to sign the CAT file in order to change
the unsigned driver warning to the do you trust this publisher
warning.  Thus, there has always been a rather strong incentive to sign
the CAT file, assuming you shipped one.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Problem with Vendor class

2013-02-26 Thread Tim Roberts
GORAN RADIVOJEVIC wrote:

 Few minutes after I send previous message I remove last two endpoints
 (Iso) and now SetAltInterface working as
 expected (in libusbx and libusbK).

That's revealing.  Are you quite sure that your Atmel device supports
isochronous endpoints?  Which Atmel chip are you using?


 Now I have working Interrupt (for commands) and Bulk endpoints (audio
 stream), both 64 byte but with Iso EP problems returns.

As I recall, you had two interrupt endpoints with 64-byte packets and
two isochronous endpoints with 256-byte packets.  Right?  That's a total
of 640 bytes per frame.  That's 50% of the total available bandwidth for
full-speed devices.  If you had any other interrupt or isochronous
devices reserving bandwidth, that could have been enough to cause your
allocation to fail.  Did I already ask if you were you doing this in a
virtual machine?  Do you happen to have a video camera set up?


 I managed to loop through uC stereo audio stream 48k/24bit using Bulk
 transfer but on higher rates audio is choppy. Atmel controller is only
 full speed capable, is this my problem?

Bulk gets whatever bandwidth is left over after all of the other
reservations.  The timing is unpredictable.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Problem with Vendor class

2013-02-25 Thread Tim Roberts
GORAN RADIVOJEVIC wrote:

 interface[0].altsetting[0]: num endpoints = 0
Class.SubClass.Protocol: FF.FF.FF
 interface[0].altsetting[1]: num endpoints = 6
Class.SubClass.Protocol: FF.FF.FF
endpoint[0].address: 81
max packet size: 0040
   polling interval: 01
endpoint[1].address: 02
max packet size: 0040
   polling interval: 01
endpoint[2].address: 83
max packet size: 0040
   polling interval: 00
endpoint[3].address: 04
max packet size: 0040
   polling interval: 00
endpoint[4].address: 85
max packet size: 0100
   polling interval: 01
endpoint[5].address: 06
max packet size: 0100
   polling interval: 01

What are the types of the pipes here?  Bulk pipes in full-speed are
limited to 64 bytes, so those last two (at least) must be either
interrupt or isochronous.  Is it possible you don't have enough
bandwidth to reserve that much?


 When libusb_set_interface_alt_setting command is send on my serial
 console instead expected USB_REQ_TYPE_VENDOR received
 is USB_REQ_TYPE_STANDARD with alt settings set to 0:
 
 udi_vendor_disable alt_settings 0
 udi_vendor_setup_out
 USB_REQ_TYPE_STANDARD

You are making the mistake of assuming that vendor class device and
vendor requests are somehow related.  That is simply not true, and you
must unlearn that.  There are two bits in the request code that identify
whether the request is a standard request, or a class request, or a
vendor request.  All possible standard and class requests are spelled
out in the USB specs.  Vendor requests can be anything at all.  ANY type
of device can have its own vendor requests.


 ...
 This is from udi_vendor_setup function generated by Atmel ASF 3.5.0:
 ..
 if (Udd_setup_is_out())
 {
 if ((Udd_setup_type() == USB_REQ_TYPE_VENDOR)
  (udd_g_ctrlreq.req.bRequest == 0)
  (0 != udd_g_ctrlreq.req.wLength))
 {
 return UDI_VENDOR_SETUP_OUT_RECEIVED();
 }
 return false;  // Not supported request
 }

 Clearly this function only expect USB_REQ_TYPE_VENDOR request with
 altsettings set to 1.

Your conclusion is not supported by the code.  Your firmware probably
has a section of code that says:

if( request type is standard )
go handle standard requests;
else if( request type is class )
go handle class requests;
else
go handle vendor requests;

and the code above is probably in the vendor request section.

It is clear that your firmware handles the SetInterface request.  The
set alternate setting function sends the EXACT SAME REQUEST.  There's
just one field that identifies the alternate setting to enable.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Problem with Vendor class

2013-02-18 Thread Tim Roberts
GORAN RADIVOJEVIC wrote:

 I made typo error: my USB device have only one interface with one
 Alternate settings (my first attempt was
 HID+Vendor, HID part working correctly). At the moment I don't have
 CPU card (only bare motherboard) so
 I can't send you exact Xusb.exe printout. I hope in the next few days
 spare CPU card will be returned to me.
 In the meanwhile I have question about exact procedure to activate
 Vendor class. Is this correct order:
 1. find device by VID and PID;
 2. claim interface;
 3. set configuration (is this step necessary?);
 4. set Alt. configuration;
 5. send/receive data through endpoints.

Setting the configuration determines what the interfaces are, so if you
do SetConfiguration, you must do that before claiming the interface. 
There is no such thing as an alternate configuration.  Claiming the
interface will set alternate setting #0, so you only need to set the
alternate setting number if you have more than one, and you will
(almost) never have more than one unless you have isochronous pipes.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, 
is your hub for all things parallel software development, from weekly thought 
leadership blogs to news, videos, case studies, tutorials, tech docs, 
whitepapers, evaluation guides, and opinion stories. Check out the most 
recent posts - join the conversation now. http://goparallel.sourceforge.net/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Problem with Vendor class

2013-02-13 Thread Tim Roberts
GORAN RADIVOJEVIC wrote:

 My previous experience with USB was PIC 18F4550 and HID device so
 sorry if I ask something obvious.
 I have a problem with AVR32 UC3A0512 device and Vendor class. Hardware
 is EVK1100 clone (WaveShare EVK3A).
 I manage to build firmware with AtmelStudio 6 and install driver
 (libUSBwin32 or libUSBK). Device is visible by
 Windows without any warning. When I try xusb.exe from example folder
 my device is listed with two interfaces
 (0 without endpoints and 1 with two endpoints: interuput and isochronous).

Is it really two interfaces?  Or is it one interface with two alternate
settings?  There is a big difference.


 In my host PC application when I try
 to set active interface 1 I got error (from UC3A debug printout
 message is USB_REQ_TYPE_STANDARD).

What was the error?


 From what I read my host app must activate Vendor device by sending
 USB_REQ_TYPE_VENDOR request with
 appropriate alt configuration number?

No.  Vendor requests have nothing to do with vendor-class devices.  You
can have vendor requests even on standard class devices.  My blind guess
is that you were trying to claim interface 1, when you should have been
claiming interface 0 with alternate setting 1.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Windows: libusb_claim_interface fails on 1.0.13 and higher

2013-02-04 Thread Tim Roberts
Eric Lundby wrote:
 How are you going to avoid specifying a COM port across platforms?
 Not sure how to take this. Sounds a bit cynical.

That was not my intent at all -- I must have worded my question poorly. 
Allow me to try again.


 I'm currently using
 libusb/WinUSB on Windows to communicate with my device w/o specifying
 a COM port. Considering COM ports are in general a Windows only topic,
 I guess this is already accomplished.

Your second sentence is not true, and that was my original point.  If
you have a device that gets exposed as a virtual COM port, it gets
assigned a COM port number on all of the operating systems.  Windows
calls it COM4 (or whatever).  Linux has a different naming convention,
but the number is still there.  You were objecting to dealing with the
COM port number on Windows, but the same problem exists everywhere.

 
 However, I do appear to be able to accomplish what
 I want using bulk transfers via Libusbx. Are there major issues with
 this that I'm not aware of?

I'm with Alan.  If it works for you, bulk traffic is the most common kind.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Windows: libusb_claim_interface fails on 1.0.13 and higher

2013-02-01 Thread Tim Roberts
Eric Lundby wrote:
 The main reason for not using the Microchip provided package is we
 don't want our end users to have to specify a com port to be able to
 use our device.

Then why would you make this CDC ACM, instead of just using a custom
interface that you control completely?


 Being able to use the same code base (or close to it)
 across platforms was also an enticing factor. Let me know if you think
 I am off base with this.

How are you going to avoid specifying a COM port across platforms?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] WinUSB Pipe Policy ALLOW_PARTIAL_READS and USBD_SHORT_TRANSFER_OK

2013-01-25 Thread Tim Roberts
Xiaofan Chen wrote:
 On Fri, Jan 25, 2013 at 2:40 AM, Tim Roberts t...@probo.com wrote:
 In Microsoft's defense, this is implemented in the WinUSB wrapper DLL,
 not at the USB kernel level.  It's a convenience.  The DLL turns this
 into spec-compliant requests at the kernel level.
 That is interesting to know.

 Just wonering how does the DLL do to turn this into a spec-compliant
 requests at the kernel level?

They just make normal full-packet requests, then pack any short packets
into the output buffer and continue reading, instead of terminating the
request at the first short packet.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] WinUSB Pipe Policy ALLOW_PARTIAL_READS and USBD_SHORT_TRANSFER_OK

2013-01-24 Thread Tim Roberts
Alan Stern wrote:
 ALLOW_PARTIAL_READS is Microsoft's way of letting programmers use the 
 USB protocol in ways it was not intended to be used.  It specifically 
 evades the convention (which is documented in the spec) that bulk 
 transfers are complete when either the desired number of bytes have 
 been sent or when a short packet is received, whichever comes first.

In Microsoft's defense, this is implemented in the WinUSB wrapper DLL,
not at the USB kernel level.  It's a convenience.  The DLL turns this
into spec-compliant requests at the kernel level.
 

 This feature is not available on Linux, or presumably on other
 platforms.  I don't see any reason why libusb or libusbx should support
 it.

I agree.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Isochronous test problem

2013-01-10 Thread Tim Roberts
Wander Lairson Costa wrote:
 I am trying to do a isochronous loop transfer, I can write the data
 but I am getting an error when trying to read it. Following are the
 logs:

Isochronous endpoints have peculiar rules for reading.  Each packet in
an isochronous transfer maps to one microframe in real time.  It's not
like a bulk or interrupt transfer where it just hangs around until it's
full.  If you have 8 packets in your transfer, you'll cover 8
microframes.  If the device doesn't send anything in one of those
microframes, you'll get zero bytes back for that packet.

The endpoint packet size is 32 (in the header), and your request is for
128 bytes, so you should be covering 4 microframes.  It's quite normal
for one of those packets to fail when the other ones succeed.  That what
it looks like here -- packet 0 failed, but the other three did not.

Error -71 is EPROTO, suggesting a protocol violation.  I guess that
implicates the firmware.  Have you done an lsusb to make sure the
descriptors match what you expect?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] libusbx and Windows 8 and Windows 8 RT

2012-12-31 Thread Tim Roberts
Pete Batard wrote:
 Last time I tried with VS2012, it seemed to produce ARM binaries 
 alright, but since Microsoft decided to go all Apple in terms of pricing 
 and control of RT hardware, I doubt there's going to be much point 
 trying to test on a closed/defective by design platform...

This is a nice summary of the situation.  I'm especially fond of your
phrase going all Apple -- I will have to work that into a New Year's
Eve party conversation.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] [libusbx] persisting LIBUSB_ERROR_NO_MEM on burst condition

2012-12-11 Thread Tim Roberts
Mohamed HAMZAOUI wrote:
 Solution, as pointed out Tim, is to buffer more data in a single
 request. It's like nagle algorithm that I will implement, but I think
 it is not a good solution in my case.
 Firstly, there's several threads that send CAN frames in accordance
 with specific conditions... and I should never delay the emission of
 any frame. Secondly, A CAN frame has a small size !

Please remember that USB is not an asynchronous bus.  Everything is
scheduled in advance.  No matter how fast you submit your requests, they
will all be gathered up and scheduled for the next frame, at the next
millisecond boundary.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Asynchronous transfers without C-callbacks

2012-12-05 Thread Tim Roberts
Wolfgang Pupp wrote:
 I've been working with libusbx for some time now --I'm primarily very
 happy with it-- but one design trait gave me trouble: Being forced to
 use C-callbacks for dealing with asynchronous transfers.
 It would be *really* nice if there was a push style API one could
 resort to, 

It's interesting you would call this push style; in my mind this is
pull style, because I have to pull the events from libusbx, instead of
having the library push them to me.


 like this:
 /* inside the main-loop: */
 libusb_check_events_timeout_completed(ctx, timeout, evt_cnt);
 for(int i = 0; i  evt_cnt; ++i) {
   libusb_transfer *transfer;
   libusb_handle_next_transfer(ctx, transfer);
   /* do something with the transfer */
 }

I don't see the point of the added complexity of the event count, which
would be outdated as soon as it was returned.  Why not just:
libusb_transfer * transfer;
while( libusb_get_completed_transfer( ctx, timeout, transfer) ==
some success value )
{
// Do something with transfer
}

In both cases, you'd have to loop back around to check later anyway.

This would not be too hard to add, although I suspect you could do the
same thing yourself with a small C module.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] problem reading configuration descriptor, win xp, selfmade usb device

2012-11-28 Thread Tim Roberts
Arne Pagel wrote:
 That is right, also Usbview doesn't show any Configraution Descriptors, just 
 Device and Endpoints.

The fact that it shows endpoints says that, at SOME point in time, the
system was able to read your configuration descriptor.  Endpoint
descriptors do not exist on their own -- they are part of the
configuration descriptor.  The device descriptor and endpoint
information shown at the top of the usbview output is cached in the
kernel -- it's not read from the device.  The configuration descriptor
it shows does require a hardware response.

 
 I started some test with the USB Command Verifier Tool suggested by Tim and 
 Indeed it shows some Errors.
 I still have to get familiar what the tool is saying to me, up to now I have 
 3 Items:
   - It says that I have no Configuration and I should have at least One 
 Configuration
   - there is something with some BOS Descriptors, which are not available on 
 Full Speed, but t least some
 error Message should be returned
   - I am consuming current, and the Configuration is that I shouldn't
 (which is indeed a wrong setting, but I think not the cause)

Here's my guess, from a distance, based on almost no data, with large
caveats about jumping to conclusions and reading between the lines.

My guess is that you are responding correctly at enumeration time, but
after your device gets configured once, SOMETHING you are doing in the
firmware is preventing the device from responding to another
GetConfiguration request.  Maybe you are doing too much work in an
interrupt handler, so that it can't respond to the request in time. 
Maybe you are trashing the memory that holds the configuration descriptor.


 Now I am wondering if I could at least reproduce what is wrong also on my 
 linux system,
 I have no windows System available where I can work on the Embedded device.
 Does anyone know some Linux USB Device Test tool?

The USBCV tool actually replaces the host controller driver with a
special one that enables the sending of invalid commands and allows for
additional instrumentation.  As a result, it's tightly coupled to Windows.

This page might help you:   http://www.linux-usb.org/usbtest/

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Keep yourself connected to Go Parallel: 
INSIGHTS What's next for parallel hardware, programming and related areas?
Interviews and blogs by thought leaders keep you ahead of the curve.
http://goparallel.sourceforge.net
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] problem reading configuration descriptor, win xp, selfmade usb device

2012-11-27 Thread Tim Roberts
Arne Pagel wrote:
 No, it is a TI LM3s9B90 micro controller, and to get USB running I used some 
 lib provided by TI (or Luminary Micro at this Time)
 I didn't spend so much time to this in the past since it was running from the 
 beginning (under Linux).

Well, the Luminary/TI/Stellaris USB library is interrupt-driven, and
with an 80 MHz core, it ought to be able to keep up, unless you are
intercepting the GetDescriptor request in some way.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Keep yourself connected to Go Parallel: 
DESIGN Expert tips on starting your parallel project right.
http://goparallel.sourceforge.net
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] libusb_claim_interface() error with usbK driver

2012-11-20 Thread Tim Roberts
Markus wrote:
 I'm not entirely sure if this topic belongs to this list, but as
 it might affect usbK integration, it seems the best place to ask first.

 I've got a custom composite device with 3 interfaces for which I created 
 a usbK driver package by means of the usbK wizard (interface 0x0).

 When using libusbx, the device works as expected if I'm just accessing 
 interface 0, however as soon as I try to claim one of the other
 interfaces, I receive an error -12 from libusb_claim_interface.
 ...
 Is it a misconception on my side, that it suffices to have a
 driver registered for interface 0x0 of the device?

It is a misconception.  With the exception of a few device classes where
interfaces are grouped (like audio and video), every interface in a USB
device stands alone as a separate device, and needs a separate driver.

If you register a driver for the composite device (without an interface
number at all), then you only need one driver.  But if you don't
register for the composite device, the system supplies one (usbccgp),
which creates N separate subdevices, each of which starts crying for its
own driver.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Which removable drive matches which USB device?

2012-11-13 Thread Tim Roberts
therau2000 wrote:

 In my case, it is always a one-to-one match; all USB devices have only
 one partition formatted as FAT32.

Today, maybe.  Will your software never be used on other systems?


 What is the API solution you were referring to? I might have to use
 ioctls for another purpose...

You run through each allocated drive letter, and use
IOCTL_STORAGE_GET_DEVICE_NUMBER to get a STORAGE_DEVICE_NUMBER for the
device.  Then, you use the SetupDi APIs to enumerate through all of the
disk devices, fetch the hardware ID from each, find the one that matches
your device, use IOCTL_STORAGE_GET_DEVICE_NUMBER on that, and match that
to the list you got from the drive letters.  It's a pain.

   
http://forums.codeguru.com/showthread.php?499595-RESOLVED-Need-to-get-name-of-a-USB-flash-drive-device

It's also possible to extract this information from the registry, but
that's even worse.  In
HKLM\System\CurrentControlSet\Enum\USB\Vid_Pid_
there will be one subkey for each unique device, by serial number.  If
that key has a subkey called Control, then it is mounted.  Then, under:
HKLM\System\CurrentControlSet\Enum\USBSTORE
you'll find a subkey with the same name as the subkey above.  In that
key, there will be a ParentIdPrefix that identifies the device.  Then,
in the list of mounted devices in
HKLM\System\MountedDevices
you'll see the list of mounted drive letters as
\DosDevices\A:
\DosDevices\B:
One of those values will contain the ParentIdPrefix from USBSTORE.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] libusbx and Windows 8 and Windows 8 RT

2012-11-01 Thread Tim Roberts
Xiaofan Chen wrote:
 Now that Windows 8 and Windows RT have been released to the
 general public and new computers/tablets/hybirds are being
 released with Win8 and WinRT as the OS. It will be interesting
 to see how libusbx work under Windows 8.

It shouldn't be an issue at all.  Internally, Windows 8 is not all that
different from Windows 7.  All of my USB drivers have just
plugged-and-played.  Only the UI is different, although the UI is
DRAMATICALLY different.  Even for a Microsoft fanboy like me, there is
much to hate here.

There is one small installation difference.  In Windows 8, all driver
packages must have a CAT file.  I don't know whether the non-WinUSB
back-ends were using a CAT file before, but that may be an issue.


 Right now I assume libusbx will not work under Windows RT.

Right, and it never will.  You cannot run standard Win32 applications or
DLLs in Windows RT at all.  The APIs are blocked.  Unless you get
special blessing from Microsoft (and so far only the browser makers have
that blessing), RT will only run Windows Store applications that run
under the control of the WinRT runtime, and the runtime is the only
component that can do I/O.


 But maybe it is worth looking at how to get it work there.
 WinUSB apparently works under Windows RT.

The only way to use USB is through the WinRT runtime.  That runtime uses
WinUSB.  At this point, there is no other way to do it.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Help needed with deployment issues on Windows

2012-10-29 Thread Tim Roberts
therau2000 wrote:
 On Mon, 2012-10-29 at 01:15 +0100, Peter Stuge wrote:
 Find out exactly how those commands get sent, and find a method to
 send them which is outside the USB domain if possible, since that
 will be both simpler for you to implement *and* will provide a
 significantly better user experience.
 The competing program uses a .dll to communicate with the Device's
 Firmware. By examining that .dll file, I just discovered that it is
 calling DeviceIoControl in kernel32.dll. MS documentation about
 DeviceIoControl states An application can use the DeviceIoControl
 function to perform direct input and output operations on, or retrieve
 information about, a floppy disk drive, hard disk drive, tape drive,
 or CD-ROM drive.. Somewhere else I read that SCSI Pass Through is
 implemented using DeviceIoControl direct (meaning un-buffered).

There are exactly five fundamental I/O operations on Windows (copied
from the original Unix model): open, close, read, write, and ioctl. 
(Linux adds mmap to that list.)  The APIs for those operations happen to
be spelled CreateFile, CloseHandle, ReadFile, WriteFile, and
DeviceIoControl.  DeviceIoControl does not necessarily mean unbuffered. 
It's just the general-purpose way to send requests to a driver.

One key thing to remember here is that SCSI passthrough is a disk
concept, not a USB concept.  The ioctl is sent to disk drivers, not to
USB drivers.  They are at different layers of abstraction.  Even SATA
disk drives accept SCSI passthrough commands.


 So I imagine this is how the competing program's .dll communicates
 with the Device's Firmware.

 Writing Java and C code using the libusbx API is doable for me; I have
 done it and it does work nicely. But I am afraid that writing code for
 DeviceIoControl is beyond my capabilities. So unless someone helps
 in one way or another I am afraid I will have to... give up.

Ioctls are not conceptually difficult.  A read has one buffer.  A write
has one buffer.  An ioctl has a command code and two buffers.  That is
quite literally the only difference between the three operations.

There are examples on the web showing how to open a disk device and send
SCSI passthrough ioctls.  However, just like with USB, you have to know
what you're sending in the passthrough to achieve the results you want. 
You can discover that -- you have to have a reference.  We don't know
what commands the disk firmware expects, and there's no good way to find
out.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

--
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Help needed with deployment issues on Windows

2012-10-26 Thread Tim Roberts
therau2000 wrote:

 2-my Java Program is currently being used by well over 1600 people
 world-wide. Installing libusb-win32 driver is not an option because:
 a-it disables the default Windows removable-drive driver USBSTOR,
 therefore making it impossible to access recorded Videos/Photos;
 b-the competing program (32-bit Windows only) does not require
 User to install anything to work correctly.
 Question: how can libusbx piggy-back its communication to USB
 devices over driver USBSTOR ?

It is possible that your competing program installs a filter driver. 
That can be done silently and does not require the normal PnP
installation process, although the device has to be restarted or
unplugged/replugged.

I don't believe any of the libusbx back-ends operate as a filter
driver.  However, I thought that the libusb-win32 COULD act as a
filter.  Am I wrong?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

--
The Windows 8 Center 
In partnership with Sourceforge
Your idea - your app - 30 days. Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Selecting a composite device interface?

2012-10-19 Thread Tim Roberts
g...@novadsp.com wrote:
 ProductID: 0xA00A
 Interfaces: 2
 Number of alternate settings: 1
 Interface Number: 0
 Number of endpoints: 2
 Descriptor Type: 5
 EP Address: 133
 Descriptor Type: 5
 EP Address: 6
 Number of alternate settings: 1
 Interface Number: 1
 Number of endpoints: 0

 What I don't get is how to write to the second interface.

If the second interface has no endpoints and no alternate settings,
what's the point?  You can write to the device's control endpoint
without claiming an interface at all.

Remember that interfaces are just ways of collecting endpoints. 
Endpoint requests on the bus do not include an interface number. 
Claiming an interface just grants you ownership of the endpoints within
that interface.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] asynchronous code in multi-threading app

2012-10-15 Thread Tim Roberts
john smith wrote:

 But I got another performance issue I need your help again.

 My test app is doing  a loop, it seem that every time it loops, it
 takes SIGNIFICANT SLOWER than last time, if you look at debug trace,
 on the Throughput (Please see attached)

 1) Throughput : 1.37353082311847E-06 MB /sec
 2) Throughput : 1.47827364610777E-05 MB /sec
 3) Throughput : 0.00014234189339164 MB /sec
 4) Throughput : 0.00142455477006608 MB /sec
 5) Throughput : 0.014406354683313 MB /sec
 6) Throughput : 0.0431200269210705 MB /sec

Actually, this is showing things getting increasingly FASTER over time. 
Higher throughput means better performance.

The log shows that each transfer takes exactly the same amount of time
(about 2.7 seconds), but each one transfers ten times as much data as
the last (10, then 100, then 1,000, then 10,000, etc).  That naturally
produces the results you see.

So, basically, you aren't measuring what you think you are measuring. 
For example, it looks like you might have a fixed delay of 2.5 seconds
somewhere between your start and your stop.  You can't measure
throughput if you are blocking in your timing code.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] LibUSB bulkread always got a TIMEOUT

2012-09-21 Thread Tim Roberts
Ricardo Villamil wrote:
 I have the exact same problem, did you find a solution?

You don't have the exact same problem.  You might be getting a timeout,
but that's almost certainly because you're using the device
incorrectly.  Every device is different.  Show us your code, and tell us
what you expected.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] asynchronous code in mufti-threading app

2012-09-12 Thread Tim Roberts
John Chen wrote:
 Hi,
 My app needs be able  to read  write (to different enpoint) at same
 time, and my code is not working. but if I change the call to
 Synchronous , everything works fine, could any one tell me what I did
 wrong here?

Is LibUSBDevice::WriteCallback declared as static?

What DO you see?  Is there an error, or does it simply never return? 
How many bytes are you trying to read?  What is the value of endpoint?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Trouble with USB communication Windows

2012-09-12 Thread Tim Roberts
Eric Lundby wrote:

 I have spent hours now trying to get communication working with a
 custom USB device on Windows using libusbx. I have communication
 working through a virtual com port so I believe the device is
 functioning as expected.

 My device reports that it has 3 interfaces (0, 1, 2) and a total of 5
 open pipes (see below for the complete output). However my calls to
  libusb_claim_interface return -12 for all interfaces except 2 which
 is HID. I am able to get two way communication over HID, but the USB
 device i'm using only supports minimal functionality over HID (or
 atleast thats my understanding).  I'm not sure if this is due to some
 driver configuration, bugs in my code, bugs in windows backend etc.  
 My code is as follows:

 r = libusb_init(ctx);//Success
 libusb_set_debug(ctx, 3);
 dev_handle = libusb_open_device_with_vid_pid(ctx, 0x04D8,
 0x00DF);//Success
 r = libusb_claim_interface(dev_handle, interface_number);//Returns -12
 for interfaces 0 and 1,

Interfaces 0 and 1 are CDC (communication class).  It's possible those
interfaces are already being claimed by a virtual COM port driver.

How did you install the libbusb driver?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] asynchronous code in mufti-threading app

2012-09-12 Thread Tim Roberts
John Chen wrote:
  
  Here is the problem
 1) in the following code.
 ...
 for some very simple multi-threading , it works, but in more
 complicate case,  the code stuck in the  loop and I am getting the
 following:
 ...
 somehow the callback is never called.

We can't diagnose this.  There is just way too much of the code that we
don't have.  Are you suggesting that events are somehow getting lost? 
You'd need to do some tracing to match up requests-in with events-out to
make sure of that.


 2) If I  lock a shared critical_section in the beginning of the
 transfer function,(That means I am running single thread, I am
 serialize the call) it takes 4-5 calls for
 libusb_handle_events_timeout to call the callback and exit the loop.
 this is the case even when 0 byte is read.

Well, when 0 bytes are read, it should time out.  Right?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] asynchronous code in mufti-threading app

2012-09-12 Thread Tim Roberts
John Chen wrote:
 Tim, I attache the usb debug trace and USB_Trace here. Yes, I did get
 a timeout, but if you look at  USBTrace.txt, it have the following:

 [libusb_get_next_timeout] no URB with timeout or all handled by OS; no
 timeout!
 do you need what it means?

It looks like you are running multiple simultaneous event loops.  Is
that correct?  You don't need to do that.  You can see how the log
output is garbled, apparently because the log output is intermixed with
another thread writing at the exact same time.

My best guess is that you have some kind of multithreading problem, but
there's not much we can do without seeing the whole code, and I'm not
sure you really want to do that.  You need to think about what order
things are happening, remembering that asynchronous operations will
always arrive at the most inconvenient time.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] More Windows/Linux discrepancies: reading from EP1IN

2012-09-06 Thread Tim Roberts
Chris McClelland wrote:
 Basically, the supplied FX2 firmware (in libusbx/fx2/fw/firmware.hex)
 enumerates with two IN endpoints, EP1IN and EP2IN.

Endpoint 1 is the poor stepchild in the FX2.  The functionality is
limited, the buffering is fixed and limited, and it uses different
registers from the other endpoints.  As a general rule, you'll be much
happier if you forget about it, and always restrict yourself to the
even-numbered endpoints.

Your descriptors have the max packet size set to 64 for endpoint 1. 
That's not valid.  In a high-speed devices, bulk endpoints must ALWAYS
have a max packet size of 512.  That's required by the spec.  Because
the FX2 only has a 64-byte buffer for endpoint 1, that presents a
philosophical problem, and the FX2 data sheet points this out.  You have
to report it as 512 bytes, but make sure you never try to do a packet
larger than 64.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Handles for Windows WaitForXXX API?

2012-08-09 Thread Tim Roberts
g...@novadsp.com wrote:
 No good since there can be no data from device until you initiate a
 transfer.
 ? err, no. My device might well start to write back down the pipe as 
 soon as it has been configured.

No, although it may be a matter of semantics.  Your device can queue up
data to be sent, but it is not allowed to put anything on the wire until
it gets an IN token from the host, and that will only happen if the host
controller driver has a pending request from you.  If you don't ask for
it, the device is never given the opportunity to send.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] [PATCH] Windows CE backend and driver

2012-08-07 Thread Tim Roberts
Pete Batard wrote:
 Of course it would be quite ironic if intel were the ones who pushed MS 
 and others to use ia64 in the first place, in order to push brand 
 recognition (ia = Intel Architecture), and got bitten at their own 
 game when their competitor both followed suit with amd64 and actually 
 managed to set the course for mainstream 64 bit adoption.

Karma's a bitch ain't it?   ;)

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] [PATCH] Windows CE backend and driver

2012-08-06 Thread Tim Roberts
Pete Batard wrote:
 and it seems Microsoft can't stick to a naming convention anyway (For 
 instance, in latest WinUSB redistributables [1] MS replaced amd64 for 
 x64 for the x86_64 binaries)...

Well, they do have to worry about pressure from their partners.  When
AMD first proposed the 64-bit extensions, it made a certain amount of
sense to call the architecture amd64.  After all, Intel had ia64, and
there was no guarantee at the beginning that amd64 would end up being
the de facto standard.  By the time Intel borrowed the concept and
named it EM64T, the Windows build tree already had the amd64 name
embedded throughout.

I assume this irritates Intel every time they see it, and so they keep
having guys in nice suits whisper in the ears of Microsoft management
that it would really be more fair and accurate if you dropped the amd64
name.  That's gradually happening over time.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Access garmin devices using libusb on linux and windows

2012-07-26 Thread Tim Roberts
Luiz Andrade wrote:
  
 If you don't wanna help, you do not have to answer my questions.

You are not being fair.  I have been very helpful.  I've looked up
references,  pointed out the appropriate documents, and suggested web
pages.  I didn't write your code for you, but I have certainly pointed
you in the right direction.


 Keep to yourself your thoughts about people who don't know how to use
 libusbx.
 I was thinking that this forum was made to help people use libusbx.

It is.  But you are not asking for help on how to use libusbx.  You are
asking for help on how to talk to your Garmin.  We don't know more about
that than you do.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Access garmin devices using libusb on linux and windows

2012-07-25 Thread Tim Roberts
Luiz Andrade wrote:

 using WinUSB I was able to open my garmin gps device. Thanks for your
 help!!!
 Now let ask you one more thing, can you help me read informations from
 my gps, give some sample code, some internet page to read, anything?

I am generally a patient person, but I am finding it very difficult to
remain civil.  You are asking us to write your code for you, apparently
without making any effort to do so on your own.  You can use Google just
as well as the rest of us.  I would like to point out that, before you
asked your first question, I had never looked at a Garmin device.  I
learned the information I gave you by using Google and reading snippets
of the Garmin documentation.  You can do the same.

I will repeat my previous question: did you READ the documents on the
page I sent you last time?  The Garmin SDK documentation contains a
detailed description of the data formats produced by their devices. 
Their driver is not very complicated -- it mostly just passes requests
straight through to the device.  YOU ought to be able to figure out from
that document what the data is you are receiving from USB.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Async API question:

2012-07-24 Thread Tim Roberts
Kevyn-Alexandre Paré wrote:
 Here's the code and output of my test. I'm trying to understand what's going 
 wrong! I mean that I'm expecting the callback function cb_xfr from my bulk 
 transfer to be called after libusb_submit_transfer is called. I'm 
 communicating to a FPGA through a Cypress USB (FX2) and It's working with the 
 synchronous API but not yet with the Asynchronous one??? I have put the 
 usbmon output that I'm still reading and learning about it. If you see 
 something let me know!
 ...
 static int benchmark_in(uint8_t ep)
 {
 static uint8_t buf[6] = {0x2,0xa0,0x3c,0x23,0x3,0x0};
 static struct libusb_transfer *xfr;
 int num_iso_pack = 0;

 xfr = libusb_alloc_transfer(num_iso_pack);
 if (!xfr)
 return -ENOMEM;

 libusb_fill_bulk_transfer(xfr, devh, ep, buf,
 sizeof(buf), cb_xfr, NULL, 0);

 gettimeofday(tv_start, NULL);
 printf(--SUBMIT length:%d\n, sizeof(buf));
 return libusb_submit_transfer(xfr);
 }

When you are doing a bulk IN transfer, you always need to specify a
buffer that is as large as your endpoint size.  Remember that a USB
device is never told how much data to send.  It is merely given a signal
that says GO!.  At that point, the device has the perfect right to
send 512 bytes.  However, the host controller will only have allocated
enough bus time for 6 bytes.  Your device steps on the next device's
slot.  That's a protocol violation called babble.


 int main(int argc, char **argv)
 {
 ...
 rc = libusb_set_interface_alt_setting(devh, 1, 0);

It is not useful to select an alternate setting unless you have more
than one.  If you only have bulk pipes, then you have no need for
alternate settings.


 libusb_clear_halt(devh, 0x06);
 libusb_clear_halt(devh, 0x88);

Why do you call  clear_halt here?  In virtually every case, that's
unnecessary superstition.

Are you sure your device has queued up data to send?  What is it that
tells your device to put data in the FX2 FIFO?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Access garmin devices using libusb on linux and windows

2012-07-24 Thread Tim Roberts
Luiz Andrade wrote:
 The Garmin SDK is very hard to use in my point of view...

I promise you that will be easier to use than going direct to USB.


 I tryed to use it but i can't find almost anything on the web about it
 so, 

Then you haven't been looking.  I gave you the URL.


 I don't wanna work with web applications, I need a desktop application
 in c++

So, you didn't actually read the link I gave you?
http://developer.garmin.com/web-device/device-sdk/

That is not a web API.  It's a C interface.  That zip includes a
specification in PDF form, and sample C program that shows you the exact
interface to the Garmin DLL.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Map DeviceIoControl calls to libusb_control_transfer

2012-07-20 Thread Tim Roberts
John Chen wrote:
 Tom,
 Would you please show me how did you get   bmRequestType  to value 0xC2.

I did this so often that I finally created a cheat sheet that I keep
in a text file.

  +---+---+---+---+---+---+---+---+
  | d |  type |   | recip |
  +---+---+---+---+---+---+---+---+
| |   |
| +- 0 Standard   +- 0 Device
|1 Class 1 Interface
|2 Vendor2 Endpoint
|3 Other
+- 0 To device
   1 From device

00 Standard device, outgoing
01 Standard interface, outgoing
02 Standard endpoint, outgoing
03 Standard other, outgoing
20 Class device, outgoing
21 Class interface, outgoing
22 Class endpoint, outgoing
23 Class other, outgoing
40 Vendor device, outgoing
41 Vendor interface, outgoing
42 Vendor endpoint, outgoing
43 Vendor other, outgoing
80 Standard device, incoming
81 Standard interface, incoming
82 Standard endpoint, incoming
83 Standard other, incoming
a0 Class device, incoming
a1 Class interface, incoming
a2 Class endpoint, incoming
a3 Class other, incoming
c0 Vendor device, incoming
c1 Vendor interface, incoming
c2 Vendor endpoint, incoming
c3 Vendor other, incoming

All other values of bmRequestType are invalid.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] libusb_get_string_descriptor_ascii always fail.

2012-07-16 Thread Tim Roberts
John Chen wrote:

 Yes, I already installed the  UMDF driver on windows, I do not know
 exactly what libusb is trying to do here, I looked some of libusb's
 source code, looks like it is using some of winusb api. from the
 legacy code (that works), I noticed that it passes 
 IOCTL_EZUSB_GET_SERIAL_NUMBER  to windows api  DeviceIoControl , but I
 do not see anywhere I could pass this parameter
 to libusb_get_string_descriptor_ascii, does that
 mean libusb_get_string_descriptor_ascii will not working for me on
 this device? if  yes, how do I map the call
 from DeviceIoControl to libusb_control_transfer

You are confusing two things here.  IOCTL_EZUSB_GET_SERIAL_NUMBER is a
custom command to a custom driver.  It is not a USB function.  It is a
command that Cypress' custom driver understands.  When the Cypress
driver receives that ioctl, it sends a standard USB GET_DESCRIPTOR
command to the device.

When you are using libusbx, you are not talking to Cypress' driver.  You
are talking to one of the libusbx back-end drivers.  They have their own
set of commands, but you never see those commands.  The library sends
those commands based on the libusbx functions you call.

In this case, the libusbx request you are making will produce exactly
the same USB request that the IOCTL_EZUSB_GET_SERIAL_NUMBER ioctl
produces in the Cypress driver.  Your problem is not the command.  Your
problem is the way the drivers are configured.

Pete B is much more current on this process than I am.  He is well on
his way to having a solution for you.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Map DeviceIoControl calls to libusb_control_transfer

2012-07-16 Thread Tim Roberts
John Chen wrote:

 I need to convert a legacy app from win api calls to libusbx, most of
 the legacy app is using DeviceIoControl , from libusbx docs, the I
 believe I need to use libusb_control_transfer, but I am not sure how
 to change the calls from DeviceIoControl calls to
 libusb_control_transfer as the parameters for those api are total
 different.

 Would anyone give me some advice how to do that? maybe some examples?

Honestly, you should be able to figure this out on your own.  Did you
even notice that the parameter names in the
VENDOR_OR_CLASS_CONTROL_REQUEST structure are exactly the same as the
parameter names to libusb?  RequestType, Request, Index, Value?  A few
minutes reading would tell you how to combine direction, recipient and
request type into the bmRequestType field for control requests, but I
will tell you that a device-to-host vendor request to an endpoint has a
bmRequestType of 0xC2.

When you use libusbx, you are writing a driver.  It may not feel like
it, but it is a driver.  You need to understand something about USB in
order to drive a USB device, and right now you don't seem to have that.


 Below is some of our legacy calls in window api.

No, this is exactly one legacy call.


 {
 enError = SendVendorRequest(
 VENDOR_REQUEST_DIRECTION_DEVICE2HOST,// direction
 VENDOR_REQUEST_REQUESTTYPE_VENDOR,// request type
 VENDOR_REQUEST_RECEPIENT_ENDPOINT,// recipient
 VR_I2C_COMMAND,// request
 c_usDeviceId,// device id
 c_usOffset,// offset
 c_uiLength,// size
 reinterpret_castUCHAR*(pszAssNum));// buffer

bmRequestType = 0xC2
bRequest = VR_I2C_COMMAND
wValue = c_usDeviceId
wIndex = c_usOffset
length = c_uiLength

You should be able to figure the parameters out from that.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Question about libusb_get_pollfds?

2012-07-02 Thread Tim Roberts
Kevyn-Alexandre Paré wrote:


 If timerfd is available on your system, to manage timer expirations
 through a file descriptor, that's added to the POLLIN list.
 thx, The linux kernel that I'm using have timerfd enable!

 One question remains, how to distinguish the files descriptor from each other?

Why would you need to?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Question about libusb_get_pollfds?

2012-06-22 Thread Tim Roberts
Kevyn-Alexandre Paré wrote:
 So by calling the libusb_get_pollfds It return 3 file descriptor.

 So my question is why 3?

 2 files descriptor (POLLIN) that could be read.
 1 file descriptor (POLLOUT) that could be write.
 ...
 So I can see that POLLOUT could be the endpoint8 and 1 of the POLLIN the 
 endpoint6? If this is correct what is the other POLLIN file descriptor?

If timerfd is available on your system, to manage timer expirations
through a file descriptor, that's added to the POLLIN list.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] libusbx v1.0.12 has been released

2012-06-18 Thread Tim Roberts
philip.jos...@microchip.com wrote:
 Just a note in regards to WinUSB and Windows 8. It would appear that a
 device will not need to provide an INF as long as it provides Windows
 specific info in its OS descriptors...

When we talked about this before, it was mentioned that it would be
possible to write a filter driver for usbport.sys on the existing
operating systems to provide this same functionality.  Did anyone ever
undertake that project?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] libusbx v1.0.12 has been released

2012-06-18 Thread Tim Roberts
Pete Batard wrote:
 But wouldn't that require at least one manual installation of the filter 
 driver by the user, and therefore equate what we can already provide 
 with WCID on non Windows platforms, where one WCID WinUSB driver 
 installation is enough the make the platform behave the same way as 
 Windows 8 in terms of detecting and automatically installing drivers?

You're right.  I hadn't thought that through sufficiently.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] libusb_control_transfer() stalls

2012-06-14 Thread Tim Roberts
Markus wrote:
 Thanks, Pete. As Wireshark doesn't capture USB on Windows, it
 looks as I'll have to resort to a proprietary tool. 

 Can you (or somebody else reading the list) recommend something worthwhile in 
 a price range  500$ ?

I've used USB Monitor from HHD Software for many years.  Their GUI is a
little more video-game-like than I prefer, but it does the job.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] libusb_control_transfer() stalls

2012-06-13 Thread Tim Roberts
Markus wrote:
 int CypressFX3Device::WriteRAM(size_t addr, 
   const unsigned char *data, size_t nbytes)

OK, please allow me to ask a foolish question.  Do you really have an
FX3, and not an FX2?  The FX2 only has 16kB of RAM, which is where you
are hitting the problem.  The FX3 is supposed to have 512kB, so it
shouldn't be an issue.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] libusb_control_transfer() stalls

2012-06-12 Thread Tim Roberts
Markus wrote:
 As of now, I can read and write memory by using vendor request
 control transfers. According to the manufacturer this is the way 
 to go for firmware dump and download.

That's a common mechanism.

 
 wValue (LSW) and wIndex (MSW) make up the address offset to write 
 the data to within device memory.

Are you sure you have the ordering correct?  (It probably is, because
that lets those two fields  be treated as a single little-endian dword.)

 
 In both cases (r/w), the maximum value for wValue is 0x4000, after
 that libusb_control_transfer() returns pipe errors. As it is
 possible with the original tool to write beyond this address, I
 suspect it's not the device that produces the stall.

What is the actual error code you get from WinUSB?  If the error really
is a stall, then has to come from the device.  What is the
bmRequestType?  Is it a vendor request to the device?  Would you mind
showing us the code?


 As I don't have any known-good device where I could meaningfully
 test a control transfer with wValue  0x4000, I'd also be happy 
 for any hint towards how to reproduce this behaviour.

I have certainly done vendor device requests with wValue larger than 0x4000.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] New to libusbx ... possibly idiot question

2012-05-25 Thread Tim Roberts
g...@novadsp.com wrote:
 please be aware that the Windows driver we use at the
 moment doesn't support isoch (see Known Restrictions for WinUSB at
 [1]),
 Indeed. Why on earth make WinUSB without isoch support.

Microsoft's answer is because (1) it's hard to abstract it in a
reasonable and bullet-proof way, (2) the performance penalty of handling
things in user mode matters in isochronous use cases, and (3) the only
uses for isochronous are audio and video, and those device classes can't
be done in user-mode in Windows anyway.

When news of this limitation first came out 5 or 6 years ago, the USB
team at Microsoft sent out a blast saying We will add this if you have
a legitimate use case for it.  Let us know.  No one has let them know,
or at least no one that matters.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] interrupt transfer linux

2012-05-25 Thread Tim Roberts
Fabian Weiss wrote:
 I try to communicate with an USB device: http://nopaste.info/bc655859b3.html
 I want to read the 42 bytes of  bEndpointAddress 0x83  EP 3 IN.
 Therefore I installed libusb(x) under my Linux and wrote this little
 programm: http://nopaste.info/98c35ab092.html

 I dont understand why it doesnt work, so I am asking you. My output is:
 ..
 Device Opened
 Claimed Interface
 libusb:error [submit_bulk_transfer] submiturb failed error -1 errno=2
 read Error: -1
 Data read:
 Released Interface

 :(
 Can somebody tell my what I am doing wrong?

Yes:
r = libusb_interrupt_transfer(dev_handle, 3, buf, 10, transferred,
10); 

If you want endpoint 0x83, then you need to ask for 0x83, not 3.  Those
are two completely different endpoints.  There is no relationship
between endpoint 0x03 and 0x83.  It's NOT two directions of the same
endpoint, as many people seem to think.

Also, if you want 42 bytes, you should ask for 42 bytes, not 10.  In
general, you should ALWAYS ask for a multiple of the endpoint's packet size.

That's a HID endpoint.  Are you certain there will be HID traffic
waiting for you, and that you don't need to send a report request first?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] libusbx, xusb and ST-Link V2

2012-05-21 Thread Tim Roberts
Xiaofan Chen wrote:
 There is a warning, not so sure if it is really of importance or not.
 ...
 C:\work\libusbx\libusbx-1.0.11-win\examples\bin32xusb.exe -d 0483:3748
 Using libusbx v1.0.11.10499

 Opening device...
 [timestamp] [threadID] facility level [function call] message
 

 [ 0.00] [04a0] libusbx: warning [init_device] could not get node 
 connect
 ion information for device '\\.\USB#VID_PID_#52D0620DE01': [87] 
 The
 parameter is incorrect.

You understand this is not the same device, right? / is what you
get when a device fails to enumerate at the hardware level.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] [PATCH] Add topology calls

2012-05-11 Thread Tim Roberts
Pete Batard wrote:
 Thus, as part of the overall topology, I have to very much disagree with 
 anyone who wants to pretend that providing a port number or hub location 
 has little use. ... 

 Finally, I'd like to remind everyone that we are purveyors of a generic 
 library. As long as we don't have clear and precise information on an 
 user's specific intended usage, it is really not our damn job to 
 question what people would like to do with it or assume that they are 
 planning to use it wrong. Instead, our job is to ensure that our 
 library can be used in every imaginable way, including the ones we may 
 not necessarily approve of...

Every imaginable way.  I hope you have some clue to the size of the
can of worms you've opened up there.

Whether you like the terminology or not, there ARE paths that people
want to follow that are wrong, either because they don't fully
understand the technology, or they don't understand the implications of
their actions, or they have a flawed mental model of the system.  I
think you're doing a disservice to people by reinforcing a defective
mental model, instead of guiding them to a correct and sustainable
solution.  What does the topology concept mean in a VM environment? 
You're depending on interfaces that are system-specific but not promised
by contract.  Are you sure the mechanisms you need will still be there
in three years?

However, you're fully entitled to set policy, so I won't say any more on
the topic.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


  1   2   >