Upnp device detection

Posted on

Problem :

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

Solution :

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

Leave a Reply

Your email address will not be published. Required fields are marked *