Package: dpt-rp1-py
dpt-rp1-pyPython script to manage electronic paper devices made by Sony (Digital Paper, DPT-RP1, DPT-CP1) or Fujitsu (Quaderno) without the Digital Paper App. This repository includes a Python library and a command line utility to manage documents on the reader. Tested on Windows, Linux, and macOS. Should also work for Sony's other digital paper readers.Throughout this document,readerordevicerefers to your Digital Paper device.InstallationWe now have a proper Python package, so you may just run:pip3 install dpt-rp1-pyInstalling the package also installs the command line utilitiesdptrp1anddptmount. To install the library from the sources, clone this repository, then runpython3 setup.py installorpip3 install .from the root directory. To install as a developer usepython3 setup.py develop(seethe setuptools docs) and work on the source as usual.Using the command line utilityThe command line utility requires a connection to the reader via WiFi, Bluetooth, or USB. The USB connection works on Windows and MacOS but may not work on a Linux machine.To see if you can successfully connect to the reader, try the commanddptrp1 list-documents. If you have Sony's Digital Paper App installed, this should work without any further configuration. If this fails, register your reader with the app usingdptrp1 register.Basic usageHere you see some basic usage examples for the utility. Text following a dollar sign is the command as entered on the command line on MacOS or Linux. Your paths may look slightly different on Windows.Registering the deviceThis command pairs the command line utility to your reader. You only need to run this once. Keep the device nearby, you will need to read a code from the display and enter it.$ dptrp1 register                                                                                 
Discovering Digital Paper for 30 seconds…
Found Digital Paper with serial number 500XXXX
Cleaning up...
<Response [204]>
Requesting PIN...
Encoding nonce...
Please enter the PIN shown on the DPT-RP1:Listing all documents on the device$ dptrp1 list-documents                                                                                 
Document/Note/Graph_20171022.pdf
Document/Work/Scans/Contract.pdf
Document/Papers/svetachov2010.pdf
Document/Papers/sporns2012.pdfGetting general usage instructions$ dptrp1 -h
usage: dptrp1 [-h] [--client-id CLIENT_ID] [--key KEY] [--addr ADDR]
              [--serial SERIAL] [--yes] [--quiet]
              {copy-document,[...],wifi-scan}
              [command_args [command_args ...]]

Remote control for Sony DPT-RP1

positional arguments:
  {copy-document,[...],wifi-scan}
                        Command to run
  command_args          Arguments for the command

optional arguments:
  -h, --help            show this help message and exit
  --client-id CLIENT_ID
                        File containing the device's client id
  --key KEY             File containing the device's private key
  --addr ADDR           Hostname or IP address of the device. Disables auto
                        discovery.
  --serial SERIAL       Device serial number for auto discovery. Auto
                        discovery only works for some minutes after the
                        Digital Paper's Wi-Fi setting is switched on.
  --yes, -y             Automatically answer yes to confirmation prompts, for
                        running non-interactively.
  --quiet, -q           Suppress informative messages.Getting help for the upload command$ dptrp1 help upload

    Usage: dptrp1 upload <local_path> [<remote_path>]

    Upload a local document to the reader.
    Will upload to Document/ if only the local path is specified.Uploading a document to the reader$ dptrp1 upload ~/Desktop/scan.pdfOpening the second page of a document on the reader$ dptrp1 display-document Document/scan.pdf 2Connecting to a WiFi networkThis command requires the path to a WiFi configuration file as a parameter. Look at thesample configurationfile and put your network name in thessidfield and your password into thepasswdfield. You can generally leave the other fields unchanged.$ dptrp1 wifi-add config.jsonSupported commandsYou can get a list of the implemented commands by runningdptrp1with no additional arguments. The most important commands for everyday use areregister,help,upload,download, andsync.You can get additional information about a specific command by callingdptrp1 help <command>, e.g.dptrp1 help sync.Note that the root path for DPT-RP1 is alwaysDocument/, which is misleadingly displayed as "System Storage" on the device. To download a document calledfile.pdffrom a folder calledArticlesof the DPT-RP1, the correct command isdptrp1 download Document/Articles/file.pdf.Registering the DPT-RP1The DPT-RP1 uses SSL encryption to communicate with the computer.  This requires registering the DPT-RP1 with the computer, which results in two pieces of information, the client ID and the private key. If you have used Sony's Digital Paper App on the same computer, the utility will automatically try to use the existing credentials. If you do not have the Digital Paper App, use theregistercommand.Registering without the Digital Paper AppIf you want to use a WiFi connection, make sure that the reader and your computer are connected to the same WiFi network. Some versions of the DPT-RP1 do not allow you to connect to a WiFi network from the device itself. In this case, use Bluetooth or USB first to configure the WiFi network (using thewifi-addcommand) or update the firmware (usingupdate-firmware).The tool can generally figure out the correct IP address of the device automatically, but you may also specify it with the--addr <address>option. If you're on WiFi, go toWi-Fi Settingson the device and tap the connected network to see the device's address. If you use a Bluetooth connection, it's likely172.25.47.1. You can also try the hostnamedigitalpaper.local. Use theregistercommand like seen below, substituting the IP address of the device.dptrp1 --addr 10.0.0.1 registerIf you get an error, wait a few seconds and try again. Sometimes it takes two or three tries to work.Mounting as a file systemThis Repository contains adptmountscript to mount the Digital Paper as a userspace mount. This tool has additional requirements.On macOS, install osxfuse (e.g. withbrew cask install osxfuse).On Linux, you may need to install libfuse.How to useCreate a yaml file with configuration details at~/.config/dpt-rp1.conf. You must specify either an address (withaddr) or a Device ID (withserial). All entries must be strings, the serial number must be wrapped in quotation marks.dptrp1:
  addr: 192.168.0.200
  serial: "50040222"
  client-id: ~/.config/dpt/deviceid.dat
  key: ~/.config/dpt/privatekey.datIf you register withdptrp1 registercommand, the client-id shall be $HOME/.dpapp/deviceid.dat, and key shall be $HOME/.dpapp/privatekey.dat. Mount the Digital Paper to a directory withdptmount --config ~/.config/dpt-rp1.conf /mnt/mountpointFinding the private key and client ID on WindowsIf you have already registered on Windows, the Digital Paper app stores the files inUsers/{username}/AppData/Roaming/Sony Corporation/Digital Paper App/. You'll need the filesdeviceid.datandprivatekey.dat.Finding the private key and client ID on macOSIf you have already registered on macOS, the Digital Paper app stores the files in$HOME/Library/Application Support/Sony Corporation/Digital Paper App/. You'll need the filesdeviceid.datandprivatekey.dat.What worksReading filesMoving files (both rename and move to different folder)Uploading new filesDeleting files and foldersWhat does not workCurrently there is no caching, therefore operations can be slow as they require uploading or downloading from the
device. However, this avoids having to resolve conflicts if a document has been changed both on the Digital Paper and
the caching directory.