Click or drag to resize

PropertyID.UsbHostWhitelisting Field

Contains the editable list of whitelisted USB devices.

Namespace: Com.Datalogic.Device.Configuration
Assembly: datalogic-xamarin-sdk (in datalogic-xamarin-sdk.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
VB
public const Int32 UsbHostWhitelisting = "value"

Field Value

Type: Int32
Remarks
Contains the editable list of whitelisted USB devices. This list can be edited adding or removing elements through SDK or DLSettings. This list survives only a reboot.

The class of the property is BlobProperty. The specific implementation for this type of blob is UsbHostWhitelisting.
To set this property by intent (Intents.ACTION_CONFIGURATION_COMMIT) use the serialized form:

 [["vid","pid","name","description","persistence"],["vid","pid","name","description","persistence"]]
 
  • vid: device vid, in hexadecimal form. Admitted values in range (0000 - FFFF);
  • pid: device pid, in hexadecimal form. Admitted values in range (0000 - FFFF);
  • name: device name;
  • description: device description;
  • persistence: persistence. Only WhitelistingPersistence.REBOOT is allowed.

Using commit intent by android app, character " must be escaped as \".

To whiteslist two devices, for example 'mouse' and 'keyboard':
 Intent intent = new Intent(Intents.ACTION_CONFIGURATION_COMMIT);
 HashMap map = new HashMap();
 map.put(PropertyID.USB_HOST_WHITELISTING, "[[\"04fb\",\"96a2\",\"mouse\",\"usb\",\"REBOOT\"],[\"05fb\",\"26a2\",\"keyboard\",\"usb\",\"REBOOT\"]]");
 intent.putExtra(Intents.EXTRA_CONFIGURATION_CHANGED_MAP, map);
 mContext.sendBroadcast(intent);
 
To delete all devices:
 Intent intent = new Intent(Intents.ACTION_CONFIGURATION_COMMIT);
 HashMap map = new HashMap();
 map.put(PropertyID.USB_HOST_WHITELISTING, "[]");
 intent.putExtra(Intents.EXTRA_CONFIGURATION_CHANGED_MAP, map);
 mContext.sendBroadcast(intent);
 


Using the commit intent by shell, characters , " and space must be escaped as "\," \" and " " respectively.

To whitelist two devices, for example 'mouse' and 'keyboard', with the commit intent:
 adb shell am broadcast 
 -a com.datalogic.device.intent.action.configuration.COMMIT 
 --es com.datalogic.device.intent.extra.configuration.CHANGED_MAP 'USB_HOST_WHITELISTING=[[\"04fb\""\,"\"96a2\""\,"\"mouse\""\,"\"usb" "mouse\""\,"\"REBOOT\"]"\,"[\"06b2\""\,"\"f9a2\""\,"\"keyboard\""\,"\"usb" "keyboard\""\,"\"REBOOT\"]]'
 
To delete all devices:
 adb shell am broadcast 
 -a com.datalogic.device.intent.action.configuration.COMMIT 
 --es com.datalogic.device.intent.extra.configuration.CHANGED_MAP 'USB_HOST_WHITELISTING=[]'
 

[Android Documentation]

See Also