GEMakers / gea-sdk

The GE Appliances Software Development Kit
GNU General Public License v2.0
51 stars 10 forks source link

No clear way to disambiguate data from multiple Green Beans (and their associated appliances) attached to the same host via USB #5

Closed rudybrian closed 9 years ago

rudybrian commented 9 years ago

Hi folks,

I originally posed this question on the 1B forums, but @MylesCaley recommended that I open an issue here as well.

I recently started doing some testing with my laundry pair and discovered an oddity with how the gea-sdk handles more than one Green Bean (and it's associated appliance) attached to my development machine. For example, if I call appliance.modelNumber.read() it will fire once for each connected appliance. This also seems to happen for the subscribe() function. Since there is no clear source to what GB/appliance is responding to the read() and subscribe() functions it can lead to confusion in handling the results.

Per @MylesCaley's suggestion, I tried defining different addresses for two sample applications (0xE5 for the dryer and 0xE4 for the washing machine), but this seems to have no bearing on the behavior. The first script to run appears to claim all the USB-attached Green Beans, resulting in a USB read error when the next script is started. I have posted full details of the scripts and the output to Gist here.

rudybrian commented 9 years ago

No comments in over a month, eh?

I looked at this a bit more, and it appears to be unrelated to the gea-sdk itself and is more how green-bean instantiates adapters via gea-adapter-usb. On instantiation, gea-adapter-usb fires a callback for each node-hid device with VENDOR_ID = 1240 and PRODUCT_ID = 64752 (all green beans attached to the host via USB). green-bean doesn't handle this well as it assumes it will only fire app.bind() once. If there is more than one device attached, it will fire as many times as there are devices and bind all adapters to itself. This explains both the duplicate results with two adapters attached, and why a second app instance fails to claim any adapters.

I am closing this issue on gea-sdk and will open a new one on green-bean.