Post Reply 
HP Prime and Raspberry Pi?
03-02-2020, 07:46 PM
Post: #1
HP Prime and Raspberry Pi?
Hi all!

Because I‘m almost always using my iPad Pro (with USB-C connector) these days as my main computer I‘d like to be able to write tutorials etc. in Pages or another writing program. I‘m happy that we have the HP Prime TrueType® font that I installed on my iPad Pro. But a good tutorial needs to have screenshots, too.
Granted, there‘s the „virtual“ HP Prime i[Pad]OS app I could use for screenshots. But (a) I‘d like to have a crisper & overall better quality and like to get the Prime‘s frame buffer pixel data directly and not via the iPadPS screenshot functionality. And (b) I already own four HP Primes – why spend another 27 Euros? ?

But most of all: I‘m a geek and I want to know how to communicate with the Prime over its USB connector! When on the road. Without a Windows, macOS or Debian/Ubuntu laptop.
(Because connecting the HP Prime directly to the iPad Pro wouldn‘t help: Apple only allows devices that are MFI-certified to be connected so that you can talk to them as a developer in an app. The Prime, of course, isn‘t MFI-certified.)

I did a fair amount of research and if you do this you stumble upon this reverse engineering marvel and this GitHub repository.
However, that‘s rather old software and it doesn‘t work with any of my Primes (beta test unit, hardware A, C and D).

I managed to compile this software on one of my Raspberry Pis (model 4). And the nice thing is that you can connect a RasPi4 directly via USB-C to an iPad Pro and talk via ethernet to it. See here in case you‘re interested. – And for the German speaking friends: I recently recorded a podcast episode around the RasPi and the iPad, it‘s here.

So I can travel or sit in a cafe with my iPad Pro and my RasPi4 and my HP Prime. Now how would I make a crisp and sharp screenshot directly from the hardware Prime? Has anyone gone further than the hplp software above? Listing the usb devices on the RasPi and getting all the descriptor data and monitoring what happens when you connect and disconnect it is no problem. It‘s a HID device and there are tools (like this) to talk to a HID device. I even added a udev rule so that my Primes (all 4 models; reporting different product names) all get a symlink in /dev as /dev/hpprime.

But I don’t want to spend the effort to scan through all the source code with heavy C pointer arithmetics and stuff to rewrite it for today‘s HP Primes.

Nobody ever did something in that field since then? Am I the only one who‘s interested in this use-case? Am I weird?

And I assume there‘s no official RasPi (so ARM-based) Linux commandline tool for some basic tasks like getting a screenshot from the Prime, sending a file/program, Tim? I‘m not even talking about doing firmware upgrades! That‘s a rare task and can surely be done with a Mac or Windows computer.

Any hints greatly appreciated.

Thanks!
Stefan.
Find all posts by this user
Quote this message in a reply
03-03-2020, 08:02 AM
Post: #2
RE: HP Prime and Raspberry Pi?
Hello,

It is clearly possible to get a screen shot (png compressed) from a Prime through the USB connector...

The con kit has the feature of course... But you do not have HW there that can run said con kit...

I do not remember it having a screen capture tool in the IPad Prime version either...

So, yes, with the HW that you have at your disposal, you end up having to cludge something together...

The "easiest", would be a re-implementation of the Prime USB protocol part that deals with the screen capture...

It is, in theory, not that complicated, BUT the code that we have is VERY heavely dependent on the whole Prime SW stack being present, which makes it hard to extract just one feature...

So, yes, it is doable, BUT, should you decide to go forward with it (and I can provide you with information/documentation), it will be a non negligible amount of work...

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
03-03-2020, 01:02 PM
Post: #3
RE: HP Prime and Raspberry Pi?
(03-03-2020 08:02 AM)cyrille de brébisson Wrote:  So, yes, it is doable, BUT, should you decide to go forward with it (and I can provide you with information/documentation), it will be a non negligible amount of work...

Dear Cyrille,

that sounds promising. I'd really love to learn more about the Prime USB protocol.
However, I'm totally new to this field (USB communications). My naive approach would be: I send a certain sequence of bytes to the /dev/hpprime HID device ("please send a screenshot") and get a number of bytes in return (the PNG file). But is it that easy?
Also, could this be implemented in Python? It should, right? As long as we have a way in Python to send and retrieve data to /dev/hpprime (originally it's /dev/hidraw0).

Maybe we continue via DMs?

Thanks,
Stefan.
Find all posts by this user
Quote this message in a reply
03-03-2020, 06:10 PM
Post: #4
RE: HP Prime and Raspberry Pi?
Sounds like a cool project, not my area of expertise though (USB comms).

This thread spurred me to finish a screen capture app that I was working on previously. The idea would be to capture screens as you're working using a User Defined key combination, then connect your calculator to the Connectivity Kit later to copy all the PNG files to some folder on your computer.

Hope the ReadMe.txt file in the attached folder is sufficient to explain how to install and use the app.

Thanks to Cyrille for a hint that made finishing this app possible.


Attached File(s)
.zip  ScreenCap.zip (Size: 54.15 KB / Downloads: 9)
Visit this user's website Find all posts by this user
Quote this message in a reply
03-03-2020, 08:14 PM
Post: #5
RE: HP Prime and Raspberry Pi?
That hplp on GitHub claims to support screen captures but with the wrong colours:

Code:

The code base does:
...
  * receive screenshot;
...

The code base doesn't:
* perform color conversion on PNG screenshots (libhpcalcs should use libpng to
  uncompress the files, mangle pixels, and recompress to PNG);

— Ian Abbott
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)