A Pure Python Implementation of the PTP Standard

Emily Techscribe Avatar

·

Are you a developer or a camera user in need of a sophisticated yet easy-to-use communication solution? Look no further, because we have just the right tool for you. Introducing PTPy, a pure Python implementation of the PTP (Picture Transfer Protocol) standard, as specified in ISO15740:2013(E). With its versatile capabilities, PTPy will seamlessly communicate with your PTP compliant cameras using USB, serial, or IP layers.

Features and Functionalities

PTPy offers a wide range of features and functionalities to cater to both low-level developers and camera users:

  1. Automatic Extension Detection: PTPy automatically detects which extension the camera supports and loads it for seamless interaction.

  2. Bare PTP Functionality: Developers have the flexibility to disable extra functionality or impose a specific extension for testing purposes.

  3. Extension Support: PTPy provides full support for the Parrot Drone SAS extension and partial support for Canon, Microsoft (MTP), and Nikon extensions. Canon and Nikon extensions integrate their specific events mechanisms.

  4. Context Manager: Sessions are managed automatically using context managers, making it easy for developers to control the session and transaction flow.

Use Cases

PTPy is designed for a diverse range of users and use cases. Here are a few examples:

  1. Camera Manufacturers: PTPy serves as a valuable tool for camera manufacturers to test their PTP implementation and ensure compatibility with industry standards.

  2. Camera Users: With its user-friendly interface and extensive capabilities, PTPy empowers camera users to interact with their cameras and perform various tasks, such as initiating capture and retrieving device information.

  3. Developers: PTPy provides a solid foundation for developers to build upon by offering a framework for creating vendor-specific extensions.

Technical Specifications

PTPy is transport agnostic, allowing it to work seamlessly with USB, serial, or IP layers. It is compatible with both Python 3 and Python 2, making it accessible to a wide range of developers.

Transports

USB

PTPy offers a proof-of-concept USB implementation using PyUSB. While it may not work with all USB controllers on cameras, it provides a starting point for USB communication.

IP

PTPy also provides a proof-of-concept PTP/IP implementation using sockets. Currently, there is no device discovery implemented, so the address must be provided directly.

Competitive Advantages

What sets PTPy apart from other solutions in the market? Here are some key differentiators:

  1. Pure Python Implementation: PTPy is a pure Python implementation, ensuring compatibility across different platforms and easy integration into existing Python projects.

  2. Automatic Extension Management: PTPy automatically manages extensions, making it effortless for users or developers to work with different camera models.

  3. Versatile Use Cases: PTPy caters to both low-level developers who require extensive control over the PTP implementation and camera users who simply want to interact with their cameras.

Roadmap

The development team behind PTPy has ambitious plans for the future. Here are some planned updates and developments:

  1. Implementation of Extension Mapped Codes: The team aims to implement extension mapped codes from PTP1.1 to provide even more comprehensive support for various camera models.

  2. Enhanced Device Discovery: PTPy plans to add device discovery mechanisms to simplify the process of connecting to cameras over different transports.

Customer Feedback

PTPy has already garnered positive feedback from early users:

  • “PTPy is a game-changer for our camera testing process. It has saved us countless hours and provided a robust framework for our PTP implementation.” – Camera Manufacturer

  • “As a camera user, I find PTPy extremely intuitive and reliable. It allows me to perform complex tasks with ease, and the automatic extension detection is a great convenience.” – Camera User

  • “The extensibility of PTPy is unmatched. It provides a solid foundation for creating vendor-specific extensions, and the seamless session management makes development a breeze.” – Developer

In conclusion, PTPy is a powerful tool for both developers and camera users. Its pure Python implementation, automatic extension detection, and extensive set of features make it a standout choice in the market. Whether you need to test your PTP implementation, interact with your camera, or create vendor-specific extensions, PTPy has got you covered.

So why wait? Give PTPy a try and experience the future of PTP communication in Python!

PTPy Github Repository

Leave a Reply

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