Update use device on/off
This commit is contained in:
@@ -22,23 +22,39 @@ if bashio::config.has_value 'usbdevices'; then
|
||||
device=$(echo $usbdevice | jq '.device | tostring')
|
||||
deviceid=$(echo $device | sed 's/.*(\(.*\)).*/\1/g')
|
||||
|
||||
server_serial=$(/usr/bin/vh_server_serial_number ${deviceid%.*})
|
||||
device2=$(/usr/bin/vh_usb_product_vendor $deviceid)
|
||||
deviceid2="${server_serial}.${device2}"
|
||||
bashio::log.info "GURKA-${inuse_devices}"
|
||||
#server_serial=$(/usr/bin/vh_server_serial_number ${deviceid%.*})
|
||||
#device2=$(/usr/bin/vh_usb_product_vendor $deviceid)
|
||||
#deviceid2="${server_serial}.${device2}"
|
||||
#bashio::log.info "GURKA-${inuse_devices}"
|
||||
|
||||
if $use; then
|
||||
#bashio::log.info "AUTO USE DEVICE,${deviceid}"
|
||||
#/usr/bin/vhclient -t "AUTO USE DEVICE,${deviceid}"
|
||||
bashio::log.info "AutoShare ${deviceid2} on"
|
||||
/usr/bin/vh_editini AutoShare $deviceid2 1
|
||||
else
|
||||
if [[ "${inuse_devices[@]}" =~ "$device" ]]; then
|
||||
if [[ "${inuse_devices[@]}" =~ "$device" ]]; then
|
||||
if $use; then
|
||||
bashio::log.info "AUTO USE DEVICE,${deviceid} - already in use"
|
||||
else
|
||||
bashio::log.info "STOP USING,${deviceid}"
|
||||
/usr/bin/vhclient -t "STOP USING,${deviceid}"
|
||||
#bashio::log.info "AutoShare ${deviceid2} off"
|
||||
#/usr/bin/vh_editini AutoShare $deviceid2 0
|
||||
fi
|
||||
else
|
||||
if $use; then
|
||||
bashio::log.info "AUTO USE DEVICE,${deviceid}"
|
||||
/usr/bin/vhclient -t "AUTO USE DEVICE,${deviceid}"
|
||||
else
|
||||
bashio::log.info "STOP USING,${deviceid} - not in use"
|
||||
fi
|
||||
fi
|
||||
|
||||
#if $use; then
|
||||
#bashio::log.info "AUTO USE DEVICE,${deviceid}"
|
||||
#/usr/bin/vhclient -t "AUTO USE DEVICE,${deviceid}"
|
||||
#bashio::log.info "AutoShare ${deviceid2} on"
|
||||
#/usr/bin/vh_editini AutoShare $deviceid2 1
|
||||
#else
|
||||
#if [[ "${inuse_devices[@]}" =~ "$device" ]]; then
|
||||
#bashio::log.info "STOP USING,${deviceid}"
|
||||
#/usr/bin/vhclient -t "STOP USING,${deviceid}"
|
||||
#bashio::log.info "AutoShare ${deviceid2} off"
|
||||
#/usr/bin/vh_editini AutoShare $deviceid2 0
|
||||
#fi
|
||||
#fi
|
||||
done
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user