schwinn / khtool

Tool to query or change settings of Neumann KH DSP speakers
MIT License
10 stars 2 forks source link

mDNS not working #1

Open zivillian opened 1 year ago

zivillian commented 1 year ago

I tried this tool and was not able to use it because the initial mDNS query _services._dns-sd.udp.local failed on my network. I tried ubuntu and windows with a direct network connection between my laptop and the KH 80. THe Neumann MA 1 app was able to connect to the speaker and control the LED.

After tracing this with wireshark I suspect the reason is, that the MA 1 app is not resolving all services, but directly resolving _ssc._tcp.local.

schwinn commented 1 year ago

Hi, I've just tested it on a Debian 10 linux host and it worked fine. The discovery will be done by the _ssc._tcp.local mDNS query, which will be answered by the speakers with their IPv6 link local address. This should work without a running MA 1 application.

root@debian:~/khtool# ./khtool.py -i enp2s0 --scan Found 2 Device(s) and stored configuration to khtool.json.

zivillian commented 1 year ago

I tried your command on ubuntu 22.04 and it failed with the following output:

user@ubuntu:~/khtool$ sudo ./khtool.py -i enx000acd2521ee --scan
Task exception was never retrieved
future: <Task finished name='Task-3' coro=<_ServiceBrowserBase._async_start_query_sender() done, defined at /usr/local/lib/python3.10/dist-packages/zeroconf/_services/browser.py:453> exception=ValueError('min() arg is an empty sequence')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/zeroconf/_services/browser.py", line 457, in _async_start_query_sender
    self._async_send_ready_queries_schedule_next()
  File "/usr/local/lib/python3.10/dist-packages/zeroconf/_services/browser.py", line 484, in _async_send_ready_queries_schedule_next
    self._async_send_ready_queries(now)
  File "/usr/local/lib/python3.10/dist-packages/zeroconf/_services/browser.py", line 473, in _async_send_ready_queries
    outs = self._generate_ready_queries(self._first_request, now)
  File "/usr/local/lib/python3.10/dist-packages/zeroconf/_services/browser.py", line 442, in _generate_ready_queries
    ready_types = self.query_scheduler.process_ready_types(now)
  File "/usr/local/lib/python3.10/dist-packages/zeroconf/_services/browser.py", line 246, in process_ready_types
    if self.millis_to_wait(now):
  File "/usr/local/lib/python3.10/dist-packages/zeroconf/_services/browser.py", line 234, in millis_to_wait
    next_time = min(self._next_time.values())
ValueError: min() arg is an empty sequence
Traceback (most recent call last):
  File "/home/user/khtool/./khtool.py", line 529, in <module>
    main()
  File "/home/user/khtool/./khtool.py", line 432, in main
    raise Exception("No SSC device setup found.")
Exception: No SSC device setup found.

tcpdump for mDNS shows the following output:

user@ubuntu:~/khtool$ sudo tcpdump -i enx000acd2521ee -vvvv udp port 5353
tcpdump: listening on enx000acd2521ee, link-type EN10MB (Ethernet), snapshot length 262144 bytes
21:10:26.320614 IP6 (flowlabel 0x3b63b, hlim 255, next-header UDP (17) payload length: 54) device.mdns > ff02::fb.mdns: [bad udp cksum 0x0e8a -> 0x1154!] 0 PTR (QU)? _services._dns-sd._udp.local. (46)
21:10:27.322221 IP6 (flowlabel 0x3b63b, hlim 255, next-header UDP (17) payload length: 54) device.mdns > ff02::fb.mdns: [bad udp cksum 0x0e8a -> 0x9154!] 0 PTR (QM)? _services._dns-sd._udp.local. (46)
21:10:29.324970 IP6 (flowlabel 0x3b63b, hlim 255, next-header UDP (17) payload length: 54) device.mdns > ff02::fb.mdns: [bad udp cksum 0x0e8a -> 0x9154!] 0 PTR (QM)? _services._dns-sd._udp.local. (46)

I have a direct connection between my device and the speaker (using an USB<->Ethernet adapter) and nothing else involved.

schwinn commented 1 year ago

Which version of the zeroconf library is installed on your system? Here's the output of my system.

root@debian:/etc# pip3 list
Package           Version      
----------------- -------------      
zeroconf          0.47.1
zivillian commented 1 year ago
user@device:~$ pip3 list | grep zeroconf
zeroconf               0.47.1
zivillian commented 1 year ago

it's not urgent for me, since I found the IPs of my speakers via wireshark and manually created a khtool.json but wanted to report in case others face the same issue.

schwinn commented 1 year ago

Comparing your tcpdump output with mine, it looks like your speakers are not responding to the mdns query. Stupid question but have you rebooted the speaker and tried again? Is the firmware 1.3.2 installed on the KH80?

root@debian:~# tcpdump -pi enp2s0 -nvv port 5353
tcpdump: listening on enp2s0, link-type EN10MB (Ethernet), capture size 262144 bytes
08:20:31.728155 IP6 (flowlabel 0xddc9f, hlim 255, next-header UDP (17) payload length: 54) fe80::21a:8cff:fe12:ef9f.5353 > ff02::fb.5353: [bad udp cksum 0x7b92 -> 0xa44b!] 0 PTR (QU)? _services._dns-sd._udp.local. (46)
08:20:31.787548 IP6 (hlim 255, next-header UDP (17) payload length: 205) fe80::2a36:38ff:fe60:b288.5353 > ff02::fb.5353: [udp sum ok] 0*- [0q] 1/0/3 _services._dns-sd._udp.local. PTR _ssc._tcp.local. ar: Right.local. (Cache flush) AAAA fe80::2a36:38ff:fe60:b288, Right._ssc._tcp.local. (Cache flush) SRV Right.local.:45 0 0, Right._ssc._tcp.local. (Cache flush) TXT "txtvers=1" "Model=KH 80" "Serial=6372436736000000" (197)
zivillian commented 1 year ago

querying the speaker shows device.identity.version 1_3_1. Do you know a way to update the firmware without an ipad?

schwinn commented 1 year ago

The newest MA 1 App (Version 1.6.2) will install the newest firmware.

zivillian commented 1 year ago

after adding a switch, I found out, that the MA 1 app only finds either the left or right speaker (depending on random) - so I guess something is wrong with my network settings. I'll try to further inverstigate, but I'm on vacation next week.

schwinn commented 1 year ago

Is the your linux host running in a virtual enviroment like VMware, KVM or Virtualbox?

zivillian commented 1 year ago

It's running bare metal on my laptop