License handling using USB

Use case, update license on display without internet, probably out in the field somewhere. The goal is to make a license for the specific device by using inspector to read out the hardware ID. The lccinspector binary is installed in your target install folder something like License-manager/install-imx8/bin/projectName/lccinspector

  1. The software developer/license person prepares a USB stick with inspector binary which is built when you build the static library for target. See cc-auto.sh script for example (it assumes you put the lccinspector in a folder called License-manager-inspector on the USB stick).

  2. Insert USB stick in target display, cc-auto.sh executes inspector and saves hardware ID to text file on USB and plays a short tune if successful.

  3. The developer/license person creates wanted license using the secret key the software was created with. Use the hardware ID from the output from inspector to bound license to a specific display.

  4. Put the license key on the USB stick in as in example (script assumes the license files to be in the License-manager-add-license folder on the USB stick)

  5. Insert USB stick again in target display, the script will try to copy the license to /opt/cclicenses folder. It plays a short tune on success.

  6. Restart licensed application and it should read the new license from /opt/cclicenses

Generating license

See the issue license section but you would do something similar to this.
Using the key gen tool you would write something like

lccgen.exe license issue -p C:\share\license-manager-usb\projects\LicenseDemoApp
 -e 20230501 -f feature1,feature3 -s AKAa-UA6C-j78= -o LicenseDemoApp.lic

You should replace the hardware ID in the example AKAa-UA6C-j78= with the hardware ID found after DEFAULT: in the inspector_output.txt generated on the USB stick.

It is really up to the software developer to decide on the name of the license file. We suggest using /opt/cclicenses/ folder for reading the license.
Our demo applications tries to read the license file /opt/cclicenses/LicenseDemoApp.lic and look for the features it supports.

Contents on USB-stick

  • cc-auto.sh The scripts that automatically will run when inserted in target display

  • lccinspector software. Used to query the hardware id of the target display

  • Folder with new license-files to be copied to target

cc-auto.sh example

#!/bin/sh

# Script for reading back hw_id combined
# with the script to put a new license file on the display

USB_PATH=$1
INSPECTOR_DIR=${USB_PATH}/License-manager-inspector
LICENSE_DIR=${USB_PATH}/License-manager-add-license
COPY_LICENSE_TO="/opt/cclicenses"

# Do we have inspector?
if [ -d ${INSPECTOR_DIR} ]; then
  ${INSPECTOR_DIR}/lccinspector >  ${INSPECTOR_DIR}/inspector_output.txt
  if grep -qF 'DEFAULT' ${INSPECTOR_DIR}/inspector_output.txt; then
     ${USB_PATH}/buzz.sh
  fi
fi

# Do we have licenses to copy to target?
if [ -d ${LICENSE_DIR} ]; then
   # Copy licenses
   sudo mkdir -p ${COPY_LICENSE_TO}
   sudo cp ${LICENSE_DIR}/*.* ${COPY_LICENSE_TO}
   ${USB_PATH}/buzz.sh
fi

buzz.sh

Used to play sound that confirms that any of the task has been done (query for hw id or copying back new license files to target)

#!/bin/sh
##### Buzzer ####
ccsettingsconsole --buzzer --frequency=1046 --volume=20 --status=enable
sleep 0.3
ccsettingsconsole --buzzer --frequency=1046 --volume=20 --status=disable
sleep 0.05
ccsettingsconsole --buzzer --frequency=1046 --volume=20 --status=enable
sleep 0.25
ccsettingsconsole --buzzer --frequency=1568 --volume=20 --status=enable
sleep 1
ccsettingsconsole --buzzer --frequency=1397 --volume=20 --status=enable
sleep 0.15
ccsettingsconsole --buzzer --frequency=1318 --volume=20 --status=enable
sleep 0.15
ccsettingsconsole --buzzer --frequency=1175 --volume=20 --status=enable
sleep 0.15
ccsettingsconsole --buzzer --frequency=2093 --volume=20 --status=enable
sleep 0.5
ccsettingsconsole --buzzer --frequency=1568 --volume=20 --status=enable
sleep 1
ccsettingsconsole --buzzer --frequency=1568 --volume=20 --status=disable

Example inspector_output.txt

The hardware ID used is the one after DEFAULT:

DEFAULT:AKH8-hw7Y-lpc=
MAC:AAAA-JgUA-cKw=
IP:ACAK-gyA4-Kio=
Disk:AFwf-YgAY-DLY=
CC-CPU:AKH8-hw7Y-lpc=
Virtualiz. class :No virtualization
Virtualiz. detail:No virtualization
Cloud provider   :Provider unknown
Network adapter [0]: eth0
   ip address [56-32-131-10]
   mac address [0:26:5:0:70:ac]
Network adapter [0]: wlan0
   ip address [0-0-0-0]
   mac address [c0:ee:40:80:de:ac]
Cpu Vendor       :ARM
Cpu Brand        :Cortex-A35
Cpu hypervisor   :0
Cpu model        :0x0
Bios vendor      :
Bios description :
System vendor    :
Cpu Vendor (dmi) :
Cpu Cores  (dmi) :0
==================