====== USB utils ====== ===== Introduction ===== A USB key service is available on the Wanesy SPN gateway. It can be used to: * Manage end-devices fleet * Manage gateway fleet * Receive frames from end-devices * Send frames to end-devices * Configure the gateway * Update and add license * Debug / troubleshoot the gateway ===== Instruction ===== “XXXXXXXX” is the hardware serial number of the board (8 digits, upper case). See [[.:..:support:faq#How to find the hardware serial number of the board?|How to find the hardware serial number of the board?]] ==== Create the USB folder structure ==== To activate USB key features, a USB folder tree must be used. When all the features are available, the structure is: \\ {{.:..:images:usbut_tree.png?150|USB tree}} __Download USB_Structure.zip:__\\ {{media:script:USB_Structure.zip}} . ==== Add the password file ==== On USB key root directory, create a file “spn/password/XXXXXXXX_password” which must contain “spn” user password. \\ {{.:..:images:usbut_password.png?400|How to set USB password}} ==== Add the files ==== Depending on the feature that will be used, different files must be created/added in the folders. Refer to the [[https://wikikerlink.fr/wanesy-spn/doku.php?id=wiki:interfaces:usbut#help|USB features section]] to determine which file should be added in which folder. ==== Plug the USB key ==== Once the folders, the feature specific files and the password files are created, the USB key can be plugged. During the execution of the USB key the led behaviour of the gateway is the following: * The red power LED is blinking during USB commands processing * Once all commands are processed, the LED is kept switched on. The USB key can be removed * Once the USB key is unplugged, the LED is switched off ===== Help ===== Inline help is available in web user interface in ''Configuration => Interfaces => USB utils => Help'' An extract of this help is available below: ==== Common parameters ==== This service is used to access flows via a USB key and is always enabled. - On USB key root directory, create parent directory **/spn**. - Create a password file **/spn/password/XXXXXXXX_password** containing *spn* user password. - *XXXXXXXX:* gateway serial number in upper case. === LED behaviour === 1. No USB key plugged: red power LED is off. 2. USB key plugged, USB commands are being processed: red power LED is blinking at 10Hz. 3. Commands are processed: red power LED is on. 4. Unplug USB key, red power LED is off. ==== Flow syntax ==== === End-device fleet flow === **/spn/end_device** directory must be created and used for the end-device fleet commands. == Add end-device fleet == - Create a CSV file **XXXXXXXX_end_device_fleet.csv**. - **XXXXXXXX_end_device_fleet.csv**: syntax is described through **DOWNLOAD** button. - Command triggered with a file **add_fleet**. - A file **XXXXXXXX_add_fleet_processed_yy** is created once command processed. - *XXXXXXXX:* gateway serial number in upper case. - *yy:* command status *ok* or *ko*. > Command **add_fleet** is processed if **XXXXXXXX_add_fleet_processed_yy** does not exist and each time the command file is edited. > **XXXXXXXX_end_device_fleet.csv** will be erased once command processed. == Get end-device fleet == - Command triggered with a file **get_fleet**. - A CSV file **XXXXXXXX_end_device_fleet.csv** is created once command processed. - A file **XXXXXXXX_get_fleet_processed_yy** is created once command processed. - *XXXXXXXX:* gateway serial number in upper case. - *yy:* command status *ok* or *ko*. > Command **get_fleet** is processed if **XXXXXXXX_get_fleet_processed_yy** does not exist and each time the command file is edited. == Delete end-device fleet == - Command triggered with a file **delete_fleet**. - A file **XXXXXXXX_delete_fleet_processed_yy** is created once command processed. - *XXXXXXXX:* gateway serial number in upper case. - *yy:* command status *ok* or *ko*. > Command **delete_fleet** is processed if **XXXXXXXX_delete_fleet_processed_yy** does not exist and each time the command file is edited. === Gateway fleet flow === **/spn/gateway** directory must be created and used for the gateway fleet commands. == Add gateway fleet == - Create a CSV file **XXXXXXXX_gateway_fleet.csv**. - **XXXXXXXX_gateway_fleet.csv**: syntax is described through **DOWNLOAD** button. - Command triggered with a file **add_fleet**. - A file **XXXXXXXX_add_fleet_processed_yy** is created once command processed. - *XXXXXXXX:* gateway serial number in upper case. - *yy:* command status *ok* or *ko*. > Command **add_fleet** is processed if **XXXXXXXX_add_fleet_processed_yy** does not exist and each time the command file is edited. == Get gateway fleet == - Command triggered with a file **get_fleet**. - A CSV file **XXXXXXXX_gateway_fleet.csv** is created once command processed. - A file **XXXXXXXX_get_fleet_processed_yy** is created once command processed. - *XXXXXXXX:* gateway serial number in upper case. - *yy:* command status *ok* or *ko*. > Command **get_fleet** is processed if **XXXXXXXX_get_fleet_processed_yy** does not exist and each time the command file is edited. > **XXXXXXXX_gateway_fleet.csv** will be erased once command processed. == Delete gateway fleet == - Command triggered with a file **delete_fleet**. - A file **XXXXXXXX_delete_fleet_processed_yy** is created once command processed. - *XXXXXXXX:* gateway serial number in upper case. - *yy:* command status *ok* or *ko*. > Command **delete_fleet** is processed if **XXXXXXXX_delete_fleet_processed_yy** does not exist and each time the command file is edited. === Rx data flow === **/spn/rx_data** directory must be created and used for the Rx data commands. == Get Rx data == - Command triggered with a file **get_rx_data**. - One or several files **XXXXXXXX_rx_data_YYYYMMDDhhmmss.csv** are retrieved once command processed. - A file **XXXXXXXX_get_rx_data_processed_yy** is created once command processed. - *XXXXXXXX:* gateway serial number in upper case. - *yy:* command status *ok* or *ko*. - *YYYYMMDDhhmmss:* UTC date and time of file creation. - *YYYY:* system year (zero padded, in *[0000;9999]*). - *MM:* system month (zero padded, in *[01;12]*). - *DD:* system day (zero padded, in *[01;31]*). - *hh:* system hour (zero padded, in *[00;23]*). - *mm:* system minute (zero padded, in *[00;59]*). - *ss:* system second (zero padded, in *[00;59]*). > Command **get_rx_data** is processed if **XXXXXXXX_get_rx_data_processed_yy** does not exist and each time the command file is edited. === Tx data flow === **/spn/tx_data** directory must be created and used for the Tx data commands. == Add Tx data == - Create a CSV file **XXXXXXXX_tx_data.csv**. - **XXXXXXXX_tx_data.csv**: syntax is described through **DOWNLOAD** button. - Command triggered with a file **add_tx_data**. - A file **XXXXXXXX_add_tx_data_processed_yy** is created once command processed. - *XXXXXXXX:* gateway serial number in upper case. - *yy:* command status *ok* or *ko*. > Command **add_tx_data** is processed if **XXXXXXXX_add_tx_data_processed_yy** does not exist and each time the command file is edited. == Get Tx data == - Command triggered with a file **get_tx_data**. - A CSV file **XXXXXXXX_tx_data_YYYYMMDDhhmmss.csv** is created once command processed. - A file **XXXXXXXX_get_tx_data_processed_yy** is created once command processed. - *XXXXXXXX:* gateway serial number in upper case. - *yy:* command status *ok* or *ko*. - *YYYYMMDDhhmmss:* UTC date and time of file creation. - *YYYY:* system year (zero padded, in *[0000;9999]*). - *MM:* system month (zero padded, in *[01;12]*). - *DD:* system day (zero padded, in *[01;31]*). - *hh:* system hour (zero padded, in *[00;23]*). - *mm:* system minute (zero padded, in *[00;59]*). - *ss:* system second (zero padded, in *[00;59]*). > Command **get_tx_data** is processed if **XXXXXXXX_get_tx_data_processed_yy** does not exist and each time the command file is edited. === Configuration flow === **/spn/configuration** directory must be created and used for the configuration commands. == Set configuration == - Create a JSON file **XXXXXXXX_data.json**. - **XXXXXXXX_data.json**: syntax is described through **gggOWNLOAD** button. - Command triggered with a file **set_configuration**. - A file **XXXXXXXX_set_configuration_processed_yy** is created once command processed. - *XXXXXXXX:* gateway serial number in upper case. - *yy:* command status *ok* or *ko*. > Command **set_configuration** is processed if **XXXXXXXX_set_configuration_processed_yy** does not exist and each time the command file is edited. == Get configuration == - Command triggered with a file **get_configuration**. - A JSON file **XXXXXXXX_data.json** is created once command processed. - A file **XXXXXXXX_get_configuration_processed_yy** is created once command processed. - *XXXXXXXX:* gateway serial number in upper case. - *yy:* command status *ok* or *ko*. > Command **get_configuration** is processed if **XXXXXXXX_get_configuration_processed_yy** does not exist and each time the command file is edited. > **XXXXXXXX_data.json** will be erased once command processed. == Reset configuration == - Command triggered with a file **reset_configuration**. - A file **XXXXXXXX_reset_configuration_processed_yy** is created once command processed. - *XXXXXXXX:* gateway serial number in upper case. - *yy:* command status *ok* or *ko*. > Command **reset_configuration** is processed if **XXXXXXXX_reset_configuration_processed_yy** does not exist and each time the command file is edited. === Update flow === **/spn/update** directory must be created and used for the update commands. == Update == - Copy an ***.ipk** file. - Command triggered with a file **update**. - A file **XXXXXXXX_update_processed_yy** is created once command processed. - *XXXXXXXX:* gateway serial number in upper case. - *yy:* command status *ok* or *ko*. > Command **update** is processed if **XXXXXXXX_update_processed_yy** does not exist and each time the command file is edited. == Add license == - Copy a license file **XXXXXXXX_license.txt**. - Command triggered with a file **add_license**. - A file **XXXXXXXX_add_license_processed_yy** is created once command processed. - *XXXXXXXX:* gateway serial number in upper case. - *yy:* command status *ok* or *ko*. > Command **add_license** is processed if **XXXXXXXX_add_license_processed_yy** does not exist and each time the command file is edited. == Restore == - Command triggered with a file **restore**. - A file **XXXXXXXX_restore_processed_yy** is created once command processed. - *XXXXXXXX:* gateway serial number in upper case. - *yy:* command status *ok* or *ko*. > Command **restore** is processed if **XXXXXXXX_restore_processed_yy** does not exist and each time the command file is edited. == Reboot == - Command triggered with a file **reboot**. - A file **XXXXXXXX_reboot_processed_yy** is created once command processed. - *XXXXXXXX:* gateway serial number in upper case. - *yy:* command status *ok* or *ko*. > Command **reboot** is processed if **XXXXXXXX_reboot_processed_yy** does not exist and each time the command file is edited. == Halt == - Command triggered with a file **halt**. - A file **XXXXXXXX_halt_processed_yy** is created once command processed. - *XXXXXXXX:* gateway serial number in upper case. - *yy:* command status *ok* or *ko*. > Command **halt** is processed if **XXXXXXXX_halt_processed_yy** does not exist and each time the command file is edited. === Status flow === **/spn/status** directory must be created and used for the status commands. == Get status == - Command triggered with a file **get_status**. - A CSV file **XXXXXXXX_status_YYYYMMDDhhmmss.csv** is created once command processed. - A file **XXXXXXXX_get_status_processed_yy** is created once command processed. - *XXXXXXXX:* gateway serial number in upper case. - *yy:* command status *ok* or *ko*. - *YYYYMMDDhhmmss:* UTC date and time of file creation. - *YYYY:* system year (zero padded, in *[0000;9999]*). - *MM:* system month (zero padded, in *[01;12]*). - *DD:* system day (zero padded, in *[01;31]*). - *hh:* system hour (zero padded, in *[00;23]*). - *mm:* system minute (zero padded, in *[00;59]*). - *ss:* system second (zero padded, in *[00;59]*). > Command **get_status** is processed if **XXXXXXXX_get_status_processed_yy** does not exist and each time the command file is edited. > **XXXXXXXX_status.csv** will be erased once command processed. === Log flow === **/spn/log** directory must be created and used for the log commands. ==Get log== - Command triggered with a file **get_log**. - A directory XXXXXXXX_logs containing logs *public*, *internal*, *cpf* and *loramacserver* is created once command processed. - A file **XXXXXXXX_get_log_processed_yy** is created once command processed. - *XXXXXXXX:* gateway serial number in upper case. - *yy:* command status *ok* or *ko*. > Command **get_log** is processed if **XXXXXXXX_get_log_processed_yy** does not exist and each time the command file is edited.