Temat: Openwrt 18.06 arduino domoticz nie może otworzyć portu /dev/ttyAcm0

Cześć. Nie mogę otworzyć portu serial dla arduino na /dev/ttyAcm0. Trzeba jeszcze jakieś pakiety?

root@OpenWrt:~# dmesg | grep -i usb
[    5.670535] usbcore: registered new interface driver usbfs
[    5.676185] usbcore: registered new interface driver hub
[    5.681681] usbcore: registered new device driver usb
[    5.711203] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    5.743567] ehci-platform ehci-platform.0: new USB bus registered, assigned bus number 1
[    5.788568] ehci-platform ehci-platform.0: USB 2.0 started, EHCI 1.00
[    5.795807] hub 1-0:1.0: USB hub found
[    5.810321] ehci-platform ehci-platform.1: new USB bus registered, assigned bus number 2
[    5.858552] ehci-platform ehci-platform.1: USB 2.0 started, EHCI 1.00
[    5.865786] hub 2-0:1.0: USB hub found
[    5.877378] usbcore: registered new interface driver usb-storage
[    5.885152] usbcore: registered new interface driver uas
[    6.536446] usb 1-1: new high-speed USB device number 2 using ehci-platform
[    6.665804] usb 2-1: new full-speed USB device number 2 using ehci-platform
[    6.972645] usb 2-1: not running at top speed; connect to a high speed hub
[    7.071951] usb-storage 1-1:1.0: USB Mass Storage device detected
[    7.207717] scsi host0: usb-storage 1-1:1.0
[    7.221855] hub 2-1:1.0: USB hub found
[    7.558549] usb 2-1.1: new full-speed USB device number 3 using ehci-platform
[    7.828551] usb 2-1.2: new full-speed USB device number 4 using ehci-platform
[   15.436647] cdc_acm 2-1.1:1.0: ttyACM0: USB ACM device
[   15.458880] usbcore: registered new interface driver cdc_acm
[   15.464643] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[   15.486831] usbcore: registered new interface driver cdc_wdm
[   15.769507] usbcore: registered new interface driver usblp
[   15.802501] usbcore: registered new interface driver usbserial
[   15.808497] usbcore: registered new interface driver usbserial_generic
[   15.815262] usbserial: USB Serial support registered for generic
[   15.878569] usbcore: registered new interface driver cdc_ether
[   15.901420] usbcore: registered new interface driver cdc_ncm
[   16.078246] usbcore: registered new interface driver ftdi_sio
[   16.084221] usbserial: USB Serial support registered for FTDI USB Serial Device
[   16.092078] ftdi_sio 2-1.2:1.0: FTDI USB Serial Device converter detected
[   16.099102] usb 2-1.2: Detected FT232RL
[   16.139832] usb 2-1.2: FTDI USB Serial Device converter now attached to ttyUSB0
[   16.148330] usbcore: registered new interface driver huawei_cdc_ncm
[   16.280693] usbcore: registered new interface driver qmi_wwan
[   16.289266] usbcore: registered new interface driver rndis_host
[   16.313959] usbcore: registered new interface driver sierra
[   16.319750] usbserial: USB Serial support registered for Sierra USB modem
[   16.350302] usbcore: registered new interface driver sierra_net
[   19.554530] usbcore: registered new interface driver cdc_mbim
[   19.616922] usbcore: registered new interface driver option
[   19.622708] usbserial: USB Serial support registered for GSM modem (1-port)
[   19.684861] usbcore: registered new interface driver qcserial
[   19.690835] usbserial: USB Serial support registered for Qualcomm USB modem

2

Odp: Openwrt 18.06 arduino domoticz nie może otworzyć portu /dev/ttyAcm0

Bo znalazł Ci też /dev/ttyUSB0. Masz ftdi czy na czym?

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

3

Odp: Openwrt 18.06 arduino domoticz nie może otworzyć portu /dev/ttyAcm0

ftdi jest co innego i działa. Arduino chodziły po ACM

4

Odp: Openwrt 18.06 arduino domoticz nie może otworzyć portu /dev/ttyAcm0

Też znalazł. Tylko ttyACM0 a nie ttyAcm0

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

5

Odp: Openwrt 18.06 arduino domoticz nie może otworzyć portu /dev/ttyAcm0

Domoticz nie może otworzyć portu.

https://i.imgur.com/hL0dGtH.png


Z konsoli się udaje

root@OpenWrt:~# stty -F /dev/ttyACM0 raw speed 115200
115200
root@OpenWrt:~# cat /dev/ttyACM0
0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
0;255;3;0;9;MCO:BGN:BFR
0;255;3;0;9;TSM:INIT
0;255;3;0;9;TSF:WUR:MS=0
0;255;3;0;9;TSM:INIT:TSP OK
0;255;3;0;9;TSM:INIT:GW MODE
0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
0;255;3;0;9;MCO:REG:NOT NEEDED
0;255;3;0;14;Gateway startup complete.
0;255;0;0;18;2.1.1
0;255;3;0;11;Relay
0;255;3;0;12;1.0
0;1;0;0;3;
0;255;3;0;9;MCO:BGN:STP
0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
^C

6

Odp: Openwrt 18.06 arduino domoticz nie może otworzyć portu /dev/ttyAcm0

O domoticzu nic nie wiem. Ich pytaj dlaczego.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

7 (edytowany przez scalpel 2018-12-01 19:14:51)

Odp: Openwrt 18.06 arduino domoticz nie może otworzyć portu /dev/ttyAcm0

Problem leży chyba w pliku /etc/init.d/domoticz bo uruchomiony bezpośrednio, nie ze skryptu, to otwiera port
To USB111 to symlink do ACM0(kombinowałem)

root@OpenWrt:~# domoticz
2018-12-01 19:08:11.841  Status: Domoticz V4.9700 (c)2012-2018 GizMoCuz
2018-12-01 19:08:11.842  Status: Build Hash: b97777b, Date: 2018-06-23 16:18:06
2018-12-01 19:08:11.843  Status: Startup Path: /usr/bin/
2018-12-01 19:08:13.997  Status: PluginSystem: Failed dynamic library load, install the latest libpython3.x library that is available for your platform.
2018-12-01 19:08:14.030  Active notification Subsystems: gcm, http (2/13)
2018-12-01 19:08:14.032  Status: WebServer(HTTP) started on address: :: with port 8080
2018-12-01 19:08:14.042  Error: [web:443] missing SSL certificate chain file ./server_cert.pem!
2018-12-01 19:08:14.043  Error: [web:443] missing SSL certificate file ./server_cert.pem!
2018-12-01 19:08:14.044  Error: [web:443] missing SSL private key file ./server_cert.pem!
2018-12-01 19:08:14.045  Error: [web:443] missing SSL DH parameters file ./server_cert.pem!
2018-12-01 19:08:14.172  Error: [web:443] missing SSL certificate chain file ./server_cert.pem!
2018-12-01 19:08:14.173  Error: [web:443] missing SSL certificate file ./server_cert.pem!
2018-12-01 19:08:14.174  Error: [web:443] missing SSL private key file ./server_cert.pem!
2018-12-01 19:08:14.175  Error: [web:443] missing SSL DH parameters file ./server_cert.pem!
2018-12-01 19:08:14.179  Error: [web:443] missing SSL certificate chain file ./server_cert.pem!
2018-12-01 19:08:14.179  Error: [web:443] missing SSL certificate file ./server_cert.pem!
2018-12-01 19:08:14.180  Error: [web:443] missing SSL private key file ./server_cert.pem!
2018-12-01 19:08:14.181  Error: [web:443] missing SSL DH parameters file ./server_cert.pem!
2018-12-01 19:08:14.183  Error: WebServer(SSL) startup failed on address 0.0.0.0 with port: 443: bind: Address in use
2018-12-01 19:08:14.184  Error: WebServer(SSL) check privileges for opening ports below 1024
2018-12-01 19:08:14.186  Status: Proxymanager started.
2018-12-01 19:08:14.190  Starting shared server on: :::6144
2018-12-01 19:08:14.195  Status: TCPServer: shared server started...
2018-12-01 19:08:14.196  Status: RxQueue: queue worker started...
2018-12-01 19:08:16.199  Status: EventSystem: reset all events...
2018-12-01 19:08:16.201  Status: EventSystem: reset all device statuses...
2018-12-01 19:08:16.204  Status: EventSystem - Python: Failed dynamic library load, install the latest libpython3.x library that is available for your platform.
2018-12-01 19:08:16.206  Status: EventSystem: Queue thread started...
2018-12-01 19:08:16.207  Status: EventSystem: Started
2018-12-01 19:08:17.202  Status: MySensors: Using serial port: /dev/ttyUSB111
2018-12-01 19:08:18.862  MySensors: Gateway Ready...
2018-12-01 19:08:18.938  Status: MySensors: Node: 0, Sketch Name: Relay
2018-12-01 19:08:18.940  Status: MySensors: Node: 0, Sketch Version: 1.0
2018-12-01 19:08:18.942  MySensors: Gateway Version: 2.1.1

/etc/init.d/domoticz

#!/bin/sh /etc/rc.common

START=99
USE_PROCD=1
PROG=/usr/bin/domoticz
PIDFILE=/var/run/domoticz.pid

start_domoticz() {
    local section="$1"
    local loglevel sslcert sslpass sslwww syslog userdata

    config_get loglevel "$section" "loglevel"
    config_get sslcert "$section" "sslcert"
    config_get sslkey "$section" "sslkey"
    config_get sslpass "$section" "sslpass"
    config_get ssldhparam "$section" "ssldhparam"
    config_get sslwww "$section" "sslwww"
    config_get syslog "$section" "syslog"
    config_get userdata "$section" "userdata" userdata /var/lib/domoticz

    [ -n "$loglevel" ] && procd_append_param command -loglevel "$loglevel"
    [ -n "$syslog" ] && procd_append_param command -syslog "$syslog"

    [ -d "${userdata}" ] || {
        mkdir -p "${userdata}"
        chmod 0770 "$userdata"
        chown domoticz:domoticz "$userdata"
    }

    # By default, ${userdata}/scripts is a symlink to /etc/domoticz/scripts
    # and the two dzVents directories under there which Domoticz will actually
    # write to at runtime are symlinked back to /var/lib again.
    [ -d "${userdata}/plugins" ] || ln -sf /etc/domoticz/plugins "${userdata}/plugins"
    [ -d "${userdata}/scripts" ] || ln -sf /etc/domoticz/scripts "${userdata}/scripts"
    for DIR in data generated_scripts; do
        [ -d /var/lib/domoticz/dzVents/$DIR ] || {
            mkdir -p /var/lib/domoticz/dzVents/$DIR
            chown domoticz.domoticz /var/lib/domoticz/dzVents/$DIR
        }
    done
    procd_append_param command -userdata "$userdata"

    [ -n "$sslcert" -a "${sslwww:-0}" -gt 0 ] && {
        procd_append_param command -sslcert "$sslcert"
        procd_append_param command -sslwww "$sslwww"
        [ -n "$sslkey" ] && procd_append_param command -sslkey "$sslkey"
        [ -n "$sslpass" ] && procd_append_param command -sslpass "$sslpass"
        [ -n "$ssldhparam" ] && procd_append_param command -ssldhparam "$ssldhparam"
    } || procd_append_param command -sslwww 0
}

start_service() {
    procd_open_instance

    procd_set_param command "$PROG"
    procd_append_param command -noupdates
    procd_append_param command -approot /usr/share/domoticz/

    config_load "domoticz"
    config_get_bool disabled "$section" "disabled" 0
    [ "$disabled" -gt 0 ] && return 1
    config_foreach start_domoticz domoticz

    procd_set_param pidfile "$PIDFILE"
    procd_set_param respawn
    procd_set_param stdout 0
    procd_set_param term_timeout 10
    procd_set_param user "domoticz"

    procd_close_instance
}

Edycja:

zahaszowałem to

 #procd_set_param user "domoticz"

Problem rozwiązany

8

Odp: Openwrt 18.06 arduino domoticz nie może otworzyć portu /dev/ttyAcm0

No właśnie, domoticz odpalał Ci się jako user domoticz bez prawa dostępu do /dev/ttyACM0. W sumie uprawnienia do urządzenia też by wystarczyło zmienić.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

9

Odp: Openwrt 18.06 arduino domoticz nie może otworzyć portu /dev/ttyAcm0

Jak znasz lepsze rozwiązanie to podaj, i wydaje mi się że należałoby to zgłosić developerom bo prędzej czy później też ktoś będzie miał z tym problem.

10

Odp: Openwrt 18.06 arduino domoticz nie może otworzyć portu /dev/ttyAcm0

chmod 777 /dev/ttyACM0

przy każdym utworzeniu urządzenia. Sobie nawet na hotplugu to możesz zrobić.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

11

Odp: Openwrt 18.06 arduino domoticz nie może otworzyć portu /dev/ttyAcm0

no fakt.. dzięki