Success! (sorta) using USB HOST & Data INPUT using RawDevice (may also relate to USB HOST Pipe Issue)

I recently acquired an off the shelf Weather Station that is capable to connecting to a PC via a USB Cable.
Being my first foray into USB, I’ve had to go back & learn the protocols, combined with using a logic/protocol Analyzer to reconstruct what was happening on the USB lines.

Using the /codeshare/entry/115 & updating it to work with 4.3, I was able to query the endpoint, and get the relevant attributes. The problem arose when I tried to get the actual data dump from the Weather Station, even using the EXACT SAME protocol string that their Software on the PC was using.

I get the message "An unhandled exception of type 'System.Exception' occurred in GHI.Usb.dll"  

When called from this 

```cs]public void SendSetupPacket(byte requestType, byte request, ushort value, ushort index, byte[
 data, int dataOffset, int dataCount)
            this.NativeSendSetupPacket(requestType, request, value, index, data, dataOffset, dataCount);

So, using the protocol analyzer, I deconstructed where the error actually occurs, and found it happens if you make the buffer larger than the data coming back, it throws the exception. (Which is exactly what their software was doing, setting the buffer larger!!).

My problem is, If I don’t know how long the string is, on a custom “Unknown” device, sort of like you may not know the size of a picture on a camera, (and I noticed he set the buffer to maximum packet size), they may be related, as when I tried to create a pipe, and get the data, it froze the exact same way on this line:

In the short term,, because I have a fairly narrow range of possible returns,, I'm just encasing it all in a Try / Catch routine,, and will need to work out a way to verify I'm getting all the data available,, (for example, when it downloads historic data,, there may be 5 records,, or 50).. 

I was just wondering if I was missing something...



@ michaelb - We can’t immediately find any known issues like this, but we will add it to our tracker to take a look at.

@ michaelb - that’s interesting. Which Weather Station are you using?

@ John - In the interest of trying to help, as I can’t debug the native code, would either screenshots or a data dump of the the protocol analyzer be helpful of both the communication string from the PC & the communication from my code? The protocol analyzer is a Saleae 8 channel, and can open up saved data files, that are only a couple of kb when compressed.


@ RoSchmi - The Weather Station is an AcuRite 02064-RX 5 channel wireless Weather Station, with an indoor additional Barometer. I went with this one, because out of the box, it is pre-assembled, just install batteries, all for about $100. I also picked up an Excelvan version, but unless the AcuRite proves to be inaccurate on its Humidity / Temp readings, (and it even includes a solar cell for daytime aspiration of the temp/humidity) I’m not even going to try to talk to it, as after opening up the box, well, I’m to ADD to even try assembling it, as it looks more like a Lego kit, than a Weather Station.

@ michaelb - thank you. Unfortunately at the the moment nothing left in my budget for this. Just bought a couple of Froggit (in the US Ambient) Radio remote Thermometers F007TH. There is a hack to receive the RF signals with an Arduino from where I read the values into a Cobra III to send them to Azure.

@ michaelb - If you can, send the data dump to support at ghi… referencing this thread. If you can also give us a complete but minimal program that shows the issue that may help us.