Phidget22admin Guide: Difference between revisions
(Created page with "{{#seo: |description=A guide to the phidget22admin command line tool. }} Category:IntroGuide __TOC__ ==What is phidget22admin?== '''phidget22admin''' is a powerful command-line tool provided by Phidgets Inc. With this tool, you can do the following: * List local and remote Phidgets * List Phidget servers * Upgrade firmware * and more! This tool is particularly useful if you managing a large number of Phidgets, or if you are using Linux where the [https://www.phidget...") |
No edit summary |
||
Line 15: | Line 15: | ||
==Installing phidget22admin== | ==Installing phidget22admin== | ||
===Windows=== | ===Windows=== | ||
[[Image:Phidget22admin_location_windows.png|link=https:// | [[Image:Phidget22admin_location_windows.png|link=https://cdn.phidgets.com/docs/images/7/78/Phidget22admin_location_windows.png|thumb|<center>phidget22admin.exe location on a Windows machine.</center>]] | ||
After running the [https://www.phidgets.com/docs/OS_-_Windows#Install Phidgets installer], you can find phidget22admin at the following location: | After running the [https://www.phidgets.com/docs/OS_-_Windows#Install Phidgets installer], you can find phidget22admin at the following location: | ||
* C:\Program Files\Phidgets\Phidget22\phidget22admin.exe | * C:\Program Files\Phidgets\Phidget22\phidget22admin.exe | ||
Line 93: | Line 93: | ||
[[Image:Phidget22admin_example_hublistlocal.png|center|link=https:// | [[Image:Phidget22admin_example_hublistlocal.png|center|link=https://cdn.phidgets.com/docs/images/1/1f/Phidget22admin_example_hublistlocal.png]] | ||
<br><br> | <br><br> | ||
Line 121: | Line 121: | ||
===Locating Firmware Files=== | ===Locating Firmware Files=== | ||
On Linux/macOS, firmware files are located by the tool automatically. On Windows, The latest firmware for your device can be found in the [https:// | On Linux/macOS, firmware files are located by the tool automatically. On Windows, The latest firmware for your device can be found in the [https://cdn.phidgets.com/downloads/phidget22/tools/linux/phidget22admin.tar.gz phidget22admin download] under the ''firmware'' folder. After downloading and unpacking the file, you can use the '''-F [path]''' option to specify where the firmware files are located. | ||
===Example: List Devices Eligible For Upgrade=== | ===Example: List Devices Eligible For Upgrade=== | ||
Line 130: | Line 130: | ||
In the example below, we can see that a Light Phidget (LUX1000) can be upgraded to firmware version 101 from its current version of 100. | In the example below, we can see that a Light Phidget (LUX1000) can be upgraded to firmware version 101 from its current version of 100. | ||
[[Image:Phidget22admin_example_firmwarelist.png|center|link=https:// | [[Image:Phidget22admin_example_firmwarelist.png|center|link=https://cdn.phidgets.com/docs/images/8/8d/Phidget22admin_example_firmwarelist.png]] | ||
<br><br> | <br><br> | ||
Line 145: | Line 145: | ||
[[Image:Phidget22admin_example_firmwareupgrade.png|link=https:// | [[Image:Phidget22admin_example_firmwareupgrade.png|link=https://cdn.phidgets.com/docs/images/f/f0/Phidget22admin_example_firmwareupgrade.png|center]] | ||
<br><br> | <br><br> | ||
Latest revision as of 16:36, 20 August 2024
What is phidget22admin?
phidget22admin is a powerful command-line tool provided by Phidgets Inc. With this tool, you can do the following:
- List local and remote Phidgets
- List Phidget servers
- Upgrade firmware
- and more!
This tool is particularly useful if you managing a large number of Phidgets, or if you are using Linux where the Phidget Control Panel is not supported.
Installing phidget22admin
Windows
After running the Phidgets installer, you can find phidget22admin at the following location:
- C:\Program Files\Phidgets\Phidget22\phidget22admin.exe
macOS
phidget22admin is not included by default with the Phidgets macOS installer. Download the source file here and compile it using the following command:
./configure && make
Linux
The phidget22admin tool can be added through our Linux package repository. For more information, visit our Linux page. Alternatively, you can obtain the tool by downloading the source and building it with the following command:
./configure && make
Using phidget22admin
Basic Usage
The phidget22admin tool is used by calling phidget22admin with options:
phidget22admin [options]
Option | Description |
---|---|
-A | set password for server (requries -H) |
-F path | set path of firmware upgrade files |
-H srvname | filter by server name |
-L | include only local devices |
-M sn[/hp/ch] | filter by serial number / hub port / channel |
-R | include only remote devices |
-U | perform a firmware upgrade (requires -M) |
-V version | specify firmware version for upgrade (default newest) |
-m | allow major firmware upgrades (default allow only minor) |
-a | also list devices that don't need upgrades (requires -u) |
-c | list open channels on server (requires -H) |
-d | list Phidgets |
-k key[=val] | print [set] key on control dictionary (requires -H) |
-l | enable phidget22 logging |
-o | list open connections on server (requires -H) |
-q | quiet (compact output when using -du) |
-s | list servers |
-u | firmware upgrade mode |
-v | verbose output (requires -s) |
-w seconds | time to wait for devices, servers (default is 3 sec) |
Example: Listing local devices
To list local devices and channels, enter the following command:
phidget22admin -dL
Below is an example of the output on a machine with a 1-Port VINT Hub Phidget connected.
Example: Filtering the list of devices
When listing channels or connections on systems with many attached Phidgets, it's helpful to use filtering to narrow down the output. Here are some examples of filtering:
phidget22admin -dLM //0
- Only list local channels with index 0
phidget22admin -dLM 123456
- Only list local channels with a serial number of 123456
phidget22admin -oH localhost
- Only list connections on hostname 'localhost'
More Information
For more infomation, please review the README file that can be found in the source folder.
Firmware Upgrade
The phidget22admin tool can be used to upgrade firmware on local and remote Phidgets.
Locating Firmware Files
On Linux/macOS, firmware files are located by the tool automatically. On Windows, The latest firmware for your device can be found in the phidget22admin download under the firmware folder. After downloading and unpacking the file, you can use the -F [path] option to specify where the firmware files are located.
Example: List Devices Eligible For Upgrade
phidget22admin -dLuF path/to/firmware
In the example below, we can see that a Light Phidget (LUX1000) can be upgraded to firmware version 101 from its current version of 100.
Example: Firmware Upgrading Device
You can upgrade a device's firmware using the -U option. In order to do this, you must also use the -M option to specify the devices to be upgraded:
- Serial Number
- Hub Port (VINT devices only)
phidget22admin -UM SerialNumber/HubPort -F path/to/firmware
In the example below, we can see that a Light Phidget (LUX1000) has been upgraded to firmware version 101.
Example: Using Scripts to Firmware Upgrade
With phidget22admin, you can easily automate the firmware upgrade process. View the examples below for more information:
@echo off
setlocal enabledelayedexpansion
set firmware_path="C:\Users\User\Downloads\phidget22admin-1.19.20240411\phidget22admin-1.19.20240411\firmware"
set admin_path=C:\"Program Files"\Phidgets\Phidget22\phidget22admin.exe
set command=%admin_path% -ludqF %firmware_path%
for /f "tokens=*" %%i in ('%command%') do (
set output=%%i
set index=0
for %%i in (!output!) do (
set "array[!index!]=%%i"
set /a index+=1
)
set is_remote_device=!array[0]!
set is_vint_device=!array[1]!
set serial_number=!array[2]!
set hub_port=!array[3]!
set sku=!array[4]!
set installed_firmware=!array[5]!
set available_firmware=!array[6]!
set /a installed_compare=!installed_firmware! / 100
set /a available_compare=!available_firmware! / 100
if !installed_compare! neq !available_compare! (
echo A major firmware upgrade is required for !sku! ^(Serial No: !serial_number!^). Please review before upgrading.
pause
) else (
if !is_vint_device! == 1 (
echo Attempting to firmware upgrade !sku! ^(VINT Hub Serial No: !serial_number!^)...
set upgrade_command=%admin_path% -UM !serial_number!/!hub_port! -F %firmware_path%
) else (
echo Attempting to firmware upgrade !sku! ^(Serial No: !serial_number!^)...
set upgrade_command=%admin_path% -UM !serial_number! -F %firmware_path%
)
call !upgrade_command!
)
)
pause
import subprocess, sys
firmware_path = "C:/Users/User/Downloads/phidget22admin-1.19.20240411/phidget22admin-1.19.20240411/firmware"
admin_path = "C:/PROGRA~1/Phidgets/Phidget22/phidget22admin.exe"
command = f"{admin_path} -ludqF {firmware_path}"
return_values, err = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True, text=True).communicate()
if return_values.strip() == "":
print("No devices are eligible for a firmware upgrade.")
else:
upgradeable_devices = return_values.split("\n")
for device in upgradeable_devices:
if(device.strip() == ""):
continue
device_info = device.split(",")
is_remote_device = int(device_info[0])
is_vint_device = int(device_info[1])
serial_number = device_info[2]
hub_port = device_info[3]
sku = device_info[4]
installed_firmware = device_info[5]
available_firmware = device_info[6]
if (int(installed_firmware[0]) - int(str(available_firmware)[0])):
sys.exit("A major firmware upgrade is required!")
upgrade_command = ""
if(is_vint_device):
print(f"Attempting to firmware upgrade {sku} (VINT Hub Serial No: {serial_number})...")
upgrade_command = f"{admin_path} -UM {serial_number}/{hub_port} -F {firmware_path}"
else:
print(f"Attempting to firmware upgrade {sku} (Serial No: {serial_number})...")
upgrade_command = f"{admin_path} -UM {serial_number} -F {firmware_path}"
subprocess.run(upgrade_command)
print("Complete")
Advanced
Minor vs Major Upgrades
By default, the phidget22admin tool will only perform minor firmware upgrades. To perform major upgrades, you must add the -m option to your command.
phidget22admin -UmM SerialNumber/HubPort/Channel -F path/to/firmware
Downgrading Firmware
Downgrading firmware is not typically recommended. If a firmware downgrade is required, use the -V [version] option to specify your preferred version.
phidget22admin -UM SerialNumber/HubPort/Channel -F path/to/firmware -V 100