-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Q: Is this still an active project to be used with HP Prime G2? #6
Comments
You could indeed try to build it on a current Linux distro, the code isn't supposed to contain weird constructs which ought to break with newer toolchains. |
So give me some time to check that. I will come back here and report, once I got that working. |
@gecko65 any updates? Is it still working? I'm till looking for something to base my own library on |
Your own use case might be different, e.g. embedded software / platform, but FWIW, nowadays, in order to maximize the usability for most end users, the best way to build software for [high-powered computer in the general sense] <- USB -> [graphing calculator, and many other USB devices] communication is to produce something based on WebUSB. The TI graphing calculators community has started doing that. Beyond a bit of glue code, WebUSB-based software needn't be written in JS / TS: various other languages can be targeted to WebAssembly :) |
Well, so funnily enough, that's what I'm trying to achieve (an actually usable ppl and python IDE in c# Blazor webassembly with webusb).but to do that I need a reliable baseline communication library that I can copy the protocol/details off of as reverse engineering the entire workings is just too enthusiastic of a goal haha Atm I have basic communication working (I can send a message to my prime) . But a working library will make life a lot easier. As even simple stuff like "how do I get a list of applications on the prime?" seems not too widely documented and any documentation spans over 8 years without any details on current status in modern firmware. (is it me or has the community on the prime died a bit? Such potential in this device, especially the G2) |
@BeatSkip Unfortunately so far I did not get it working. I could built it. But once I try to connect the calculator with my linux laptop teh program does not find any valid connection. |
I could see the hp prime G2 in the list of usb devices but hplp seams not to catch it. In the past I have had a sync problem with Palm and Linux. The solution was that first a initial transfer was needed with the Windows program and then the linux sync was able to communicate with the device. I know this is completely something different but maybe the hp prime also needs such an initialization for the communication? |
@gecko65 As i indicated before, i'm actually looking to bypass platforms entirely and go directly to Webassembly/Js with WebHID. Initial tests seem promising, as soon as i've got a basic proof of concept working i'll put up a public repo and leave a link here. you can keep an eye out for that if you're interested. currently i'm just using this code as a rough baseline indication and use PrimeComm as the actual basis to work off of as that seems to mostly be working with the G2 ( at least my tests for now seem to work). It's just that functionality in PrimeComm is very limited. |
@BeatSkip Yes I am in deed interested in the results of your future repo. |
@debrouxl Should I start an issue with the error/logging message of test_hpcalcs? |
I, too, experimented with this in 2020 because my plan was to directly connect a Prime via cable to an Apple iPad Pro's USB-C port. I wanted to make an app that was able to take screenshots from the Prime's screen into the iCloud Photo Library. – Never was successful with that. However, Cyrille de Brebisson – who was an HP Prime team member – was very open about technical details regarding the USB protocol and supplied me with details in emails. This was in March 2020. I'm quite sure he would be supportive today, too. Just wanted to drop this in, in case somebody needs help. |
@gecko65 : for the benefit of others, indeed, but first of all, try modifying the code ( libhpcalcs/src/hplibs.h & libhpcalcs/src/link_prime_hid.c ) to look for the USB PID indicated in the |
@metawops: would you be able to share the/some information from Cyrille? I don't know how easy it would be to reach him nowadays considering HP Prime development got transferred out of HP.
Although maybe Lionel got some from him already, but I'm not so sure. And that would have been much older than 2020.
|
@metawops that would definitely be great! I'm almost done setting up my base repo. Hope to get it live tonight with a working simple communication message from the browser and I'm planning on taking it from there. But an open source up-to-date communication platform is definitely something the prime needs to get it's community a bit more lively with more people. And input from the devs would definitely be appreciated |
@debrouxl Yes I also have a 0x2441 USB PID. I changed that in the code (thanks for you deatilled hint). The behaviour already changed but I still do not get something like a menu. I am still checking if I missed something. |
@debrouxl Ok got it working - at least now as root (1st step) I get the menu. Now testing the test functionality :) |
Good to hear that you can at least get the menu :) |
for those interested, i've got the repo up |
Let me try to reach Cyrille first (already sent out a ping) and check if it's okay to publish his infos here. When I asked him for those infos I promised I wouldn't publish it anywhere ... But I'll check old eMails, too, and see if we talked about this, too. Maybe he mentioned that it would be fine to publish it and I forgot about that. I'll report back with news. |
@debrouxl now sending a chat (Hello World) works. Receiving a chat works in the DUMP. I get a |
@BeatSkip : Yes as I already wrote I was able to send "chat" messages to the Prime. Receiving chat messages work only as a DUMP (need to check that). |
Not yet, unfortunately, no. |
@gecko65 getting the messages back is pretty simple in principle. It seems to me that the packet buffer is always 1024 bytes and any data after your message is just old data that hasn't been overwritten. So you can just discard that in your parsing. Still checking about any crc stuff that should be in the message. Edit: what seems weird to me is that your dump has the third byte as 0x01 but for me it is always 0x03, unsure what that is about |
@BeatSkip I also did identify So far it seams my messages are cut, if the datagram exceeds 64 bytes. The longest messagte I was able to SEND as paylaod was 30 characters (in UTF-3 This are 60bytes). |
For a received message "789456123" I get |
@gecko65 I have no such limitation, i can send a full string as long as i want. just tried to send over 2000 characters. and for return i can receive long strings fine too. |
Get Info from prime has the following format Sending time and date has the following format Get a screenshot begins with Get a backup Example for send Key |
@BeatSkip Which firmware version do you have? |
FWIW, back in the day, I could reliably transfer multi-kilobyte-sized variables. For a long time, TILP has unconditionally redirected terminal output to a file on Windows for the same reason as hplp, namely the slowness of the classic Windows terminal. With TI graphing calculators in USB vendor-specific class using USB bulk transfers, terminal slowness does not adversely affect transfer reliability; with the Prime in HID mode using USB interrupt transfers, it clearly did... You can see occurrences of that 0x03 byte value in PR #4 . |
@debrouxl aha, so hplp does account for the 0x03, then it's just PrimeComm that's looking for the 0x01. but it seems that apart from my bug in packet splitting, i can just transfer multi-kilobyte packets without issue. |
Even though it's very old, maybe https://tiplanet.org/hpwiki/index.php?title=HP_Prime/Linking_Protocol could be updated? |
@adriweb yeah, from what I gathered around there's a tonne different with the modern protocol. That document is last updated in 2013 |
Oh, come on, please not on a TI website! 🤦♂️ There‘s plenty of HP calculators dedicated websites like hpcalc.org or hpmuseum.org (has a forum) or the Wiki at www.wiki4hp.com/doku.php?id=prime:start, to name just a few. |
When this was created, there was nowhere else to actively talk about the Prime, much less in a good wiki (mediawiki-based, anyway) way. |
@adriweb you are totally right, it seems to me that that little bit of community that the hp prime had is slowly bleeding to death. And honestly I think that is at least partially due to the fact there is so little and vague documentation and absolutely no good tooling to make the prime do what it's capable of. That's what I'm trying to fix with at least proper tooling. Hopefully it'll live up a bit when more people have easy access to their calculator. Just sad that the 'risk of influencing the examn mode' chokehold is limiting any progress, while I'm just toying with my hardware as an engineer. |
Besides, that very wiki4hp page links to the TI-Planet hpwiki , both the root page and the USB protocol page :) Your goal is laudable, but you probably know that you're facing a huge uphill battle creating significant activity for the Prime series' superior hardware and good, in some aspect superior software ;) |
@debrouxl oh yes, I know it'll be pretty much impossible to bring life into it. but als long as i see it as a fun and interesting challenge to make this tooling and some people appreciate the result. that's good enough for me :) even if it's just me appreciating a better tool, that's also fine haha |
@gecko65 what's your current status? Just got multi-part compressed messages via the newer protocol working! The newer protocol is mostly a wrapper around the old protocol with some additional checking and acknowledgements. Now working on the actual commands and features running on the protocol. |
@debrouxl if you are interested in maybe adding some newer features to your library, I can give you some explanations about the newer protocol. Still working out some final details on the CRC checking and I'll eventually document it. But that may take some time. |
Guys, I was thinking ... wouldn't it be way cooler to have a VSCode Extension that allows us to freely write code for the HP Prime (and maybe even later other HP calcs, like the 48/49/50 series) with syntax highlighting and transferring it to/from the physical calculator? With enough effort I think even the full functionality of the HP Connectivity Kit could be integrated into VSCode. Just a proposal ... |
@metawops well, so that's pretty much what I'm going for. But then without vs code, no installation, no drivers, in your browser. Same text editor as vs code (Monaco editor also has a Web based version). Basically connectivity kit + ide with just opening a link. And native install with one click possible as pwa :) |
Yeah. But not inside VSCode which is THE code editor of tons of developers already. Plus, you have to code things like syntax highlighting yourself, from scratch. While in VSCode you'd define a language description and that's it. I have VSCode open all the time and when I decide to write a little HP Prime program I'd have to switch to the web browser and open a new URL. |
The thing is that when a stand-alone thing is ready and works as expected, then it can be used to make other things, including, why not, a component of an IDE extension, sure :)
|
Exactly. It may be possible, even easy, to shoehorn a library for WebUSB-based communication (preferably JS/TS for WebUSB glue code, and another programming language which can be targeted to WebAssembly) into a VSCode extension, but said standalone library needs to exist first. Tons of other developers do also prefer code editors not based on heavyweight Web technologies :) |
@debrouxl you're right, it's trivial to port my code over to work on a native platform and make a VScode extension for example. I'm planning on separating my web based code editor project and the actual prime communication library once i'm at a working alpha state. (they're already separate projects, just in the same git repo). |
Nowadays, C# has better portability than it had in the mildly distant past, as long as one does not use OS-specific calls, obviously, be them for Windows or other OS. And yeah, multiple projects in the same Git repo are easier to handle in the beginning than multiple repos and submodules, they can be split to separate repositories later as time permits and the rate of change decreases. |
@debrouxl yeah, I used to be full on c++ for platform flexibility and performance. But c# is going places and the ease is so convenient! |
Might I suggest moving this discussion over to the discussion board on my repo? As I do like the ideas and input. And I think the issue here has pretty much been solved right? Haha |
Although @debrouxl do you happen to know what's happening with the screenshot png header bug in the communication? From the de compilation of the connectivity kit I've extracted debug strings noting there is a bug and it seems the connectivity kit does something to fix the header (and colors). But do you know what? |
All I might have known about screenshot-related weirdness is in libhpcalcs/src/prime_cmd.c::calc_prime_r_recv_screen() :) |
Hello guys, It looks like you are having some great fun :-) but you might save yourself some frustration getting info directly from the horse's mouth, so to speak! I have not spent the time reading all the communication going on in the various threads, but if you have specific questions, I would be more than willing to help you answer them. Cyrille |
Aha! great to have you here @Cyrille-de-Brebisson! Well, i happen to have a couple questions for you.
edit: this turned out to be a bug in my back and forth acking with the protocol. now it dumps out everything as expected! edit2: I can't seem to get the compression right. anything special going on? decompression of data dumps works fine, but actual compression of content doesn't seem to go happily. i'm using regular zlib deflate/inflate (with zlib header) to compress/decompress. Note this is all with G2 calculator on build 14603 all the code is at: note: still very much a mix and match between different libraries and sources, still dilligently rebuilding everything into a neat state, so code readability is horrible and jumping around between classes is still very much a thing, As I've only been working on this project for the last two weeks or so outside my day job as mech. engineer. |
Hello, This is all VERY old to me, so please accept my excuses if I mess up!
Well, there are a LOT of issues in the whole screen send. But most of the issues come from the fact that multiple color schemes are used by various part of the SW. Some time it is RGB, sometimes BGR... Depending on the header type, it might be one or the other! sorry about that. I attched some code for you to look at...
This is the structure of said packet. Hope that this helps. apparently, the 3rd byte has no meaning on an ack...
Here is the code that is a responce to the 0xf9 command: // send config settings IOSendFile(epid, CALCSettings, OTNone, false, false); wchar_t name[MaxAppNameSize]= L"\0\0"; //// Send List //// Send Matrix //// Send Programs //// Send Notes // send Test Mode configurations /// Send Apps //// termination - this let's the CK know "end of data" Strangely enough, I thought that it was changed to send a zip at some point... but I do not remember...
#define IOPROT_GETIO_VERSION 253 // handle a return of multi byte IO protocol version packet information (switch to newer protocol or similar)
I do not remember, sorry!
I do have a flush on first connection from memory, specifically to handle that type of issues... Keep the questions going, I will try to keep answering them... Cyrille |
@Cyrille-de-Brebisson thanks for the info! Sure helps, if there is more I'll let you know. One question, do yo happen to know anything on the current state of development on the prime? edit: the backup mode now starts when it receives the actual ACK from the backup request and stops when the last backup done message comes in, just to make sure the backup is nice and complete. |
@Cyrille-de-Brebisson I've got all the communication working now and the code editor is implemented. I'm just having trouble decoding the apps. I've managed to reverse engineer where all the sections in the apps that are sent over are sliced. So I have separate files. But I'm struggling with the header contents of the 'hpapp' file and related specific files. Where the lengths of the filenames inside the programs are encoded etc. And what exactly I need to re-encode in the headers when I want to send back a modified app |
Hello, Well... problem here... But if you want, indeed, to decode apps, it will be a lot of work! For example, this describes the persistance stuff for the finance app... const DATATYPE::Numb::TThisPersistedType DATATYPE::Numb::persisted_type = So, each "item" in the file starts with a 32 bit stuff which has that format... Cyrille |
Sorry more a question then a error report. Is that still an active project I? I would try to build it on a current Linux dist.
The text was updated successfully, but these errors were encountered: