User Tools

Site Tools


tecnologia:lector_usb

This is an old revision of the document!


Para reiniciar USB y que vuelva a leer.

Buscamos cual es el product y vendor del USB:

lsusb
Bus 001 Device 005: ID 0665:5161 Cypress Semiconductor USB to Serial
Bus 001 Device 004: ID 0665:5161 Cypress Semiconductor USB to Serial
Bus 001 Device 006: ID 0424:7800 Standard Microsystems Corp. 
Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Es Cypress Semiconductor:

Product: 5161
Vendor: 0665

Buscamos a que usb corresponde:

ls -l /sys/bus/usb/devices/

Son enlaces simbólicos:

lrwxrwxrwx 1 root root 0 Feb 14  2019 1-0:1.0 -> ../../../devices/platform/soc/3f980000.usb/usb1/1-0:1.0
lrwxrwxrwx 1 root root 0 Feb 14  2019 1-1 -> ../../../devices/platform/soc/3f980000.usb/usb1/1-1
lrwxrwxrwx 1 root root 0 Nov 29 21:57 1-1.1 -> ../../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1
lrwxrwxrwx 1 root root 0 Feb 14  2019 1-1:1.0 -> ../../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1:1.0
lrwxrwxrwx 1 root root 0 Nov 29 21:57 1-1.1.1 -> ../../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.1
lrwxrwxrwx 1 root root 0 Nov 29 21:57 1-1.1:1.0 -> ../../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1:1.0
lrwxrwxrwx 1 root root 0 Nov 29 21:57 1-1.1.1:1.0 -> ../../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.1/1-1.1.1:1.0
lrwxrwxrwx 1 root root 0 Nov 29 21:57 1-1.2 -> ../../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2
lrwxrwxrwx 1 root root 0 Nov 29 21:57 1-1.2:1.0 -> ../../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.0
lrwxrwxrwx 1 root root 0 Nov 29 21:57 1-1.3 -> ../../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3
lrwxrwxrwx 1 root root 0 Nov 29 22:26 1-1.3:1.0 -> ../../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.0
lrwxrwxrwx 1 root root 0 Nov 29 21:57 usb1 -> ../../../devices/platform/soc/3f980000.usb/usb1

Buscamos el vendor 0665

find /sys/devices/platform/soc/3f980000.usb/usb1/ -name idVendor|xargs -i grep --with-filename 0665 {} 
/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/idVendor:0665
/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/idVendor:0665

Reseteamos los dos (solo con uno funciona)

echo 0 > /sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/authorized
sleep 1
echo 1 > /sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/authorized 
echo 0 > /sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/authorized
sleep 1
echo 1 > /sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/authorized 

Ahora si lanzamos la lectura, funciona:

python3 /home/pi/axpertbot-lite-main/local/inverter_data_read.py 92931712101193
92931712101193 0.0 229.9 50.0 0229 0185 004 394 49.00 000 068 0027 0000 000.0 00.00 00004 00010000 00 00 00000 010#e
tecnologia/lector_usb.1638225884.txt.gz · Last modified: by admin