Upnp device detection

2

I'm following this and other similar posts, in order to detect my dlna capable speaker with upnp protocols. My phone (android) detects and controls the speaker ; but I would like to do it from my computer and connect it as dlna.

First terminal :

$ cat test.txt
M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: ssdp:discover
MX: 10
ST: ssdp:all

Second terminal :

$ nc -buvv 239.255.255.250 1900 < test.txt
Connection to 239.255.255.250 1900 port [udp/ssdp] succeeded!

Third terminal :

$ sudo tcpdump -vv -A -s 0 -i wlan0 udp port 1900 and host 239.255.255.250
15:56:10.949878 IP (tos 0x0, ttl 1, id 41655, offset 0, flags [DF], proto UDP (17), length 29)
    alarmpi.55492 > 239.255.255.250.ssdp: [udp sum ok] UDP, length 1
E.....@...$....~.......l.   ..X
15:56:10.950707 IP (tos 0x0, ttl 1, id 41656, offset 0, flags [DF], proto UDP (17), length 29)
    alarmpi.55492 > 239.255.255.250.ssdp: [udp sum ok] UDP, length 1
E.....@...$....~.......l.   ..X
15:56:11.951350 IP (tos 0x0, ttl 1, id 41732, offset 0, flags [DF], proto UDP (17), length 29)
    alarmpi.55492 > 239.255.255.250.ssdp: [udp sum ok] UDP, length 1
E.....@...$....~.......l.   ..X
15:56:12.951929 IP (tos 0x0, ttl 1, id 41748, offset 0, flags [DF], proto UDP (17), length 29)
    alarmpi.55492 > 239.255.255.250.ssdp: [udp sum ok] UDP, length 1
E.....@...$....~.......l.   ..X
15:56:13.952504 IP (tos 0x0, ttl 1, id 41788, offset 0, flags [DF], proto UDP (17), length 29)
    alarmpi.55492 > 239.255.255.250.ssdp: [udp sum ok] UDP, length 1
E....<@...$s...~.......l.   ..X
15:56:13.960469 IP (tos 0x0, ttl 1, id 41789, offset 0, flags [DF], proto UDP (17), length 114)
    alarmpi.55492 > 239.255.255.250.ssdp: [udp sum ok] UDP, length 86
E..r.=@...$....~.......l.^..M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: ssdp:discover
MX: 10
ST: ssdp:all

It looks like it's working, but nothing is detected.

Anyone has an idea of what I'm doing wrong ?

Thanks

jibe

Posted 2017-08-13T16:21:27.723

Reputation: 31

Not sure why your low-level discovery is not working, but I can recommend pulseaudio-dlna (available as package in many distros) if you want to stream sound to DLNA capable devices. That should also deal with the discovery for you, without the need to get your hands dirty in the protocols themselves.

– dirkt – 2017-08-13T17:35:16.103

Thanks. I tried to make it work the whole day, but with no success. I managed to install pulseaudio and pulseaudio-dlna (not so easy on RPI with archlinux). I managed to make some noise with pulseaudio when my computer is plugged by jack on the speaker, but impossible to push the audio via dlna... I think there may be a simpler way. Any idea ? – jibe – 2017-08-13T22:26:30.027

Huh. pulseaudio-dlna worked right out of the box for me. So it might be a problem on the some other level. Do you have any equivalent of Debian gupnp-tools on Archlinux, so you can do gssdp-discover -i wlan0 --timeout=3 or gupnp-universal-cp? – dirkt – 2017-08-14T05:24:37.993

Can't post the whole answer (links restriction !) But basically, it worked : – jibe – 2017-08-14T11:50:29.763

Can't post the whole answer to gssdp-dicover (links restriction !) But basically, it worked and gave me : (......) resource available USN: uuid:5f9ec1b3-ed59-1900-4530-b8ee6552cc9b Location: http://192.168.1.125:8080/description.xml (.....). That gave me enough to - apparently - achieve my goal !

– jibe – 2017-08-14T12:04:24.217

So write up and answer with what you did, and accept it yourself (it's ok to do that). If you can find out why the other method didn't work, that would be a bonus, if someone else has the same problem. – dirkt – 2017-08-14T12:12:15.693

Answers

1

Using dirkt comment, I was able to detect my dlna device with

gssdp-discover -i wlan0 --timeout=3

Then I adapted the content of that post : http://djoepnpoep.blogspot.co.za/2015/07/command-line-dlnaupnp-av-with-curl.html. I'm sorry I can't post my solution due to reputation/link restrictions... But being careful with " and end of lines, it is quite easy.

I'm now looking for a wider documentation on dlna controls (play, stop, pause, resume, sound control)

Installing pulseaudio and pulseaudio-dlna doesn't seem to be the wiser solution for my very restricted needs.

Thanks again.

EDIT : after looking in that direction, I found some .js libraries that seem to do the job : https://github.com/rexboy7/plug.play.js

jibe

Posted 2017-08-13T16:21:27.723

Reputation: 31