Giter Site home page Giter Site logo

dpt-rp1 / digitalpaperapp Goto Github PK

View Code? Open in Web Editor NEW
11.0 4.0 1.0 28.84 MB

Java port of https://github.com/janten/dpt-rp1-py

License: MIT License

Java 62.49% Shell 0.53% C 0.40% HTML 0.06% Batchfile 0.15% Smali 33.92% Makefile 0.02% Ragel 0.16% GAP 1.79% Lex 0.22% Jasmin 0.16% ANTLR 0.11%
dpt-rp1 digital-paper cups-driver deb debian linux

digitalpaperapp's Introduction

dpt

Inspired by https://github.com/janten/dpt-rp1-py

Script to manage Sony DPT-RP1 without the Digital Paper App.

This repository includes:

  • a Java library
  • a command line utility to manage documents on the DPT-RP1
  • a CUPS driver to use the DPT as a printer
  • a FUSE mounter to navigate the dpt as a disk on a userspace mount-point
  • a server to proxy whiteboard refreshes to a webpage (dpt whiteboard-html) you can share with people
  • a translation (more and more complete) of the official endpoint documentation at doc/endpoints.json
  • a packaging script to create a .deb package at debian/makedeb.sh

How you can contribute

  • I'd love to have people testing this on Windows
  • Building an rpm and a mac pkg
  • Testing the CUPS driver on many more archs

Installation

You can install on debian using the deb package at https://github.com/xpierrohk/DigitalPaperApp/releases

# apt install dpt_<version>.deb 

Run dpt or man dpt to get more information.

From Source

To install the library from the sources, clone this repository, then run mvn clean install from the root directory. The use the script in install/linux.sh to setup up the dpt command in your home folder.

Using the command line utility

Type dpt --help to find all the possible options:

dpt is an utility to manage a Sony Digital Paper device

Usage: dpt COMMAND [PARAMETERS] [OPTIONS]

Options that can be passed to every commands, but aren't mandatory to find the device:
  -addr=IP_ADDR                                               ip address of the DPT
  -serial=SERIAL                                              serial code of the device

Available commands:
  register                                                    Starts the pairing process with the Digital Paper
  ping                                                        Tests the connection with the Digital Paper
  sync [local-sync-folder] [-dryrun]                          Synchronizes a local folder with the Digital paper. If no folder is given, it will use the one passed previously
  list-documents                                              Lists all documents
  document-info                                               Prints all documents and their attributes, raw
  upload local-file [remote-file]                             Sends a local file to the Digital Paper
  download                                                    Downloads a remote file locally
  move source target                                          Moves a document on the device
  copy source target                                          Copies a document on the device
  new-folder remote-folder                                    Creates a new folder on the device
  delete-folder remote-file                                   Remove a folder on the device
  delete remote-file                                          Deletes a file on the device
  print local-file                                            Sends a pdf to the Digital Paper, and opens it immediately
  watch-print local-folder                                    Watches a folder, and print pdfs on creation/modification in this folder
  screenshot png-file                                         Takes a PNG screenshot and stores it locally
  whiteboard [-orientation] [-scalingFactor]                  Shows a projection of the digital paper, refreshed every second, orientation=[portrait|landscape],
                                                              the scaling factor is a multiplier of the resolution (0.5 by default)
  whiteboard-html                                             Opens a distribution server with /frontend path feeding the images from the Digital Paper
  dialog title content button                                 Prints a dialog on the Digital Paper
  get-owner                                                   Displays the owner's name
  set-owner owner-name                                        Sets the owner's name
  wifi-list                                                   Lists all wifi configured on the device
  wifi-scan                                                   Scans all wifi hotspot available around the device
  wifi-add                                                    Adds a wifi hotspot (obsolete since the latest firmware)
  wifi-del                                                    Deletes a wifi hotspot (obsolete since the latest firmware)
  wifi                                                        Displays the current wifi configured
  wifi-enable                                                 Enables the wifi network device
  wifi-disable                                                Disables the wifi network device
  battery                                                     Shows the battery status informations
  storage                                                     Shows the storage status informations
  check-firmware                                              Check if a new firmware version has been published
  update-firmware [-force] [-dryrun]                          Check for update and update the firmware if needed. Will ask for confirmation before triggering the update. Use -dryrun to test the process.
  get url                                                     Sends and displays a GET request to the Digital Paper
  mount [mount-point]                                         FUSE-mounts the DPT at the specified mount point. If not mount point is specified, it will attempt to use the one passed previously
  insert-note-template name path                              Inserts a new note template from the specified file, with the specified name
  get-configuration path                                      Saves the system configuration to a local file at <path>
  set-configuration path                                      Sends the system configuration from a local file at <path>
  root [-dryrun]                                              Roots the device
  diag fetch remote-path local-path                           Downloads a file from the diagnostic mode, after root. See doc/diagnosis_mod_map.md
  diag exit                                                   Exits the diagnostic mode (triggers a reboot)
  unpack pkg target-directory                                 Unpacks an update pkg file into a data and animation archives
  adb list-extensions                                         Lists all extensions installed on the Digital Paper
  adb fetch-extension name local-path                         Retrieves extension descriptors as returned by dpt adb list-extensions
  adb setup-extension name component action icon-path         Setup an extension (apk intent launcher) for the official app launcher.
  adb remove-extension name                                   Removes a user-space extension, do not use to delete offical apps.
  adb install-apk local-path                                  Installs an APK and enables it in the launcher
  help                                                        Prints this message

Disconnected from the target VM, address: '127.0.0.1:40211', transport: 'socket'

Process finished with exit code 0

Registering the DPT-RP1

The 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 key file -- that you'll need to run the script. You can get this information in three ways.

Registering without the Digital Paper App

This method requires your DPT-RP1 and your computer to be on the same network segment via WiFi, Bluetooth or a USB connection. The USB connection works on Windows and macOS but may not work on a Linux machine. If your WiFi network is not part of the "Saved Network List" (for example if you don't have the app), you can still use the DPT-RP1 as a WiFi access point and connect your computer to it.

register

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 to Wi-Fi Settings on the device and tap the connected network to see the device's address. If you use a Bluetooth connection, it's likely 172.25.47.1. You can also try the hostname digitalpaper.local. Use the register command like seen below, substituting the IP address of the device.

--addr 10.0.0.1 register

If you get an error, wait a few seconds and try again. Sometimes it takes two or three tries to work.

Finding the private key and client ID on Windows

If you have already registered on Windows, the Digital Paper app stores the files in Users/{username}/AppData/Roaming/Sony Corporation/Digital Paper App/. You'll need the files deviceid.dat and privatekey.dat.

Finding the private key and client ID on macOS

If 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 files deviceid.dat and privatekey.dat.

Fuse mount

You can mount the dpt on a userspace mount point with the following:

dpt mount <mountpoint> 

The mount point is then browsable, and you can read, copy, rename, delete files and folders.

What is not supported yet:

  • Getting changes from the dpt after the mount point has been created.

For now the file cache is aggressive, in the sense that all files and folder trees are precalculated, changes you do via the mount point are taken into account, but changes from the dpt or another source will not. Furthermore, the content of files are cached the first time they're accessed, and the mounter will consume more and more memory as you open files around.

Usage

--addr 192.168.0.107 register
--addr 192.168.0.107 ping

digitalpaperapp's People

Contributors

dependabot[bot] avatar xpierro avatar xpierrohk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

jesuslop

digitalpaperapp's Issues

DPT not working any longer

I have not been able to use DPT commands in recent months. Would you be able to run anew release, please?

Whiteboard display rotated 90

The whiteboard function display is rotated 90 degrees clockwise. I see in Whiteboard.java that this is intentional, but it does not work for how I would use it. Perhaps provide an option to not invert width and height?

Unable to upload/print

Printing/uploading files on version 1.0 works, but on versions 1.1 and 1.2 fails with errors:
:~$ dpt print Smith.pdf
Printing Smith.pdf to Document/Received/Smith.pdf on the device
A device exception occurred: 40401 : The designated resource was not found.
net.sony.dpt.error.SonyException: The designated resource was not found.
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at com.fasterxml.jackson.databind.introspect.AnnotatedConstructor.call(AnnotatedConstructor.java:119)
at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createUsingDefault(StdValueInstantiator.java:270)
at com.fasterxml.jackson.databind.deser.std.ThrowableDeserializer.deserializeFromObject(ThrowableDeserializer.java:149)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:159)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4014)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3005)
at net.sony.util.JsonUtils.fromJSON(JsonUtils.java:19)
at net.sony.dpt.network.CheckedHttpClient.checkString(CheckedHttpClient.java:62)
at net.sony.dpt.network.CheckedHttpClient.getWithResponse(CheckedHttpClient.java:27)
at net.sony.dpt.network.DigitalPaperEndpoint.resolveObjectByPath(DigitalPaperEndpoint.java:114)
at net.sony.dpt.command.documents.DocumentCommand.delete(DocumentCommand.java:34)
at net.sony.dpt.command.documents.DocumentCommand.upload(DocumentCommand.java:69)
at net.sony.dpt.command.print.PrintCommand.print(PrintCommand.java:80)
at net.sony.dpt.ui.cli.DigitalPaperCLI.print(DigitalPaperCLI.java:380)
at net.sony.dpt.ui.cli.DigitalPaperCLI.execute(DigitalPaperCLI.java:251)
at net.sony.dpt.DigitalPaperApp.main(DigitalPaperApp.java:35)

java.io.IOException: No subject alternative names present

I'm running the command dpt ping -addr=192.168.XX.XX (or any other command) and it fails with the given exception. Oddly enough, I manage to register it using dpt register -addr=.... No idea what can cause the problem. It is using the latest firmware.

UPDATE: I get the same exception if I remove -addr=

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.