These are dangerous as you will import not only the functions defined in the other module but also all of it's imports! This makes automated cleanups brittle.
33 lines
993 B
Python
Executable file
33 lines
993 B
Python
Executable file
#!/usr/bin/env python3
|
|
|
|
import os
|
|
|
|
from binascii import unhexlify
|
|
from enum import Enum
|
|
from validitysensor.flash import read_flash
|
|
from validitysensor.sensor import glow_start_scan, glow_end_scan
|
|
from validitysensor.util import assert_status
|
|
from validitysensor.tls import tls
|
|
from validitysensor import init
|
|
from time import sleep
|
|
from usb import core as usb_core
|
|
|
|
if __name__ == "__main__":
|
|
if os.geteuid() != 0:
|
|
raise Exception('This script needs to be executed as root')
|
|
|
|
init.open()
|
|
|
|
for i in range(0, 10):
|
|
glow_start_scan()
|
|
sleep(0.05)
|
|
glow_end_scan()
|
|
sleep(0.05)
|
|
|
|
led_script = unhexlify(
|
|
'39ff100000ff03000001ff002000000000ffff0000ffff0000ff03000001ff00' \
|
|
'200000000000000000ffff0000ff03000001ff002000000000ffff0000000000' \
|
|
'0000000000000000000000000000000000000000000000000000000000000000' \
|
|
'0000000000000000000000000000000000000000000000000000000000')
|
|
|
|
assert_status(tls.app(led_script))
|