uPNP does not find FDR-X1000V
mungewell opened this issue · comments
as reported by @toufraita.
'src/example/dump_camera_capabilities.py' script does not find camera, but capabilities do list if QX_ADDR is manual set to correct IP.
This is probably an issue with the big regular expression which attempts to pull the IPs out of the XML file that the camera 'sends'. (note: QX10 has an extra space which we needed to appreciate). Script know to work on QX10, AS15 and HX60V at present.
X1000V is in the same group as AS200, so there code base is likely the same
https://developer.sony.com/develop/cameras/
Try some extra prints to see if there's something obvious, or upload the XML file for inspection....
def _parse_device_definition(self, doc):
"""
Parse the XML device definition file.
"""
dd_regex = ('<av:X_ScalarWebAPI_Service>'
'\s*'
'<av:X_ScalarWebAPI_ServiceType>'
'(.+?)'
'</av:X_ScalarWebAPI_ServiceType>'
'\s*'
'<av:X_ScalarWebAPI_ActionList_URL>'
'(.+?)'
'/sony' # and also strip '/sony'
'</av:X_ScalarWebAPI_ActionList_URL>'
'\s*'
'<av:X_ScalarWebAPI_AccessType\s*/>' # Note: QX10 has 'Type />', HX60 has 'Type/>'
'\s*'
'</av:X_ScalarWebAPI_Service>')
services = {}
+ print doc
for m in re.findall(dd_regex, doc):
service_name = m[0]
endpoint = m[1]
services[service_name] = endpoint
return services
Checked what happens with my HDR-AS15 with the following patch.
$ git diff
diff --git a/src/pysony.py b/src/pysony.py
index 60c3b5c..f2ab1c8 100755
--- a/src/pysony.py
+++ b/src/pysony.py
@@ -112,6 +112,7 @@ class ControlPoint(object):
'</av:X_ScalarWebAPI_Service>')
services = {}
+ print doc
for m in re.findall(dd_regex, doc):
service_name = m[0]
endpoint = m[1]
@@ -125,6 +126,7 @@ class ControlPoint(object):
"""
r = urllib2.urlopen(url)
services = self._parse_device_definition(r.read())
+ print services
return services['camera']
As you can see the camera returns 3 services, all with the same IP and port. If this different from the X1000V?
$ python src/example/dump_camera_capabilities.py
Searching for camera
<?xml version="1.0" encoding="utf-8"?><root xmlns="urn:schemas-upnp-org:device-1-0" xmlns:dlna="urn:schemas-dlna-org:device-1-0" xmlns:av="urn:schemas-sony-com:av"><specVersion><major>1</major><minor>0</minor></specVersion><device><dlna:X_DLNADOC xmlns:dlna="urn:schemas-dlna-org:device-1-0">DMS-1.50</dlna:X_DLNADOC><deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType><friendlyName>HDR-AS15</friendlyName><manufacturer>Sony Corporation</manufacturer><manufacturerURL>http://www.sony.com/</manufacturerURL><modelDescription>SonyDigitalMediaServer</modelDescription><modelName>SonyImagingDevice</modelName><modelURL>http://www.sony.net/</modelURL><UDN>uuid:00000000-0005-0010-8000-40f308d5c70e</UDN><serviceList><service><serviceType>urn:schemas-upnp-org:service:ContentDirectory:1</serviceType><serviceId>urn:upnp-org:serviceId:ContentDirectory</serviceId><SCPDURL>/CdsDesc.xml</SCPDURL><controlURL>/upnp/control/ContentDirectory</controlURL><eventSubURL>/upnp/event/ContentDirectory</eventSubURL></service><service><serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType><serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId><SCPDURL>/CmsDesc.xml</SCPDURL><controlURL>/upnp/control/ConnectionManager</controlURL><eventSubURL>/upnp/event/ConnectionManager</eventSubURL></service><service><serviceType>urn:schemas-sony-com:service:ScalarWebAPI:1</serviceType><serviceId>urn:schemas-sony-com:serviceId:ScalarWebAPI</serviceId><SCPDURL>/ScalarWebApiDesc.xml</SCPDURL><controlURL></controlURL><eventSubURL></eventSubURL></service></serviceList><iconList><icon><mimetype>image/jpeg</mimetype><width>48</width><height>48</height><depth>24</depth><url>/DLNA_camera_48.jpg</url></icon><icon><mimetype>image/jpeg</mimetype><width>120</width><height>120</height><depth>24</depth><url>/DLNA_camera_120.jpg</url></icon><icon><mimetype>image/png</mimetype><width>48</width><height>48</height><depth>24</depth><url>/DLNA_camera_48.png</url></icon><icon><mimetype>image/png</mimetype><width>120</width><height>120</height><depth>24</depth><url>/DLNA_camera_120.png</url></icon></iconList><av:X_ScalarWebAPI_DeviceInfo xmlns:av="urn:schemas-sony-com:av"><av:X_ScalarWebAPI_Version>1.0</av:X_ScalarWebAPI_Version><av:X_ScalarWebAPI_ServiceList><av:X_ScalarWebAPI_Service><av:X_ScalarWebAPI_ServiceType>guide</av:X_ScalarWebAPI_ServiceType><av:X_ScalarWebAPI_ActionList_URL>http://10.0.0.1:10000/sony</av:X_ScalarWebAPI_ActionList_URL><av:X_ScalarWebAPI_AccessType /></av:X_ScalarWebAPI_Service><av:X_ScalarWebAPI_Service><av:X_ScalarWebAPI_ServiceType>accessControl</av:X_ScalarWebAPI_ServiceType><av:X_ScalarWebAPI_ActionList_URL>http://10.0.0.1:10000/sony</av:X_ScalarWebAPI_ActionList_URL><av:X_ScalarWebAPI_AccessType /></av:X_ScalarWebAPI_Service><av:X_ScalarWebAPI_Service><av:X_ScalarWebAPI_ServiceType>camera</av:X_ScalarWebAPI_ServiceType><av:X_ScalarWebAPI_ActionList_URL>http://10.0.0.1:10000/sony</av:X_ScalarWebAPI_ActionList_URL><av:X_ScalarWebAPI_AccessType /></av:X_ScalarWebAPI_Service></av:X_ScalarWebAPI_ServiceList><av:X_ScalarWebAPI_ImagingDevice><av:X_ScalarWebAPI_LiveView_URL>http://10.0.0.1:60152/liveview.JPG?%211234%21http%2dget%3a%2a%3aimage%2fjpeg%3a%2a%21%21%21%21%21</av:X_ScalarWebAPI_LiveView_URL><av:X_ScalarWebAPI_DefaultFunction>RemoteShooting</av:X_ScalarWebAPI_DefaultFunction></av:X_ScalarWebAPI_ImagingDevice></av:X_ScalarWebAPI_DeviceInfo></device></root>
{'accessControl': 'http://10.0.0.1:10000', 'camera': 'http://10.0.0.1:10000', 'guide': 'http://10.0.0.1:10000'}
Available calls:
getMethodTypes
getAvailableApiList
setShootMode
getShootMode
getSupportedShootMode
getAvailableShootMode
setSteadyMode
getSteadyMode
getSupportedSteadyMode
getAvailableSteadyMode
setViewAngle
getViewAngle
getSupportedViewAngle
getAvailableViewAngle
setMovieQuality
getMovieQuality
getSupportedMovieQuality
getAvailableMovieQuality
startLiveview
stopLiveview
startMovieRec
stopMovieRec
startIntervalStillRec
stopIntervalStillRec
setCameraFunction
getCameraFunction
getSupportedCameraFunction
getAvailableCameraFunction
getStorageInformation
getApplicationInfo
getVersions
getEvent
--
getSupportedShootMode :
{'id': 1, 'result': [['movie', 'intervalstill']]}
getSupportedSteadyMode :
[ERROR] camera doesn't workHTTP Error 403: Forbidden
getSupportedViewAngle :
[ERROR] camera doesn't workHTTP Error 403: Forbidden
getSupportedMovieQuality :
[ERROR] camera doesn't workHTTP Error 403: Forbidden
getSupportedCameraFunction :
[ERROR] camera doesn't workHTTP Error 403: Forbidden
Ignore the 'forbidden' this is a problem with this specific camera and can be 'solved' by authenticating first (see 'authenication2' branch).
Hi,
Sorry, but I'm not sure how I'm supposed to use that, I'm quite new to this. What url am I supposed to give to _parse_device_definition?
Hi, if you're interested about how the uPNP works this is quite a good write-up:
http://stackoverflow.com/questions/21340286/windows-compatibility-with-the-sony-camera-remote-api
However just adding the two print statements and running the 'dump_camera_capabilities' script (as above) should give us enough information to see if there's an obvious difference in the XML that the camera returns.
Cheers,
Simon.
Hi,
I'm sorry I had not the same version of pysony as you, and I didn't understand how the prints changed the sump_camera_capabilities script.
I changed everything to fit, and unfortunately it does not return anything. In the discover function, the packets returned by the _listen_for_discover function is the empty list.
I don't know much about network configuration, am I supposed to change the msg defined in the discover function?
the packets returned by the _listen_for_discover function is the empty list.
Oh, that might mean that we're not waiting long enough for the camera to respond. There should be no need to change outgoing message in the discover function (well we think its right).
The basic sequence is:
- Computer - Anyone There? (IP multicast to everyone)
- Camera - Yes, me! (here's my XML location)
- Computer (to camera) - Who are you? (ie. reads camera's XML)
- Camera - I'm Fred... blar, blar, blar
You could try to increase the timeout to see if the FDR-X1000V just takes a little longer to reply, 10s is probably overkill, but would confirm if this is the issue.
def discover(self, duration=None):
# Default timeout of 1s
if duration==None:
- duration=1
+ duration=10
You do have the computer connected to the camera's WiFi at this point, don't you? You suggested that using a 'QX_ADDR=..' works so I guess you do... just checking :-)
Yes I'm connected to the wifi ;) .
Still nothing... I had already tried to wait a little bit longer than one second. I've juste tried again with 10s and even 20s, but it's no better...
When I do
print self.__udp_socket.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL , 2)
I get None, and when I do
print self.__udp_socket.sendto(msg, (SSDP_ADDR, SSDP_PORT))
I get 141.
Is this of any help?
For SSDP_ADDR and SSDP_PORT I have the same thing as you. And I don't know if it changes anything, but I'm using Linux, not windows.