[Libusbx-devel] [PATCH/RFC] windows_usb: Fixing deadlock in backend when submitting transfers.

2012-05-02 Thread Toby Gray
aving libusb_submit_transfer() only call usbi_fd_notification() after having released the transfer mutex. Signed-off-by: Toby Gray --- libusb/io.c |7 ++- libusb/libusbi.h| 10 +- libusb/os/darwin_usb.c |2 +- libusb/os/linux_usbfs.c |2 +- libu

Re: [Libusbx-devel] [PATCH/RFC] windows_usb: Fixing deadlock in backend when submitting transfers.

2012-05-03 Thread Toby Gray
On 02/05/12 22:58, Pete Batard wrote: > On 2012.05.02 17:33, Toby Gray wrote: > This could lead to one of two deadlocks: > > 1) If the transfer completes while usbi_fd_notification() is waiting for > the event lock and the callback attempts to resubmit the transfer. > So transfe

[Libusbx-devel] [PATCH/RFC v2] windows_usb: Fixing deadlock in backend when submitting transfers.

2012-05-03 Thread Toby Gray
aving libusb_submit_transfer() only call usbi_fd_notification() after having released the transfer mutex. Signed-off-by: Toby Gray --- libusb/io.c |4 libusb/libusbi.h|3 +++ libusb/os/windows_usb.c |6 +++--- 3 files changed, 10 insertions(+), 3 deletions(-)

[Libusbx-devel] Allow sending of SET_CONFIGURATION for active configuration in Windows

2012-06-13 Thread Toby Gray
then closed the accessory (in your Android code) on the device then you can't open the accessory again until the device has sent another SET_CONFIGURATION message. Regards, Toby >From d5bd000d0d5db5d71cb29d280860acbdc511e919 Mon Sep 17 00:00:00 2001 From: Toby Gray Date: Wed, 13 Jun 20

Re: [Libusbx-devel] Allow sending of SET_CONFIGURATION for active configuration in Windows

2012-06-13 Thread Toby Gray
Sorry, my email client decided to send that email as HTML. Here is the contents as plain text: On 13/06/12 11:13, Toby Gray wrote: Hi, I've been trying to use libusbx to connect to an Android device via the Android Open Accessory protocol. The Windows machine (as USB host) is treated

Re: [Libusbx-devel] Allow sending of SET_CONFIGURATION for active configuration in Windows

2012-06-13 Thread Toby Gray
On 13/06/12 14:36, Xiaofan Chen wrote: > On Wed, Jun 13, 2012 at 6:13 PM, Toby Gray wrote: >> Once you've opened, used and then closed the accessory (in your Android >> code) on the device then you can't open the accessory again until the device >> has sent another

Re: [Libusbx-devel] Allow sending of SET_CONFIGURATION for active configuration in Windows

2012-06-15 Thread Toby Gray
On 13/06/12 13:59, Xiaofan Chen wrote: > On Wed, Jun 13, 2012 at 7:04 PM, Toby Gray wrote: >> Sorry, my email client decided to send that email as HTML. >> >> Here is the contents as plain text: >> >> >> On 13/06/12 11:13, Toby Gray wrote: >>&g

[Libusbx-devel] [PATCH] Fix indexing beyond end of interface array when handling HID devices

2012-07-12 Thread Toby Gray
Hi, When using libusbx on Windows we've discovered that we'd see a crash in set_hid_interface() when attempting to increment the nb_interfaces count. This was tracked down to being due to our process calling libusb_get_device_list multiple times in the same process. Every time this was calle

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

2012-07-13 Thread Toby Gray
Firstly I apologise for sending my message body as HTML, I've clearly not figured out how to force Thunderbird to always send as plain text. On 12/07/12 20:59, Pete Batard wrote: >>> 0004 - Replaces getenv() with NULL on WinCE due to it not being supported. >> Try to change this in a good way whe

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

2012-07-13 Thread Toby Gray
On 12/07/12 19:31, Peter Stuge wrote: > Hi Toby, > > As Pete likes to point out I have no authority in the libusbx > project, so as far as libusbx is concerned I think the best > might be if you could pretend that I had never posted this > feedback on the libusbx list. Thank you for spending time

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

2012-07-13 Thread Toby Gray
On 13/07/12 14:06, Pete Batard wrote: >> I've put an alternative fix into the branch which I plan to keep rebased >> on libusbx/master: >> https://github.com/tobygray/libusbx/commit/4b0f2413ae85d197db8721e2fda5a85355d95e1b >> >> The only thing I'm not sure of in this fix is that wince_usb.c doesn't

Re: [Libusbx-devel] [PATCH] Fix indexing beyond end of interface array when handling HID devices

2012-07-13 Thread Toby Gray
On 12/07/12 18:00, Pete Batard wrote: >> The attached patch fixes this by not adding the same interface path >> twice. It also adds a check for the interface table getting full. > Ideally I don't think we want to call set_hid_interface() more than we > need to, which is what happens here. So while

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

2012-08-06 Thread Toby Gray
On 05/08/12 23:24, Pete Batard wrote: > Finally got around to have a closer look at the winCE branch. Thank you for taking the time to look at it. All your comments seem sensible. I'm happy to make the suggested changes myself. I'm a bit busy at the moment so it'll be towards the end of this we

Re: [Libusbx-devel] [PATCH] Update libusb.h header in accordance with USB 3.0 specs

2012-09-06 Thread Toby Gray
On 06/09/12 11:07, Hans de Goede wrote: > Hi, > > On 09/06/2012 04:35 AM, Orin Eman wrote: >> On Wed, Sep 5, 2012 at 5:00 PM, Pete Batard > > wrote: >> >> This is #26: https://github.com/libusbx/__libusbx/issues/26 >> , but do

Re: [Libusbx-devel] Gearing up for the libusbx v1.0.13 release

2012-09-06 Thread Toby Gray
On 06/09/12 01:03, Pete Batard wrote: > Since we need to gear up for the 1.0.13 release, I have just pushed > back a few of the tasks that we had planned but that I don't really > see happening over the next few days, into 1.0.14. These include: > > - Adding the WinCE backend (Note to Toby: Yes,

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

2012-09-24 Thread Toby Gray
Hi, I've updated my branch ( https://github.com/tobygray/libusbx/tree/wince) with your review comments. The only one I didn't do was pulling some of the common code out of windows_usb.c and wince_usb.c. In merging the poll_wince.c and poll_windows.c, I removed the use of _open() and _close()

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

2012-09-27 Thread Toby Gray
hanks for the > updating your branch)! > > As you may have seen, we got some unexpected development that are going > to tie us down for a while, but as soon as that gets out of the way, > WinCE integration will be one of my top priorities. > > Regards, > > /Pete > >

Re: [Libusbx-devel] Crashes

2012-11-13 Thread Toby Gray
On 12/11/12 20:09, Pete Batard wrote: > Hi Stefano, > > On 2012.11.12 12:06, Stefano Di Martino wrote: >> is this supposed to crash, when you don't free a list? >> >> for(i = 0; i < 100; i++) { >> cnt = libusb_get_device_list(NULL, &devs); >> if (cnt < 0) >> return (int) cnt;

Re: [Libusbx-devel] Crashes

2012-11-22 Thread Toby Gray
On 13/11/12 18:49, Ludovic Rousseau wrote: > I would use a test/ directory for programs used for tests (stress test > in this case). > These stress test programs should NOT be used as example by our users. > We should try to avoid possible confusion where we can. > > It can be the beginning of a

Re: [Libusbx-devel] stress program crashes in libusb_exit(NULL);

2012-11-26 Thread Toby Gray
Sep 17 00:00:00 2001 From: Toby Gray Date: Mon, 26 Nov 2012 13:25:05 + Subject: [PATCH] Core: Fix incorrect reference counting of default context when first created. --- libusb/core.c |5 + 1 files changed, 1 insertions(+), 4 deletions(-) diff --git a/libusb/core.c b/libusb/core.c i

Re: [Libusbx-devel] Crashes

2012-11-26 Thread Toby Gray
On 25/11/12 01:45, Pete Batard wrote: > OK, the tests have now been pushed into mainline (as a single commit), > along with the 2 other commits that I said I'd be pushing some time ago. Excellent. I'll try to find time to do some improvements and possibly even add some tests which perform some IO

Re: [Libusbx-devel] stress program crashes in libusb_exit(NULL);

2012-11-26 Thread Toby Gray
On 26/11/12 01:31, Xiaofan Chen wrote: > If using libusbK, there is potentially another limitation. > http://libusb.6.n5.nabble.com/libusb-win32-devel-LstK-Init-return-error-tp5710868p5710878.html > "The module (LstK_Init) will only allow 64 outstanding lists at any > giving time; after which it re

Re: [Libusbx-devel] Crashes

2012-12-10 Thread Toby Gray
On 26/11/12 22:54, Pete Batard wrote: > On 2012.11.26 13:34, Toby Gray wrote: >> Excellent. I'll try to find time to do some improvements and possibly >> even add some tests which perform some IO. My thinking for tests which >> require particular types of devices would

Re: [Libusbx-devel] 2 new commits in libusbx

2013-01-08 Thread Toby Gray
On 07/01/13 22:34, Pete Batard wrote: Next in line (along with some long standing bugfixes, hopefully), WinCE integration at long last!! In anticipation of this, I've just rebased and tested my wince[1] branch on the latest libusbx master. Regards, Toby [1] https://github.com/tobygray/libu

Re: [Libusbx-devel] WinCE backend review comments - was: 2 new commits in libusbx

2013-01-09 Thread Toby Gray
On 09/01/13 00:34, Pete Batard wrote: > On 2013.01.08 14:56, Toby Gray wrote: >> In anticipation of this, I've just rebased and tested my wince[1] branch >> on the latest libusbx master. > Thanks. I'm picking it up and starting to look at it a bit more closely. >

Re: [Libusbx-devel] What about pull request #59: Fix compiler warnings when building with CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES;

2013-01-14 Thread Toby Gray
On 12/01/13 00:04, Pete Batard wrote: > Now if Toby is okay with rebasing off your changes, I don't really mind > if you push them, but from having been at the other end of the spectrum > a few times, I know that spending time on rebasing, even when it's > supposed to be trivial, is not always for

Re: [Libusbx-devel] 2 new commits in libusbx

2013-01-14 Thread Toby Gray
On 09/01/13 00:34, Pete Batard wrote: > 1. in .gitignore, there's a !wince/listdevs entry. Shouldn't there be > similar entries for xusb and test? Also what does the 'STANDARDSDK_500 > (*)' entry do? > 2. I see you using both a WINCE and _WIN32_WCE define. Is there a > difference between the two?

Re: [Libusbx-devel] WinCE integration (was: 2 new commits in libusbx)

2013-01-16 Thread Toby Gray
tand why poll_windows.h now needs to explicitly include (for ssize_t). I assume it must have just been luck before that all files which #included poll_windows.h happened to have already included libusb.h. Regards, TobyFrom 4927586400b7674816a4500ea4d969764fb9b65c Mon Sep 17 00:00:00 2001 From

Re: [Libusbx-devel] WinCE integration (was: 2 new commits in libusbx)

2013-01-23 Thread Toby Gray
On 23/01/13 01:25, Pete Batard wrote: > WinCE support is now in mainline. That's brilliant, thank you for all your effort. I apologise for not replying to your previous email yet. I keep on thinking I've got time to go through your comments but then some other issue comes up. As far as I can s

Re: [Libusbx-devel] WinCE integration (was: 2 new commits in libusbx)

2013-01-23 Thread Toby Gray
serBuffer.h(38) : error C2100: illegal indirection That isn't the issue with different kernel APIs between WinCE 5 and WinCE6. Can you try the attached patch and see if that fixes all of the issues other than the UserBuffer.cpp compilation? Regards, Toby >From 9129be8ff8e84a0892a345c0ea743

Re: [Libusbx-devel] Bug? libusb_bulk_transfer timeouts with data in buffer but reports 0 bytes transferred

2013-02-13 Thread Toby Gray
af5bb983 Mon Sep 17 00:00:00 2001 From: Toby Gray Date: Wed, 13 Feb 2013 15:21:52 + Subject: [PATCH] Windows: Update transferred data on timeout or cancel. When handling aborted transfer it's possible that some data (but not the full buffer) was transferred. This change ensures that this

Re: [Libusbx-devel] [PATCH] Simplify stdout redirection handling for stress test

2013-02-21 Thread Toby Gray
On 21/02/13 00:30, Pete Batard wrote: > While fixing #69 [1] (which has now been pushed), I got bothered by an > assertion error that was due to closing stdout, and since I didn't > initially get what the stdout redirection was all about here, I > decided to (hopefully) simplify it. I didn't re

Re: [Libusbx-devel] [PATCH] WinCE post integration cleanup

2013-03-04 Thread Toby Gray
On 03/03/13 00:59, Pete Batard wrote: > Final patch for the WinCE integration (should be applied after the > previous one). > > Besides the copyright update, the main goal was to remove #ifdefs that > could be avoided, which hopefully will help improve code readability. > > This was tested on bot

Re: [Libusbx-devel] [PATCH] Simplify includes and misc. cleanup

2013-03-04 Thread Toby Gray
On 27/02/13 23:15, Pete Batard wrote: > For your consideration. This is part of the WinCE cleanup I mentioned > some time ago. Thank you for taking the time to do that. It certainly does simplify things. > > While this is impacts a whole bunch of files, but it's mostly cleanup, > and I tested c

Re: [Libusbx-devel] [PATCH] Simplify includes and misc. cleanup

2013-03-05 Thread Toby Gray
On 04/03/13 21:44, Pete Batard wrote: > On 2013.03.04 14:38, Toby Gray wrote: >> Why winsock.h and not winsock2.h? > Simple. I tried winsock2 and got plenty of conflicts. > And since I didn't have time to invest resolving them, I went with winsock. Understandable. It turns ou

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

2013-03-22 Thread Toby Gray
nly seen it in our latest round of testing. I also can't reproduce it with debug builds of libusbx, only release binaries. Regards, Toby >From 2ad149d16c9d3c74134a42a81b13952a8895513f Mon Sep 17 00:00:00 2001 From: Toby Gray Date: Fri, 22 Mar 2013 13:50:01 + Subject: [PATCH] Windows:

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

2013-03-22 Thread Toby Gray
On 22/03/13 13:57, Toby Gray wrote: > > I also can't reproduce it with debug builds of libusbx, only release > binaries. I've just realised that the reason for this must be that debug builds aren't optimising out the variables around the buffer which is overrun. As the

Re: [Libusbx-devel] WinCE integration (was: 2 new commits in libusbx)

2013-03-22 Thread Toby Gray
t USB devices you want to test with the driver you might want to add some extra PIDs and VIDs to: ceusbkwrapper\drv\ceusbkwrapperdrv.reg Regards, Toby >From a05f844eaa30f92ab285e3bc41c746fb93d1bcd0 Mon Sep 17 00:00:00 2001 From: Toby Gray Date: Wed, 23 Jan 2013 11:39:26 + Subject: [PATC

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

2013-04-02 Thread Toby Gray
On 01/04/13 16:50, Pete Batard wrote: > Now pushed. > > Regards, > > /Pete > Thanks for that. Sorry for not providing a reworked patch, I was away from PCs for most of Easter. Regards, Toby -- Own the Future-Intel(R) L

Re: [Libusbx-devel] libusbx v1.0.15-rc1 is now available

2013-04-03 Thread Toby Gray
oby >From b0755a35d0f7d1047b0c6c11cbddee55659579c4 Mon Sep 17 00:00:00 2001 From: Toby Gray Date: Wed, 3 Apr 2013 12:02:50 +0100 Subject: [PATCH] WinCE: Add WinCE sources to Makefile.am so they end up in dist tarballs. --- libusb/Makefile.am |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libusb/

Re: [Libusbx-devel] libusbx v1.0.15-rc1 is now available

2013-04-04 Thread Toby Gray
On 03/04/13 20:35, Pete Batard wrote: On 2013.04.03 12:09, Toby Gray wrote: The attached patch fixes this. Thanks for testing. Your patch is now part of RC2, and I confirmed that RC2 compiled for WinCE on my test environment. Agreed. RC2 works fine for me too. If I provide a zip of pre

[Libusbx-devel] Storing debug database for prebuilt binaries

2013-04-04 Thread Toby Gray
Hi, I'm in the middle of tracking down (and hopefully fixing) a rare memory fault in the desktop Windows version of libusbx*. When the issue was reported by one of our internal testers it wasn't possible for me to decode the Windows Error Reporting (WER) information in any sensible way as I di

[Libusbx-devel] [PATCH] Fix NULL pointer dereference in Windows and WinCE backends when reusing transfers

2013-04-04 Thread Toby Gray
that this is probably too risky a change to get into 1.0.15, especially as no-one else seems to have reported it. Regards, Toby >From f9da0f7b1470f098ae76fee686562c5fcb17961d Mon Sep 17 00:00:00 2001 From: Toby Gray Date: Thu, 4 Apr 2013 16:27:21 +0100 Subject: [PATCH] Windows and WinCE: Co

Re: [Libusbx-devel] [PATCH] Fix NULL pointer dereference in Windows and WinCE backends when reusing transfers

2013-04-11 Thread Toby Gray
On 05/04/13 02:25, Xiaofan Chen wrote: > On Fri, Apr 5, 2013 at 12:04 AM, Toby Gray wrote: >> I understand that this is probably too risky a change to get into 1.0.15, >> especially as no-one else seems to have reported it. > There were past reports of issues under Windows XP an

Re: [Libusbx-devel] Storing debug database for prebuilt binaries

2013-04-11 Thread Toby Gray
On 04/04/13 19:54, Pete Batard wrote: On 2013.04.04 14:45, Toby Gray wrote: Would it make sense to create a zip of the symbols for the pre-compiled binaries available on sourceforge? Well, I guess if we do, we might as well make that part of the Windows binary generation process, since I get

Re: [Libusbx-devel] [PATCH] Fix NULL pointer dereference in Windows and WinCE backends when reusing transfers

2013-04-11 Thread Toby Gray
doesn't solve the read of the fd while trying to find the transfer in the flying transfers, but I'm not sure any of the current locks can help with that. Regards, Toby >From 2ce7f9822cedb6690b40ff4573316f40536aa8d6 Mon Sep 17 00:00:00 2001 From: Toby Gray Date: Thu, 11 Apr 2013

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

2013-04-11 Thread Toby Gray
transfer completion callbacks, as well as when the callbacks can occur. Any thoughts or alternative suggestions are welcome. Regards, Toby >From 80e453300a5c738e0793a61170346e01b09d942b Mon Sep 17 00:00:00 2001 From: Toby Gray Date: Thu, 11 Apr 2013 15:59:45 +0100 Subject: [PATCH] Initial attempt

Re: [Libusbx-devel] Storing debug database for prebuilt binaries

2013-04-12 Thread Toby Gray
On 11/04/13 22:44, Pete Batard wrote: On 2013.04.11 12:18, Toby Gray wrote: I will modify the bwince.cmd that I send previously Ah sorry, I completely missed that one, along with your SF id. You should now have the rights to upload and modify files in the SourceForge download area. That

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

2013-04-12 Thread Toby Gray
On 11/04/13 18:17, Tim Roberts wrote: > 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 >&

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

2013-04-12 Thread Toby Gray
Hi, On 12/04/13 12:49, Hans de Goede wrote: > > On 04/11/2013 05:20 PM, Toby Gray wrote: >> >> I see two possible ways of approaching the problem: >> >> 1) Add a new type, libusb_event_handle, which either maps to an FD or >> a HANDLE, as appropriate on

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

2013-04-12 Thread Toby Gray
On 12/04/13 00:27, Pete Batard wrote: > On 2013.04.11 16:20, Toby Gray wrote: >> Rather than trying to optimise how the fake fds are generated and >> handled, I think the best thing to do is to add improved APIs to improve >> event handling on platforms which don't ha

Re: [Libusbx-devel] Storing debug database for prebuilt binaries

2013-04-15 Thread Toby Gray
On 13/04/13 23:22, Pete Batard wrote: On 2013.04.12 15:46, Toby Gray wrote: I've uploaded WinCE binaries built from RC3 (so they don't include any changes since the rc3 tag). I'll add updated binaries when you tag each RC. Thanks. I'm trying to get to an RC4, as I'd

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

2013-04-16 Thread Toby Gray
On 16/04/13 01:01, Pete Batard wrote: > Windows binaries should also now be available. > WinCE binaries are now also available. Regards, Toby -- Precog is a next-generation analytics platform capable of advanced analyti

Re: [Libusbx-devel] Storing debug database for prebuilt binaries

2013-04-16 Thread Toby Gray
by >From 2af5612640b820579cbc3ca086c02a5a2ebd8c12 Mon Sep 17 00:00:00 2001 From: Toby Gray Date: Tue, 16 Apr 2013 15:22:14 +0100 Subject: [PATCH] WinCE: Include COPYING and license information in binary snapshots. --- .private/bwince.cmd|1 + .private/wbs_wince.txt |5 +

Re: [Libusbx-devel] Towards a 1.0.16 release, hotplug test branch, please test

2013-05-20 Thread Toby Gray
d it on hardware yet). I suspect that people will have strong opinions on the first patch which creates poll_posix.c. Hopefully the other patches aren't as controversial. Regards, Toby >From 5f8115fb45d46f2b2837ee4cb529a1bc9ff67f04 Mon Sep 17 00:00:00 2001 From: Toby Gray Date: Mon

Re: [Libusbx-devel] Towards a 1.0.16 release, hotplug test branch, please test

2013-05-21 Thread Toby Gray
On 21/05/13 00:24, Nathan Hjelm wrote: >>> and 2) >>> change the one call to pipe to be a call to usbi_pipe instead of using >>> #define? >> Maybe I'm missing something there. >> >> Would we still have a naked call to pipe anywhere on POSIX after this >> patch is applied? >> If there is one, then I

Re: [Libusbx-devel] Towards a 1.0.16 release, hotplug test branch, please test

2013-05-21 Thread Toby Gray
On 20/05/13 23:43, Pete Batard wrote: > On 2013.05.20 17:06, Nathan Hjelm wrote: >> On May 20, 2013, at 09:51 AM, Toby Gray wrote: >>> I've attached a handful of patches of changes needed to get WinCE >>> building (I've not tried it on hardware yet). I sus

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

2013-05-29 Thread Toby Gray
On 29/05/13 01:17, qse drf wrote: > > That's the problem. The supposedly synchronous function calls each return > success > as I call them in order: OUT 1KB, IN 16B, OUT 1KB, IN 16B > But the bus trace shows: OUT 2KB, IN 16B, IN 16B > This is the case even if I add a 5 second delay after each call

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

2013-05-30 Thread Toby Gray
On 29/05/13 18:18, qse drf wrote: That's the problem. The supposedly synchronous function calls each return success as I call them in order: OUT 1KB, IN 16B, OUT 1KB, IN 16B But the bus trace shows: OUT 2KB, IN 16B, IN 16B This is the case even if I add a 5 second delay after each call to libus

Re: [Libusbx-devel] stress test failed under Linux

2013-06-13 Thread Toby Gray
On 13/06/13 14:07, Hans de Goede wrote: > Hi, > > On 06/13/2013 02:41 PM, Xiaofan Chen wrote: >> stress test failed with the latest git tree. >> 1.0.15 release works fine. >> >> mcuee@ubuntu1304vm:~/Desktop/build/libusbx$ ./tests/stress >> Starting test run: init_and_exit... >> Failed to init libus

[Libusbx-devel] [PATCH] WinCE: Fix device reference leak which caused crash on libusb_exit().

2013-06-24 Thread Toby Gray
The Windows CE device allocation code has always had a bug where it would leak references to devices when they are allocated. This commit removes the reference leak. This leak was highlighted by the new hotplug code which now triggers a NULL pointer dereference if not all devices are unreferenced

[Libusbx-devel] [PATCH] Core: Avoid passing uninitialised data down the hotplug pipe.

2013-06-26 Thread Toby Gray
Due to alignment requirements, libusb_hotplug_message might have some padding bytes. This change makes sure that these padding bytes are initialised. Valgrind no longer complains about passing uninitialised data to the write system call. --- libusb/core.c |2 ++ 1 file changed, 2 insertions(+

Re: [Libusbx-devel] [PATCH] WinCE: Fix device reference leak which caused crash on libusb_exit().

2013-06-26 Thread Toby Gray
On 26/06/13 15:44, Hans de Goede wrote: > Hi, > > On 06/26/2013 03:30 PM, Hans de Goede wrote: >> Hi, >> >> Thanks for the patch, pushed to master. > On second thought, I've found a problem with your patch, > after your patch the code always unrefs dev, but if > usbi_get_device_by_session_id() succ

[Libusbx-devel] Improved logging

2013-06-27 Thread Toby Gray
I've made a couple of changes to the logging in libusbx. The first is to make a single fprintf call for each log line, as suggested by Chris Dickens. The second change makes it possible to enable logging output in Windows to go to the debugger. This makes it considerably easier to debug issues in

[Libusbx-devel] [PATCH 2/2] Windows: Make ENABLE_DEBUG_LOGGING enable logging output to the debugger.

2013-06-27 Thread Toby Gray
This change makes it considerably easier to debug issues in UI applications which don't necessarily have a console connected to stderr. Outputting to the debugger shouldn't occur in normal situations so this change has to be explicitly enabled by a build-time config flag. --- libusb/core.c | 10

[Libusbx-devel] [PATCH 1/2] Core: Make writing of log lines a single fprintf call.

2013-06-27 Thread Toby Gray
--- libusb/core.c| 40 +--- libusb/libusbi.h | 10 ++ 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/libusb/core.c b/libusb/core.c index bc44415..5c93f4b 100644 --- a/libusb/core.c +++ b/libusb/core.c @@ -2017,12 +2017,19 @@ int

Re: [Libusbx-devel] [PATCH 1/2] Core: Make writing of log lines a single fprintf call.

2013-06-27 Thread Toby Gray
On 27/06/13 13:25, Hans de Goede wrote: > Hi, > > > > A (v)snprintf return of -1 means that the output was truncated > (on some libc-s) throwing away the header if that got truncated > somehow is fine, but throwing away the log message is not. I'd forgotten that some libc-s return -1 meaning trun

[Libusbx-devel] Improved logging v2

2013-06-27 Thread Toby Gray
This is a slightly reworked version of my previous logging patches. I've improved the commit message for the first patch and made the changes suggested by Hans de Goede relating to return value of snprintf calls. Regards, Toby ---

[Libusbx-devel] [PATCH v2 2/2] Windows: Make ENABLE_DEBUG_LOGGING enable logging output to the debugger.

2013-06-27 Thread Toby Gray
This change makes it considerably easier to debug issues in UI applications which don't necessarily have a console connected to stderr. Outputting to the debugger shouldn't occur in normal situations so this change has to be explicitly enabled by a build-time config flag. --- libusb/core.c | 10

[Libusbx-devel] [PATCH v2 1/2] Core: Make writing of log lines a single fprintf call.

2013-06-27 Thread Toby Gray
Prior to this change a single line of logging performing several fprintf. This change gets all the data for a line to be logged in a single fprintf call. This reduced the chances of writes from another thread getting intermixed with a log line. It also makes it easier to change where logs are out

Re: [Libusbx-devel] Improved logging v2

2013-06-27 Thread Toby Gray
On 27/06/13 16:15, Hans de Goede wrote: Hi, On 06/27/2013 03:49 PM, Toby Gray wrote: This is a slightly reworked version of my previous logging patches. I've improved the commit message for the first patch and made the changes suggested by Hans de Goede relating to return value of snp

[Libusbx-devel] [PATCH 10/11] Windows: Pre-reserve pollfds before submitting transfers.

2013-06-27 Thread Toby Gray
This change makes the Windows and Windows CE backend pre-reserve pollfds before submitting transfers. This allows these backends to correctly handle failure to reserve pollfds. Prior to this change both backends ignored the return value from usbi_add_pollfds. --- libusb/os/wince_usb.c | 13 ++

[Libusbx-devel] [PATCH 07/11] Tests: Add test for 64 concurrent control requests.

2013-06-27 Thread Toby Gray
This test is being added to provoke MAXIMUM_WAIT_OBJECTS on Windows platforms. Currently the synchronous transfer in this test hangs on Windows platforms. This is due to the following sequence of events: * There are more than MAXIMUM_WAIT_OBJECTS event objects to wait for. * WaitForMultipleObject

[Libusbx-devel] [PATCH 08/11] Core: Cache the number of pollfds.

2013-06-27 Thread Toby Gray
Previously it was necessary to count the number of pollfds contained in a linked list. This change introduces the optimisation of storing a running total of the number of pollfds. --- libusb/io.c | 16 libusb/libusbi.h |1 + 2 files changed, 9 insertions(+), 8 deletions

[Libusbx-devel] [PATCH 03/11] Core: Add new cross-platform event handling API

2013-06-27 Thread Toby Gray
This change adds the API and some stub implementations of a new cross platform supporting event API. --- libusb/io.c | 78 - libusb/libusb-1.0.def |4 +++ libusb/libusb.h | 65 + libusb/

[Libusbx-devel] [PATCH 05/11] Windows: Change Windows poll code to use libusb_event_handle

2013-06-27 Thread Toby Gray
This updates the common poll code used by Windows and Windows CE to use the libusb_event_handle typedef instead of int for file descriptors. --- libusb/os/poll_windows.c |8 libusb/os/poll_windows.h | 10 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libu

[Libusbx-devel] [RFC] Remove fake fds from Windows backends

2013-06-27 Thread Toby Gray
I realise that 1.0.16 is currently trying to be released and that these patches won't get looked at until after that has happened. I'm away from the office for the next couple of weeks so thought it was worth sending this patch series for people to look at if they get time while I'm away. A while

[Libusbx-devel] [PATCH 04/11] Core: Change pollfds over to using libusb_event_handle instead of int

2013-06-27 Thread Toby Gray
This change makes the internals of libusb make use of the libusb_event_handle typedef instead of int when dealing with file descriptors. --- libusb/io.c | 123 +++--- libusb/libusb.h |5 ++- libusb/libusbi.h | 10 ++--- 3 files changed,

[Libusbx-devel] [PATCH 06/11] Windows: Get rid of fake FDs use inside Windows and Window CE backends

2013-06-27 Thread Toby Gray
This change removes the fake FDs and replaces them with event handles. --- libusb/os/poll_windows.c | 466 -- libusb/os/poll_windows.h | 10 +- libusb/os/wince_usb.c| 14 +- libusb/os/windows_usb.c | 53 -- 4 files changed, 118 insertions

[Libusbx-devel] [PATCH 11/11] Windows: Set limit of pollfds for Windows and Windows CE.

2013-06-27 Thread Toby Gray
Both the Windows and Windows CE backends use MultipleWaitForObjects in their usbi_poll implementations. This function has a limited number of objects it can wait on. This commit configures libusb to the correct limit for maximum pollfds. --- configure.ac |1 + msvc/config.h |3 +++ 2 fil

[Libusbx-devel] [PATCH 01/11] Tests: Adding ability for tests to use setjmp and longjmp for status reporting

2013-06-27 Thread Toby Gray
This improves the testlib used in libusbx to allow tests to either return the test status or to call a function which never returns. This leads to simpler test code as nested functions do not have to return test status up the calling chain. --- tests/libusbx_testlib.h | 54 +

[Libusbx-devel] [PATCH 09/11] Core: Allow backends to reserve pollfds.

2013-06-27 Thread Toby Gray
This adds in new internal APIs to allow backends to reserve the pollfds which will be added to the pollfds linked list. This also adds a new function for adding pre-reserved pollfds to the pollfds linked list. This function can never fail, unlike the standard usbi_add_pollfds(). --- libusb/io.c

Re: [Libusbx-devel] Announcing libusbx-1.0.16-rc3

2013-07-09 Thread Toby Gray
On 07/07/13 02:10, Xiaofan Chen wrote: > On Sat, Jul 6, 2013 at 3:15 PM, Hans de Goede wrote: >> I'm very happy to announce libusbx-1.0.16-rc3. > Just carried out some quick tests under Mac OS X, Windows 8 > x64 VM and OpenBSD 5.2 VM, all are okay. > > I've just carried out some tests on WinCE an

[Libusbx-devel] Improved log in non-console applications and Android

2013-07-09 Thread Toby Gray
gument */ #define POLL_NFDS_TYPE unsigned int -- 1.7.9.5 >From 706d8f31be885495e5ee9d9aba83b91ebd954a4c Mon Sep 17 00:00:00 2001 From: Toby Gray Date: Tue, 9 Jul 2013 16:30:55 +0100 Subject: [PATCH 2/5] Core: Adding support for syslog if --enable-system-log is passed to configure. This chan

Re: [Libusbx-devel] Releasing 1.0.16 ...

2013-07-11 Thread Toby Gray
On 11/07/13 14:07, Pete Batard wrote: > On 2013.07.11 10:55, Hans de Goede wrote: >> The 1.0.16 release has been done. If you can upload the docs that would >> be great! > Thanks for the release. Docs and Windows binaries are now up. > > I've now added the Windows CE binaries. Regards, Toby

Re: [Libusbx-devel] Releasing 1.0.16 ...

2013-07-12 Thread Toby Gray
On 11/07/13 23:15, Pete Batard wrote: > (but I'm still not too sure why -win became the default download and > not wince, which was uploaded later). The reason for this is probably because I've been uploading the wince binaries via SFTP. I've being doing it via SFTP because I don't get the sou

Re: [Libusbx-devel] [PATCH v2 2/2] Windows: Make ENABLE_DEBUG_LOGGING enable logging output to the debugger.

2013-07-23 Thread Toby Gray
On 22/07/13 21:44, Pete Batard wrote: Hi Toby, Do you have plans to look into adding a new config option for sending the debug output to the debugger, or do you want me to look into it? Yes I have. It was one of those bits of work that when I started looking at it I discovered several other t

Re: [Libusbx-devel] [PATCH v2 2/2] Windows: Make ENABLE_DEBUG_LOGGING enable logging output to the debugger.

2013-08-08 Thread Toby Gray
On 08/08/13 00:52, Pete Batard wrote: On 2013.07.23 11:33, Toby Gray wrote: Do you have plans to look into adding a new config option for sending the debug output to the debugger, or do you want me to look into it? Yes I have. It was one of those bits of work that when I started looking at it

[Libusbx-devel] Android build files and improved logging patches, (was "Improved log in non-console applications and Android")

2013-08-08 Thread Toby Gray
On 09/07/13 18:06, Toby Gray wrote: Hi, I've attached two patches which improve the logging in non-console applications and three patches which add Android support to libusbx. The first patch adds a configure option "--enable-system-log". This also enable output of libusbx

Re: [Libusbx-devel] Android build files and improved logging patches, (was "Improved log in non-console applications and Android")

2013-08-09 Thread Toby Gray
On 09/08/13 02:09, Pete Batard wrote: > On 2013.08.08 18:35, Toby Gray wrote: >> I've attached a rebase of patches 1 to 4 onto the master branch of libusbx. > Thanks. Much appreciated. > > I have now merged 1&2 and pushed it. Thanks for looking at those and mak

Re: [Libusbx-devel] Android build files and improved logging patches, (was "Improved log in non-console applications and Android")

2013-08-12 Thread Toby Gray
On 12/08/13 03:41, Xiaofan Chen wrote: On Fri, Aug 9, 2013 at 6:51 PM, Toby Gray wrote: If you are planning on testing on a device then you'll need to have root access to it or fiddle around with building custom ROMs to setup permissions on /dev/bus/usb/*/*. Also be aware that the An

Re: [Libusbx-devel] Android build files and improved logging patches, (was "Improved log in non-console applications and Android")

2013-08-19 Thread Toby Gray
On 12/08/13 13:20, Xiaofan Chen wrote: On Mon, Aug 12, 2013 at 8:08 PM, Toby Gray wrote: I assume it'd be helpful for others to have this information recorded somewhere. Would a wiki page or an update to the README be more appropriate? I think Android has become so popular t

Re: [Libusbx-devel] [libusbx] android support (#132)

2013-08-19 Thread Toby Gray
On 18/08/13 13:01, Anton Smirnov wrote: Android can return file descriptor for native code: http://developer.android.com/reference/android/hardware/usb/UsbDeviceConnection.html#getFileDescriptor()

Re: [Libusbx-devel] [libusbx] android support (#132)

2013-08-20 Thread Toby Gray
On 20/08/13 05:44, Anton Smirnov wrote: 2013/8/19 Toby Gray mailto:toby.g...@realvnc.com>> On 18/08/13 13:01, Anton Smirnov wrote: Android can return file descriptor for native code: http://developer.android.com/reference/android/hardware/usb/UsbDeviceConnectio

Re: [Libusbx-devel] RFC: Make usbi_get_device_by_session_id return a ref to the found device ?

2013-08-22 Thread Toby Gray
On 21/08/13 15:56, Hans de Goede wrote: > Hi All, > > While looking at various locking things in libusb I noticed that > usbi_get_device_by_session_id iterates over usb_devs while holding > the usb_devs_lock and then if it finds a device returns that device, > without taking a reference. This means

Re: [Libusbx-devel] Testing for a valid libusb_device_handle

2013-08-29 Thread Toby Gray
On 28/08/13 05:10, Cody Vaudrin wrote: > Hello all, I was wondering if there's a way to test a given > libusb_device_handle for validity? I have a situation where a device handle > could be corrupted, and when a corrupted (invalid) device handle is passed to > the libusb_reset_device() function,

Re: [Libusbx-devel] Announcing libusbx-1.0.17-rc1

2013-08-30 Thread Toby Gray
find. WinCE support looks good. Android support is broken though, the build files are missing from the dist tarball. I've attached a patch to fix that. Regards, Toby >From f908cddb196f741fcc7ed0a11c6796ef82fdd2d1 Mon Sep 17 00:00:00 2001 From: Toby Gray Date: Fri, 30 Aug 2013 13:28:32

Re: [Libusbx-devel] Announcing libusbx-1.0.17 final

2013-09-06 Thread Toby Gray
On 06/09/13 12:19, Pete Batard wrote: > On 2013.09.06 11:31, Hans de Goede wrote: >> I'm very happy to announce libusbx-1.0.17. > Good job! > > The Windows binaries have now been uploaded as well, and the freecode > announcement should follow today. > Windows CE binaries have now been uploaded too

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

2013-10-28 Thread Toby Gray
On 28/10/13 09:28, Rasmus Bisschop-Larsen wrote: > Yes I have read the Android README maybe 10 times but it is not very > clear about how to get this to work. As I wrote (..."I can get file > descriptors (fd) through both libusbx and the android library > UsbDeviceConnection.getFileDescriptor()

Re: [Libusbx-devel] ceusbwrapper driver

2013-11-28 Thread Toby Gray
On 27/11/13 17:22, Liang Zhu wrote: > > Hi, > > It looks like ceusbwrapper driver has conflict with my hid driver. > It shuts down the application that is communicating with my hid > driver. I would like to know if anyone has encountered anything like > that before. > How is your applicatio

  1   2   >