I am trying to connect to a USB digital scale. The code does connect to the scale as scale.IsConnected comes true, but it hangs on scale.Read(250) where 250 should be the timeout in milliseconds, but it never return from Read.
I am using the code from this thread except one change which was due to the new version of Mike O Brien’s HID Library:
public HidDevice[] GetDevices ()
{
HidDevice[] hidDeviceList;
// Metler Toledo
hidDeviceList = HidDevices.Enumerate(0x0eb8).ToArray();
if (hidDeviceList.Length > 0)
return hidDeviceList;
return hidDeviceList;
}
I managed to get the scale working, take a look at Mike’s answer here
I managed to get the scale working. In my callback, which runs when scale returns data, I was doing
Readwhich is a blocking call.So a deadlock was created, and I should have only used
ReadReportorRead. Take a look at Mike’s example below which he posted here.