neolink icon indicating copy to clipboard operation
neolink copied to clipboard

Reolink Argus 3 Ultra: "Failed to connect to camera", running neolink on macOS arm64

Open dask8 opened this issue 2 years ago • 35 comments

Describe the bug Getting a connection error after launching neolink to retrieve battery status: [2023-11-02T18:39:52Z WARN neolink::common::camthread] Connection Lost: Failed to connect to camera Doorway Camera at Address: 192.168.50.118 on channel 0

This somehow worked once and only once but I was never able to repeat. I can ping the camera from the macOS server that sits in the same LAN (both camera and server connected over Wifi).

To Reproduce

  1. Create this configuration file:
bind = "0.0.0.0"

[[cameras]]
name = "Doorway Camera"
username = "admin"
password = "asimplepassword123"
uid = "95270006EQXXXXXX"
#address = "192.168.50.118:9000"

Specifying the address doesn't seem to help.

  1. Launch Neolink: ./neolink battery --config=neolink.toml "Doorway Camera"
  2. Observe connection failure (see logs below)

Expected behavior Connection succeeds, battery status is retrieved.

Versions NVR software: Neolink software: neolink 0.6.2 Reolink camera model and firmware: Reolink Argus 3 Ultra, v3.0.0.2355_23062001 macOS Server: MBP M2, macOS 13.5 (22G68)

Full logs

➜  neolink_macos ./neolink battery --config=neolink.toml "Doorway Camera"
[2023-11-02T18:44:32Z INFO  neolink] Neolink e47a0d5734b0a06b53bd8d78be9ca2f6b8396480 release
[2023-11-02T18:44:32Z INFO  neolink::utils] Doorway Camera: Connecting to camera at Address: 192.168.50.118:9000, UID: 95270006EQXXXXXX
[2023-11-02T18:44:32Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying TCP discovery
[2023-11-02T18:44:32Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying local discovery
[2023-11-02T18:44:32Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying remote discovery
[2023-11-02T18:44:32Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying map discovery
[2023-11-02T18:44:33Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying relay discovery
[2023-11-02T18:44:48Z WARN  neolink::common::camthread] Connection Lost: Failed to connect to camera Doorway Camera at Address: 192.168.50.118:9000, UID: 95270006EQXXXXXX on channel 0
➜  neolink_macos ping 192.168.50.118
PING 192.168.50.118 (192.168.50.118): 56 data bytes
Request timeout for icmp_seq 0
64 bytes from 192.168.50.118: icmp_seq=0 ttl=128 time=1070.989 ms
64 bytes from 192.168.50.118: icmp_seq=1 ttl=128 time=144.953 ms
64 bytes from 192.168.50.118: icmp_seq=2 ttl=128 time=164.330 ms
64 bytes from 192.168.50.118: icmp_seq=3 ttl=128 time=155.464 ms
64 bytes from 192.168.50.118: icmp_seq=4 ttl=128 time=204.682 ms
➜  neolink_macos ./neolink battery --config=neolink.toml "Doorway Camera"
[2023-11-02T18:45:20Z INFO  neolink] Neolink e47a0d5734b0a06b53bd8d78be9ca2f6b8396480 release
[2023-11-02T18:45:20Z INFO  neolink::utils] Doorway Camera: Connecting to camera at UID: 95270006EQXXXXXX
[2023-11-02T18:45:20Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying local discovery
[2023-11-02T18:45:22Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying remote discovery
[2023-11-02T18:45:22Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying map discovery
[2023-11-02T18:45:22Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying relay discovery
[2023-11-02T18:45:37Z WARN  neolink::common::camthread] Connection Lost: Failed to connect to camera Doorway Camera at UID: 95270006EQXXXXXX on channel 0

dask8 avatar Nov 02 '23 18:11 dask8

I just managed to have it work another time after many retries, it happened through the relay:

2023-11-02T22:26:47Z INFO  neolink::common::camthread] Attempt reconnect in 800ms
[2023-11-02T22:26:48Z INFO  neolink::utils] Doorway Camera: Connecting to camera at UID: 95270006EQXXXXXX
[2023-11-02T22:26:48Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying local discovery
[2023-11-02T22:26:49Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying remote discovery
[2023-11-02T22:26:49Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying map discovery
[2023-11-02T22:26:49Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying relay discovery
[2023-11-02T22:26:51Z INFO  neolink_core::bc_protocol] Doorway Camera: Relay success 95270006EQXXXXXX at 15.237.93.166:53092
[2023-11-02T22:26:51Z INFO  neolink::utils] Doorway Camera: Logging in
[2023-11-02T22:26:54Z INFO  neolink::utils] Doorway Camera: Connected and logged in
[2023-11-02T22:26:54Z INFO  neolink::common::camthread] Doorway Camera: Camera time is already set: 2023-11-02 23:26:53.0 -01:00:00
[2023-11-02T22:26:55Z INFO  neolink::common::neocam] Doorway Camera: Model Argus 3 Ultra
[2023-11-02T22:26:55Z INFO  neolink::common::neocam] Doorway Camera: Firmware Version v3.0.0.2355_23062001
<?xml version="1.0" encoding="utf-8"?><BatteryInfo><channelId>0</channelId><chargeStatus>none</chargeStatus><adapterStatus>none</adapterStatus><voltage>3673</voltage><current>-723</current><temperature>6</temperature><batteryPercent>50</batteryPercent><lowPower>0</lowPower><batteryVersion>2</batteryVersion></BatteryInfo>

All subsequent attempts failed since.

dask8 avatar Nov 02 '23 22:11 dask8

Let's try for some debug level logs

RUST_LOG="neolink=debug" ./neolink battery --config=neolink.toml "Doorway Camera"

Should help us figure out what is happening.

Also if you are on the same network and want to avoid relay set discovery=local (just make sure the addr has the correct ip)

QuantumEntangledAndy avatar Nov 03 '23 09:11 QuantumEntangledAndy

Thanks for looking into this Andrew. Please see below.

Updated config:

bind = "0.0.0.0"

[[cameras]]
name = "Doorway Camera"
username = "admin"
password = "asimplepassword123"
uid = "95270006EQXXXXXX"
address = "192.168.50.118"
discovery = "local"

Logs:

➜  neolink_macos RUST_LOG="neolink=debug" ./neolink battery --config=neolink.toml "Doorway Camera"
[2023-11-03T09:34:44Z INFO  neolink] Neolink e47a0d5734b0a06b53bd8d78be9ca2f6b8396480 release
[2023-11-03T09:34:44Z DEBUG neolink::common::reactor] Inserting new insance
[2023-11-03T09:34:44Z INFO  neolink::utils] Doorway Camera: Connecting to camera at Address: 192.168.50.118, UID: 95270006EQXXXXXX
[2023-11-03T09:34:44Z DEBUG neolink::common::reactor] New instance created
[2023-11-03T09:34:44Z DEBUG neolink::common::reactor] Got instance from reactor
[2023-11-03T09:34:44Z DEBUG neolink::battery] Battery: Instance aquired
[2023-11-03T09:34:44Z DEBUG neolink::common::neocam] Doorway Camera: InUse
[2023-11-03T09:34:44Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying TCP discovery
[2023-11-03T09:34:48Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying local discovery
[2023-11-03T09:34:48Z DEBUG neolink_core::bc_protocol::connection::discovery] Broadcasting to: [(255.255.255.255, 2015), (255.255.255.255, 2018), (192.168.50.255, 2015), (192.168.50.255, 2018)]
[2023-11-03T09:35:03Z WARN  neolink::common::camthread] Connection Lost: Failed to connect to camera Doorway Camera at Address: 192.168.50.118, UID: 95270006EQXXXXXX on channel 0

    Caused by:
        Timed out while waiting for camera reply
[2023-11-03T09:35:03Z INFO  neolink::common::camthread] Attempt reconnect in 50ms
[2023-11-03T09:35:03Z INFO  neolink::utils] Doorway Camera: Connecting to camera at Address: 192.168.50.118, UID: 95270006EQXXXXXX
[2023-11-03T09:35:03Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying TCP discovery
[2023-11-03T09:35:07Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying local discovery
[2023-11-03T09:35:07Z DEBUG neolink_core::bc_protocol::connection::discovery] Broadcasting to: [(255.255.255.255, 2015), (255.255.255.255, 2018), (169.254.255.255, 2015), (169.254.255.255, 2018), (192.168.50.255, 2015), (192.168.50.255, 2018)]
[2023-11-03T09:35:22Z WARN  neolink::common::camthread] Connection Lost: Failed to connect to camera Doorway Camera at Address: 192.168.50.118, UID: 95270006EQXXXXXX on channel 0

    Caused by:
        Timed out while waiting for camera reply
[2023-11-03T09:35:22Z INFO  neolink::common::camthread] Attempt reconnect in 100ms
[2023-11-03T09:35:23Z INFO  neolink::utils] Doorway Camera: Connecting to camera at Address: 192.168.50.118, UID: 95270006EQXXXXXX
[2023-11-03T09:35:23Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying TCP discovery
[2023-11-03T09:35:23Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying local discovery
[2023-11-03T09:35:23Z DEBUG neolink_core::bc_protocol::connection::discovery] Broadcasting to: [(255.255.255.255, 2015), (255.255.255.255, 2018), (169.254.255.255, 2015), (169.254.255.255, 2018), (192.168.50.255, 2015), (192.168.50.255, 2018)]
[2023-11-03T09:35:38Z WARN  neolink::common::camthread] Connection Lost: Failed to connect to camera Doorway Camera at Address: 192.168.50.118, UID: 95270006EQXXXXXX on channel 0

    Caused by:
        Timed out while waiting for camera reply
[2023-11-03T09:35:38Z INFO  neolink::common::camthread] Attempt reconnect in 200ms
[2023-11-03T09:35:38Z INFO  neolink::utils] Doorway Camera: Connecting to camera at Address: 192.168.50.118, UID: 95270006EQXXXXXX
[2023-11-03T09:35:38Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying TCP discovery
[2023-11-03T09:35:38Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying local discovery
[2023-11-03T09:35:38Z DEBUG neolink_core::bc_protocol::connection::discovery] Broadcasting to: [(255.255.255.255, 2015), (255.255.255.255, 2018), (169.254.255.255, 2015), (169.254.255.255, 2018), (192.168.50.255, 2015), (192.168.50.255, 2018)]
[2023-11-03T09:35:53Z WARN  neolink::common::camthread] Connection Lost: Failed to connect to camera Doorway Camera at Address: 192.168.50.118, UID: 95270006EQXXXXXX on channel 0

    Caused by:
        Timed out while waiting for camera reply
[2023-11-03T09:35:53Z INFO  neolink::common::camthread] Attempt reconnect in 400ms
[2023-11-03T09:35:53Z INFO  neolink::utils] Doorway Camera: Connecting to camera at Address: 192.168.50.118, UID: 95270006EQXXXXXX
[2023-11-03T09:35:53Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying TCP discovery
[2023-11-03T09:35:54Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying local discovery
[2023-11-03T09:35:54Z DEBUG neolink_core::bc_protocol::connection::discovery] Broadcasting to: [(255.255.255.255, 2015), (255.255.255.255, 2018), (169.254.255.255, 2015), (169.254.255.255, 2018), (192.168.50.255, 2015), (192.168.50.255, 2018)]
[2023-11-03T09:36:09Z WARN  neolink::common::camthread] Connection Lost: Failed to connect to camera Doorway Camera at Address: 192.168.50.118, UID: 95270006EQXXXXXX on channel 0

    Caused by:
        Timed out while waiting for camera reply
[2023-11-03T09:36:09Z INFO  neolink::common::camthread] Attempt reconnect in 800ms
[2023-11-03T09:36:09Z INFO  neolink::utils] Doorway Camera: Connecting to camera at Address: 192.168.50.118, UID: 95270006EQXXXXXX
[2023-11-03T09:36:09Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying TCP discovery
[2023-11-03T09:36:10Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying local discovery
[2023-11-03T09:36:10Z DEBUG neolink_core::bc_protocol::connection::discovery] Broadcasting to: [(255.255.255.255, 2015), (255.255.255.255, 2018), (169.254.255.255, 2015), (169.254.255.255, 2018), (192.168.50.255, 2015), (192.168.50.255, 2018)]
[2023-11-03T09:36:25Z WARN  neolink::common::camthread] Connection Lost: Failed to connect to camera Doorway Camera at Address: 192.168.50.118, UID: 95270006EQXXXXXX on channel 0

    Caused by:
        Timed out while waiting for camera reply
[2023-11-03T09:36:25Z INFO  neolink::common::camthread] Attempt reconnect in 1.6s
[2023-11-03T09:36:26Z INFO  neolink::utils] Doorway Camera: Connecting to camera at Address: 192.168.50.118, UID: 95270006EQXXXXXX
[2023-11-03T09:36:26Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying TCP discovery
[2023-11-03T09:36:27Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying local discovery
[2023-11-03T09:36:27Z DEBUG neolink_core::bc_protocol::connection::discovery] Broadcasting to: [(255.255.255.255, 2015), (255.255.255.255, 2018), (169.254.255.255, 2015), (169.254.255.255, 2018), (192.168.50.255, 2015), (192.168.50.255, 2018)]
[2023-11-03T09:36:42Z WARN  neolink::common::camthread] Connection Lost: Failed to connect to camera Doorway Camera at Address: 192.168.50.118, UID: 95270006EQXXXXXX on channel 0

    Caused by:
        Timed out while waiting for camera reply
[2023-11-03T09:36:42Z INFO  neolink::common::camthread] Attempt reconnect in 3.2s
[2023-11-03T09:36:45Z INFO  neolink::utils] Doorway Camera: Connecting to camera at Address: 192.168.50.118, UID: 95270006EQXXXXXX
[2023-11-03T09:36:45Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying TCP discovery
[2023-11-03T09:36:46Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying local discovery
[2023-11-03T09:36:46Z DEBUG neolink_core::bc_protocol::connection::discovery] Broadcasting to: [(255.255.255.255, 2015), (255.255.255.255, 2018), (169.254.255.255, 2015), (169.254.255.255, 2018), (192.168.50.255, 2015), (192.168.50.255, 2018)]
[2023-11-03T09:37:01Z WARN  neolink::common::camthread] Connection Lost: Failed to connect to camera Doorway Camera at Address: 192.168.50.118, UID: 95270006EQXXXXXX on channel 0

    Caused by:
        Timed out while waiting for camera reply
[2023-11-03T09:37:01Z INFO  neolink::common::camthread] Attempt reconnect in 5s
[2023-11-03T09:37:06Z INFO  neolink::utils] Doorway Camera: Connecting to camera at Address: 192.168.50.118, UID: 95270006EQXXXXXX
[2023-11-03T09:37:06Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying TCP discovery
[2023-11-03T09:37:06Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying local discovery
[2023-11-03T09:37:06Z DEBUG neolink_core::bc_protocol::connection::discovery] Broadcasting to: [(255.255.255.255, 2015), (255.255.255.255, 2018), (169.254.255.255, 2015), (169.254.255.255, 2018), (192.168.50.255, 2015), (192.168.50.255, 2018)]
[2023-11-03T09:37:21Z WARN  neolink::common::camthread] Connection Lost: Failed to connect to camera Doorway Camera at Address: 192.168.50.118, UID: 95270006EQXXXXXX on channel 0

    Caused by:
        Timed out while waiting for camera reply
[2023-11-03T09:37:21Z INFO  neolink::common::camthread] Attempt reconnect in 5s
[2023-11-03T09:37:26Z INFO  neolink::utils] Doorway Camera: Connecting to camera at Address: 192.168.50.118, UID: 95270006EQXXXXXX
[2023-11-03T09:37:26Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying TCP discovery
[2023-11-03T09:37:26Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying local discovery
[2023-11-03T09:37:26Z DEBUG neolink_core::bc_protocol::connection::discovery] Broadcasting to: [(255.255.255.255, 2015), (255.255.255.255, 2018), (169.254.255.255, 2015), (169.254.255.255, 2018), (192.168.50.255, 2015), (192.168.50.255, 2018)]
^C
➜  neolink_macos ping 192.168.50.118
PING 192.168.50.118 (192.168.50.118): 56 data bytes
64 bytes from 192.168.50.118: icmp_seq=0 ttl=128 time=517.174 ms
64 bytes from 192.168.50.118: icmp_seq=1 ttl=128 time=27.968 ms
64 bytes from 192.168.50.118: icmp_seq=2 ttl=128 time=50.365 ms

dask8 avatar Nov 03 '23 09:11 dask8

And same but without providing the UID:

RUST_LOG="neolink=debug" ./neolink battery --config=neolink.toml "Doorway Camera"
[2023-11-03T09:42:44Z INFO  neolink] Neolink e47a0d5734b0a06b53bd8d78be9ca2f6b8396480 release
[2023-11-03T09:42:44Z DEBUG neolink::common::reactor] Inserting new insance
[2023-11-03T09:42:44Z INFO  neolink::utils] Doorway Camera: Connecting to camera at Address: 192.168.50.118
[2023-11-03T09:42:44Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying TCP discovery
[2023-11-03T09:42:44Z DEBUG neolink::common::reactor] New instance created
[2023-11-03T09:42:44Z DEBUG neolink::common::reactor] Got instance from reactor
[2023-11-03T09:42:44Z DEBUG neolink::battery] Battery: Instance aquired
[2023-11-03T09:42:44Z DEBUG neolink::common::neocam] Doorway Camera: InUse
[2023-11-03T09:42:44Z DEBUG neolink::common::neocam] Doorway Camera: Idle
[2023-11-03T09:42:44Z DEBUG neolink::common::neocam] Doorway Camera: InUse
[2023-11-03T09:42:48Z INFO  neolink_core::bc_protocol] Doorway Camera: Discovery failed
[2023-11-03T09:42:48Z WARN  neolink::common::camthread] Connection Lost: Failed to connect to camera Doorway Camera at Address: 192.168.50.118 on channel 0

    Caused by:
        Cannot contact camera at given address
[2023-11-03T09:42:48Z INFO  neolink::common::camthread] Attempt reconnect in 50ms
[2023-11-03T09:42:48Z INFO  neolink::utils] Doorway Camera: Connecting to camera at Address: 192.168.50.118
[2023-11-03T09:42:48Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying TCP discovery
[2023-11-03T09:42:52Z INFO  neolink_core::bc_protocol] Doorway Camera: Discovery failed
[2023-11-03T09:42:52Z WARN  neolink::common::camthread] Connection Lost: Failed to connect to camera Doorway Camera at Address: 192.168.50.118 on channel 0

    Caused by:
        Cannot contact camera at given address
[2023-11-03T09:42:52Z INFO  neolink::common::camthread] Attempt reconnect in 100ms
[2023-11-03T09:42:52Z INFO  neolink::utils] Doorway Camera: Connecting to camera at Address: 192.168.50.118
[2023-11-03T09:42:52Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying TCP discovery
[2023-11-03T09:42:52Z INFO  neolink_core::bc_protocol] Doorway Camera: Discovery failed
[2023-11-03T09:42:52Z WARN  neolink::common::camthread] Connection Lost: Failed to connect to camera Doorway Camera at Address: 192.168.50.118 on channel 0

    Caused by:
        Cannot contact camera at given address
[2023-11-03T09:42:52Z INFO  neolink::common::camthread] Attempt reconnect in 200ms
[2023-11-03T09:42:52Z INFO  neolink::utils] Doorway Camera: Connecting to camera at Address: 192.168.50.118
[2023-11-03T09:42:52Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying TCP discovery
[2023-11-03T09:42:52Z INFO  neolink_core::bc_protocol] Doorway Camera: Discovery failed
[2023-11-03T09:42:52Z WARN  neolink::common::camthread] Connection Lost: Failed to connect to camera Doorway Camera at Address: 192.168.50.118 on channel 0

    Caused by:
        Cannot contact camera at given address
[2023-11-03T09:42:52Z INFO  neolink::common::camthread] Attempt reconnect in 400ms
[2023-11-03T09:42:53Z INFO  neolink::utils] Doorway Camera: Connecting to camera at Address: 192.168.50.118
[2023-11-03T09:42:53Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying TCP discovery
[2023-11-03T09:42:53Z INFO  neolink_core::bc_protocol] Doorway Camera: Discovery failed
[2023-11-03T09:42:53Z WARN  neolink::common::camthread] Connection Lost: Failed to connect to camera Doorway Camera at Address: 192.168.50.118 on channel 0

dask8 avatar Nov 03 '23 09:11 dask8

I don't think the argus 3 supports TCP over port 9000 so it cannot work without a UID.

What we want to do is send the hello message with the UID to the IP address on 2015 and 2018.

Can you include the following

uid = "95270006EQXXXXXX"
address = "192.168.50.118"

So supply both UID and addr without the port in the addr (should work with a port too but it is mostly ignored in UID discovery)

QuantumEntangledAndy avatar Nov 03 '23 09:11 QuantumEntangledAndy

Ah looking at your message again seems you did that on the last one. Not quite sure then, looks like just network issues. Don't suppose you can capture a wireshark dump? I can inspect the packets on the network and see what is happening and if any of the replies or messages aren't getting though

QuantumEntangledAndy avatar Nov 03 '23 11:11 QuantumEntangledAndy

Here is the wiresharp dump.

neolink is running on 192.168.50.3, camera is on 192.168.50.118

neolink.pcapng.zip

dask8 avatar Nov 03 '23 17:11 dask8

@QuantumEntangledAndy: friendly ping just in case you have a few cycles to look at this 🙏🏻

dask8 avatar Apr 17 '24 15:04 dask8

Ah thanks for the ping this kinda got missed in all my other work loads.

Looking at your network dump there only seems to be local broadcast discovery happening. Is there any reason why the relay one wouldn't show up? Maybe discovery = "local" or blocking the dns looks ups?

However it should be working locally because the camera seems to be sending a valid reply. Perhaps you can test with current master build and send me a packet capture of that.

In the mean time I'll see if theres anything odd about the message formats youve sent so far

QuantumEntangledAndy avatar Apr 18 '24 07:04 QuantumEntangledAndy

Ah I see the local now. Ok well i'm really not sure, the data seems fine to me. If you have the time I'd like to send you a build with extra debug prints so I can diagnose this

QuantumEntangledAndy avatar Apr 18 '24 08:04 QuantumEntangledAndy

I have time =) thanks a lot for looking into this!

dask8 avatar Apr 18 '24 08:04 dask8

I can try to build if you have a PR / branch ? Otherwise if you already have a binary built for macOS arm64 handy I am happy to try that. =)

dask8 avatar Apr 18 '24 08:04 dask8

We have CI setup for x86 macos but not arm64, not sure if github provides a arm64 runner should check

QuantumEntangledAndy avatar Apr 18 '24 11:04 QuantumEntangledAndy

Ok maybe have a macos_m1 build here https://github.com/QuantumEntangledAndy/neolink/actions/runs/8737424565 it will be called macos-14

QuantumEntangledAndy avatar Apr 18 '24 11:04 QuantumEntangledAndy

logs.txt

Thanks - logs attached (I ended up running on an x86 machine).

dask8 avatar Apr 18 '24 12:04 dask8

log
❯ RUST_LOG="neolink=debug" ./neolink battery --config=../neolink_macos/neolink.toml "Doorway Camera"
[2024-04-18T12:26:50Z INFO  neolink] Neolink 88a2ec7a11c960cb4a0546bfe86603b291ca5f3e debug
[2024-04-18T12:26:50Z INFO  neolink::utils] Doorway Camera: Connecting to camera at Address: 192.168.50.118, UID: 95270006EXXXXXX
[2024-04-18T12:26:50Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying TCP discovery
[2024-04-18T12:26:50Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying local discovery
[2024-04-18T12:26:50Z DEBUG neolink_core::bc_protocol::connection::discovery] Broadcasting to: [(255.255.255.255, 2015), (255.255.255.255, 2018), (192.168.50.255, 2015), (192.168.50.255, 2018)]
[2024-04-18T12:26:50Z DEBUG neolink_core::bc_protocol::connection::discovery] Also sending to [192.168.50.118:2018, 192.168.50.118:2015]
[2024-04-18T12:26:50Z INFO  neolink_core::bc_protocol::connection::discovery] Trying a direct connect to: 255.255.255.255:2015 with tid: 80
[2024-04-18T12:26:50Z INFO  neolink_core::bc_protocol::connection::discovery] Trying a direct connect to: 255.255.255.255:2018 with tid: 94
[2024-04-18T12:26:50Z INFO  neolink_core::bc_protocol::connection::discovery] Trying a direct connect to: 192.168.50.255:2015 with tid: 122
[2024-04-18T12:26:50Z INFO  neolink_core::bc_protocol::connection::discovery] Trying a direct connect to: 192.168.50.255:2018 with tid: 75
[2024-04-18T12:26:50Z INFO  neolink_core::bc_protocol::connection::discovery] Trying a direct connect to: 192.168.50.118:2018 with tid: 8
[2024-04-18T12:26:50Z INFO  neolink_core::bc_protocol::connection::discovery] Trying a direct connect to: 192.168.50.118:2015 with tid: 204
[2024-04-18T12:26:53Z DEBUG neolink::common::pushnoti] Push notification details are saved to Some("/Users/myusername/Library/Application Support/./neolink_token.toml")
[2024-04-18T12:26:53Z DEBUG neolink::common::pushnoti] Loaded push notification token
[2024-04-18T12:26:53Z DEBUG neolink::common::pushnoti] registration.fcm_token: eN0JmmWuhhE:APA91bFS3o9s6w9U_7LSQVYs7A5sk4M_0grBl2Pb_bTuuir-JKm4hWZ5kwDlmnyvIX0Vxfx7Ir4Tjr0xKBUIsLClr9nbeDcikSFacQbT787VHgAbYKCrMJOBdi41sVdqtv8xMn1FRM0K
[2024-04-18T12:26:53Z DEBUG neolink::common::pushnoti] push notification UID: A28CF1835C48A54057B86B36F4D581C7
[2024-04-18T12:26:53Z DEBUG neolink::common::pushnoti] Push notification Listening
[2024-04-18T12:27:05Z WARN  neolink::common::camthread] Doorway Camera: Connection Lost: Failed to connect to camera Doorway Camera at Address: 192.168.50.118, UID: 95270006EXXXXXX on channel 0

    Caused by:
        Timed out while waiting for camera reply#

QuantumEntangledAndy avatar Apr 18 '24 13:04 QuantumEntangledAndy

Hmm this suggests no reply from the camera. Will need more logging but it's late here so I'll do that tomorrow now

QuantumEntangledAndy avatar Apr 18 '24 13:04 QuantumEntangledAndy

When you got the packet dump was it a dump from the router or from the macOS? Want to eliminate firewalls etc as a candidate

QuantumEntangledAndy avatar Apr 18 '24 13:04 QuantumEntangledAndy

If possible I'd like a packet dump from the macOS. So I can see what packets arrive in the macOS network stack

QuantumEntangledAndy avatar Apr 18 '24 13:04 QuantumEntangledAndy

It was from macOS... I'll also look into the macOS firewall settings.

dask8 avatar Apr 18 '24 13:04 dask8

trace.pcapng.zip

Here is another dump from my mac. Please note that I used the following filter: ip.addr == 192.168.50.118. This is the ip of the camera.

dask8 avatar Apr 18 '24 13:04 dask8

I have more logging in place now. Maybe you can test it and report back?

QuantumEntangledAndy avatar Apr 19 '24 13:04 QuantumEntangledAndy

There you go:

❯ RUST_LOG="neolink=debug" ./neolink battery --config=../neolink_macos/neolink.toml "Doorway Camera"
[2024-04-18T12:26:50Z INFO  neolink] Neolink 88a2ec7a11c960cb4a0546bfe86603b291ca5f3e debug
[2024-04-18T12:26:50Z INFO  neolink::utils] Doorway Camera: Connecting to camera at Address: 192.168.50.118, UID: 95270006EXXXXXX
[2024-04-18T12:26:50Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying TCP discovery
[2024-04-18T12:26:50Z INFO  neolink_core::bc_protocol] Doorway Camera: Trying local discovery
[2024-04-18T12:26:50Z DEBUG neolink_core::bc_protocol::connection::discovery] Broadcasting to: [(255.255.255.255, 2015), (255.255.255.255, 2018), (192.168.50.255, 2015), (192.168.50.255, 2018)]
[2024-04-18T12:26:50Z DEBUG neolink_core::bc_protocol::connection::discovery] Also sending to [192.168.50.118:2018, 192.168.50.118:2015]
[2024-04-18T12:26:50Z INFO  neolink_core::bc_protocol::connection::discovery] Trying a direct connect to: 255.255.255.255:2015 with tid: 80
[2024-04-18T12:26:50Z INFO  neolink_core::bc_protocol::connection::discovery] Trying a direct connect to: 255.255.255.255:2018 with tid: 94
[2024-04-18T12:26:50Z INFO  neolink_core::bc_protocol::connection::discovery] Trying a direct connect to: 192.168.50.255:2015 with tid: 122
[2024-04-18T12:26:50Z INFO  neolink_core::bc_protocol::connection::discovery] Trying a direct connect to: 192.168.50.255:2018 with tid: 75
[2024-04-18T12:26:50Z INFO  neolink_core::bc_protocol::connection::discovery] Trying a direct connect to: 192.168.50.118:2018 with tid: 8
[2024-04-18T12:26:50Z INFO  neolink_core::bc_protocol::connection::discovery] Trying a direct connect to: 192.168.50.118:2015 with tid: 204
[2024-04-18T12:26:53Z DEBUG neolink::common::pushnoti] Push notification details are saved to Some("/Users/myusername/Library/Application Support/./neolink_token.toml")
[2024-04-18T12:26:53Z DEBUG neolink::common::pushnoti] Loaded push notification token
[2024-04-18T12:26:53Z DEBUG neolink::common::pushnoti] registration.fcm_token: eN0JmmWuhhE:APA91bFS3o9s6w9U_7LSQVYs7A5sk4M_0grBl2Pb_bTuuir-JKm4hWZ5kwDlmnyvIX0Vxfx7Ir4Tjr0xKBUIsLClr9nbeDcikSFacQbT787VHgAbYKCrMJOBdi41sVdqtv8xMn1FRM0K
[2024-04-18T12:26:53Z DEBUG neolink::common::pushnoti] push notification UID: A28CF1835C48A54057B86B36F4D581C7
[2024-04-18T12:26:53Z DEBUG neolink::common::pushnoti] Push notification Listening
[2024-04-18T12:27:05Z WARN  neolink::common::camthread] Doorway Camera: Connection Lost: Failed to connect to camera Doorway Camera at Address: 192.168.50.118, UID: 95270006EXXXXXX on channel 0

    Caused by:
        Timed out while waiting for camera reply#

I used artifacts from this build: https://github.com/QuantumEntangledAndy/neolink/actions/runs/8740360748

dask8 avatar Apr 20 '24 10:04 dask8

So I added three new prints right after the socket recieves a packet.

  • A print for sucessful packet being recieved
  • A print for a packet of an unexpected kind
  • A print for a packet that could not be understood

None of those prints were observed. At this point I am going to question if anything is actually being read by the socket. Your wireshark suggests the packet is being added into the macs network stack so can you check any application firewall?

I also wonder if this is a new macos security feature since my binary is not codesigned. I don't think I can even add entitilements since its a binary not a packed .app but since you are on a M1 which is much newer then my macos I cannot test this.

QuantumEntangledAndy avatar Apr 20 '24 14:04 QuantumEntangledAndy

First of all, thank you for your work.

I also have an Argus 3 Ultra, and doesn't work for me either, but the errors are slightly different. To the best of my knowlage it does NOT support streaming on port 9000, at least when I try, I get Trying TCP discovery, Discovery failed,Connection Lost: Failed to connect to camera...

I'm connecting with VLC and while neolink is not yet fully connected I get the expected white noise stream with "Stream not Ready", but then it stops and troughs the error: Your input can't be opened. VLC is unable to open the MRL rtsp://192.168.XXX.XXX:8554/...

Let me know if I can help debugging. Unfortunately I'm also not a Rust dev.

I'm running neolink on linux in docker. Output from docker:

Attaching to neolink
neolink    | Running: /bin/sh -c /usr/local/bin/neolink "${NEO_LINK_MODE}" --config /etc/neolink.toml
neolink    | [2024-05-19T16:04:42Z INFO  neolink] Neolink 82524a12b2a218b8d088029e19158ed9f44de9b8 release
neolink    | [2024-05-19T16:04:42Z INFO  neolink::rtsp] Starting RTSP Server at 0.0.0.0:8554
neolink    | [2024-05-19T16:04:42Z INFO  neolink::rtsp] patio: Rtsp Starting
neolink    | [2024-05-19T16:04:42Z INFO  neolink::utils] patio: Connecting to camera at UID: XXXXXXXXXXXXXXXX
neolink    | [2024-05-19T16:04:42Z INFO  neolink_core::bc_protocol] patio: Trying local discovery
neolink    | [2024-05-19T16:04:44Z INFO  neolink_core::bc_protocol] patio: Trying remote discovery
neolink    | [2024-05-19T16:04:44Z INFO  neolink_core::bc_protocol] patio: Trying map discovery
neolink    | [2024-05-19T16:04:44Z INFO  neolink_core::bc_protocol] patio: Trying relay discovery
neolink    | [2024-05-19T16:04:46Z INFO  neolink_core::bc_protocol] patio: Remote discovery success XXXXXXXXXXXXXXXX at 192.168.XXX.XXX:41132
neolink    | [2024-05-19T16:04:46Z INFO  neolink::utils] patio: Logging in
neolink    | [2024-05-19T16:04:47Z INFO  neolink::utils] patio: Connected and logged in
neolink    | [2024-05-19T16:04:49Z INFO  neolink::common::camthread] patio: Camera time is already set: 2024-05-19 18:04:48.0 -01:00:00
neolink    | [2024-05-19T16:04:51Z INFO  neolink::common::neocam] patio: Model Argus 3 Ultra
neolink    | [2024-05-19T16:04:51Z INFO  neolink::common::neocam] patio: Firmware Version v3.0.0.2355_23062001
neolink    | [2024-05-19T16:04:52Z INFO  neolink::rtsp::stream] patio: Available at /patio/sub, /patio/Sub, /patio/subStream, /patio/SubStream, /patio/Substream, /patio/substream
neolink    | [2024-05-19T16:05:08Z INFO  neolink::rtsp::stream] patio: Available at /patio/main, /patio/Main, /patio/mainStream, /patio/MainStream, /patio/Mainstream, /patio/mainstream, /patio
neolink    | [2024-05-19T16:05:31Z INFO  neolink::rtsp::stream] Buffer full on audsrc
neolink    | [2024-05-19T16:05:51Z INFO  neolink::rtsp::stream] Buffer full on vidsrc
neolink    | [2024-05-19T16:06:11Z INFO  neolink::rtsp::stream] Buffer full on audsrc
neolink    | [2024-05-19T16:06:31Z INFO  neolink::rtsp::stream] Buffer full on audsrc
neolink    | [2024-05-19T16:07:52Z INFO  neolink::rtsp::stream] Buffer full on audsrc
neolink    | [2024-05-19T16:08:32Z INFO  neolink::rtsp::stream] Buffer full on vidsrc
neolink    |
neolink    | (neolink:8): GStreamer-CRITICAL **: 16:08:32.490:
neolink    | Trying to dispose element vidsrc, but it is in PAUSED instead of the NULL state.
neolink    | You need to explicitly set elements to the NULL state before
neolink    | dropping the final reference, to allow them to clean up.
neolink    | This problem may also be caused by a refcounting bug in the
neolink    | application or some element.
neolink    |
neolink    | [2024-05-19T16:08:52Z INFO  neolink::rtsp::stream] Buffer full on audsrc
neolink    | [2024-05-19T16:10:12Z INFO  neolink::rtsp::stream] Buffer full on vidsrc
neolink    |
neolink    | (neolink:8): GStreamer-CRITICAL **: 16:10:12.775:
neolink    | Trying to dispose element vidsrc, but it is in PAUSED instead of the NULL state.
neolink    | You need to explicitly set elements to the NULL state before
neolink    | dropping the final reference, to allow them to clean up.
neolink    | This problem may also be caused by a refcounting bug in the
neolink    | application or some element.
neolink    |

neolink.toml:

bind = "0.0.0.0"
[[cameras]]
name = "patio"
username = "admin"
password = "XXXXXXXXX"
uid = "XXXXXXXXXXXXXXXX"

docker-compose.yml:

version: "3"
services:
  neolink:
    image: quantumentangledandy/neolink
    container_name: neolink
    ports:
      - 8554:8554
    volumes:
      - /docker/neolink/neolink.toml:/etc/neolink.toml
    restart: unless-stopped

wilhelmf-devel avatar May 19 '24 16:05 wilhelmf-devel

Firstly, yes Argus and other battery cameras use udp discovered on port 2018 or 2015 rather than tcp on port 9000. But we support both methods as can be seen by successful connection.

The issue on your logs all points to gatreamer (I really wish I could drop it sometimes but there's no good rtsp server provider in rust otherwise).

Can you please try an earlier docker tag. latest points to the bleeding edge and can sometimes cause issue (especially when I'm changing the gstreamer code)

QuantumEntangledAndy avatar May 20 '24 09:05 QuantumEntangledAndy

Thanks alot! Works great with v0.6.3.rc.1. (Did not try other versions)

If this is valuable information. Each time neolink connects it seems to be a different port on the camera. (So discovery local or with address doesn't work. remote works fine - so not a problem)

wilhelmf-devel avatar May 20 '24 13:05 wilhelmf-devel

Udp protocol is

  • client:random port to camera:2018
  • camera:random port to client random port

You will need host mode to get that to work well

QuantumEntangledAndy avatar May 20 '24 13:05 QuantumEntangledAndy

We use a random udp port range of 53500..54000. If your good with iptables you probably set it up to NAT to the neolink container. Unfortunately docker itself doesn't handle port ranges well and creates separate processes for each port you try to open.

QuantumEntangledAndy avatar May 20 '24 13:05 QuantumEntangledAndy

What is the status of Argus 3 Ultra support? I have Argus 3 Pro and it works, but I'm considering buying an another one and noticed that they now have Ultra version... but I won't buy if it is not working with neolink. Thanks.

dkerr64 avatar Aug 30 '24 13:08 dkerr64