Does PhidgetMBS.WriteDeviceLabel work for anyone?

I know there are limitations on this method, e.g. it doesn’t work for some devices under Windows, but in my case under Windows I can set a device label from Phidget Control Panel, but the Monkeybread method never works - nothing is written to the device.

Well, the plugin code is identical for all platforms. We pass through the text to the C function.

My question would be whether you set the label only in control panel vs. saving the label in the device.

After I write a string to device flash using the Control Panel, I can see that value in the PhidgetMBS.DeviceLabel property, even after removing power from the Phidget. So the control panel is definitely writing to flash.

PhidgetMBS.WriteDeviceLabel never seems to write to the device flash. The value I pass to WriteDeviceLabel is not found in the DeviceLabel property, either before or after power cycling.

@Christian_Schmitz can you please provide an example app demonstrating that this feature works? Thanks.

I can look into this. I’ll ask Stefanie to bring our Phidgets into the office next week.

For the time being, I saw this blog post from Phidgets: How To Give Your Phidgets A Custom Label
That article with the update there says it works for some devices on Windows, but not all.

Thanks. Understood that writing labels may not work on some older Phidgets, but mine are new models and writing from the control panel does work under Windows.

I just tried. First Phidget with this code:

me.writeDeviceLabel "MyTemp1"

just gives me “Operation not supported” exception on macOS and Windows for a temperature sensor.

Same for distance and light sensor. Strange.

Maybe safer to try on something known to be “new”, like the current VINT Hub, HUB0002_1.

From the phidgets docs:

PhidgetReturnCode​Phidget_writeDeviceLabel(

PhidgetHandle ch,

const char *deviceLabel

)

Writes a label to the device in the form of a string in the device flash memory. This label can then be used to identify the device, and will persist across power cycles.

The label can be at most 10 UTF-16 code units. Most unicode characters take up a single code unit, but some, such as emoji, can take several.

Some older devices can not have their labels set from Windows. For these devices the label should be set from Linux or macOS.

Note: You should be careful when writing labels in your code, because the label is stored in flash which can only be re-written around 10,000 times before it will no longer write. If your program is complex, be sure to test it thoroughly before using WriteLabel to avoid accidentally burning out the flash.

Parameters:

ch:The channel handle
deviceLabel:The device label

Return:
The Phidget return code

I got answer from Phidgets Inc:

Generally speaking only USB devices support device labels.

And I tried with my hub:

System.DebugLog CurrentMethodName

me.writeDeviceLabel "MyDevice"

MessageBox me.DeviceClassName+" "+me.DeviceName+" "+me.DeviceLabel

this works fine for the USB Hub device.

I can confirm it works for me with a VINT Hub. You might want to include in the documentation a note that it only works with USB devices, since WriteDeviceLabel is a method for the entire PhidgetMBS superclass, which is why I thought I could use it to write to other devices’s labels.

done. Thanks.