Here's the python scripts to enable ptpip connections from Linux. They work for me on raspberry pi OS and Ubuntu 20.04 (edit and on windows 10 uses msys2 msys or mingw python).
It's possible they could work on Mac too (confirmed working on MacOS 11, 12)
edit:
2024/02/09 scripts are now on github
https://github.com/reyalpchdk/ptpip-canon-helpersedit:
2021/04/18 updated version 0.1.1 with improved windows support.
edit:
This also allows gphoto2 to connect over ptpip, like
gphoto2 --port ptpip:192.168.123.45 -L
From the readme:
ptpip-canon-upnp-helper.py
Responds to UPnP M-SEARCH requests for upnp:rootdevice
ptpip-canon-desc-helper.py
Responds HTTP GET requests with an XML file containing a suitable description
By default, started automatically by ptpip-canon-upnp-helper.py, so you
shouldn't need to run it directly.
Dependencies:
Python 3
pip install ssdpy
To connect from chdkptp (
https://app.assembla.com/wiki/show/chdkptp) you must
build chdkptp with PTP/IP support by setting PTPIP_SUPPORT=1 in config.mk
Basic usage:
ptpip-canon-upnp-helper.py LAN_IP_Address
LAN_IP_Address must be an IPv4 address (not hostname) on the computer you
want to connect the camera to, reachable from the wifi network the camera
will connect from.
Basic options:
Use -n to set the name that will appear in the Canon UI. It defaults to the
computer hostname, as returned by socket.gethostname()
Pass -P to ptpip-canon-upnp-helper.py to set the port used for description
requests. Default is 8043
UPnP requests are listened for on UDP port 1900. This is defined on the camera
and cannot be changed.
To provide a persistent ID for your connection ptpip-canon-upnp-helper.py will
create a file named ptpip-canon-helper.uuid in the current directory if it does
not already exist.
To connect a camera, go to the connection menu on the camera, select computer
and "Add a Device..."
If it works, you should see the hostname of your computer (or the name specified
with the -name option) listed on the Canon display.
This process will generate some requests to the scripts, which will show the
requesting IP in standard output, like
INFO:ptpip-upnp-helper:Received qualifying M-SEARCH from ('192.168.123.45', 58981)
192.168.123.45 - - [29/Mar/2021 22:36:47] "GET /ptpip-canon-desc-helper.xml HTTP/1.1" 200 -
Select the name and press set. The camera will go into a screen that says
"Connected to device <name>"
To connect in chdkptp, enter
connect -h=<camera_ip>
To prevent the camera from timing out and closing the connection, use
!con:ptp_get_object_handles()
The screen will go black. To re-enable the screen, enter
=post_levent_to_ui(4482)
for DryOS cameras, or
=post_levent_to_ui(4418)
for VxWorks
File transfers and scripting should work. Switching to shooting mode or
shooting fail on known cameras without additional hacking.
Use control+C to kill the scripts.
Note IPv6 is not supported by these scripts. In my testing, the cameras
only attempted IPv4. However, I have not tested an IPv6-only environment