Author Topic: pacspire - A simple package manager for the TI-Nspire/Ndless (WIP)  (Read 58088 times)

0 Members and 1 Guest are viewing this topic.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: pacspire - A simple package manager for the TI-Nspire/Ndless (WIP)
« Reply #15 on: August 09, 2013, 09:33:26 am »
Will you do the same for other calculator models?
Not sure it is a good idea. Take the example of the 83+ (and sorry if I take the examples of my games but those are the ones I think of first).
-To install RainbowDashAttack, you have to send one file. No need for a package installer.
-For Pokemon Topaze, you have to send tons of files. It is not really hard to put them all in archive as the readme says, but maybe you're right, it is easier to put one file in archive. However, that would make a 40KB installer installing 40KB of data. Maybe the installer would "only" take 10KB with utopic-style compression, but that is still 10KB, and in a 83+, that is a lot, so not a good idea.
-other problem: you'll have to compile your installer as an app if you want a lot of data to fit in, and that is not the easiest format to deal with.

I think the Nspire was "chosen" because it (usually) has enough space to support the installer, the package and the installed program at the same time.
that could work for the Prizm too I guess.


Anyways, great work Compu, that will surely help people installing their programs. I think there should be (if not already present) a way to decide if the installation is done in a specified folder (for in-dev programs that still don't support to be in any folder or don't support their dependencies to be in random folders, or for programs that must be in startup) or in a folder that the user would choose (for programs that can be run from any folder and that the user would like to put in the Game folder for example).
« Last Edit: August 09, 2013, 09:33:52 am by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline compu

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 275
  • Rating: +63/-3
    • View Profile
Re: pacspire - A simple package manager for the TI-Nspire/Ndless (WIP)
« Reply #16 on: August 09, 2013, 09:36:11 am »
An app store would indeed be nice, but who will do the work of setting it up, maintaining it in the long-term, and sifting through old programs for re-packaging them ?
Maybe Linux style repos ? This way devs maintain their stuff themselves and it's pretty easy to set up (you just need an HTTP server and there are plenty of free hosts). ;)
Why not a simple Web UI for submitting and updating apps?
That's what I was thinking of + a command-line client that downloads packages and sends them to the calc (I guess that would be possible with libti*?).

Great! If you want to, I could help :D
Sure, why not :)

Quote
But if I click on tworld.pcs.tns again, it says 1.3.0 would be newer than my installed version 1.3.0, but in the log file it states otherwise xD
Quote from: dialog
The installed version of tworld (1.3.0) is newer than the one you are trying to install (1.3.0). Continue?
Quote from: logfile
checking if the package is newer than the installed version... no
It actually says the same, but "installed version" and "package" are interchanged... I should probably change that :D

The [great, in my option] idea of an Nspire App-Store has been in mind of several people for quite some time, yet nothing has been done on that path :P
It could be coupled with some remote control software to automatically extract/isntall/launch whatever. nRemote for example can do that quite easily with its "script" support.
Thanks, I will take a look at nRemote, but if it doesn't work on Linux as Vogtinator says, it probably won't be an option.

Damn, I was ninja'd 4 times writing this post...

Anyways, great work Compu, that will surely help people installing their programs. I think there should be (if not already present) a way to decide if the installation is done in a specified folder (for in-dev programs that still don't support to be in any folder or don't support their dependencies to be in random folders, or for programs that must be in startup) or in a folder that the user would choose (for programs that can be run from any folder and that the user would like to put in the Game folder for example).
Thanks!
Selecting a folder should be pretty easy to add.

EDIT:
Here is a small gif to show the installation process.
« Last Edit: August 09, 2013, 10:48:45 am by compu »

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: pacspire - A simple package manager for the TI-Nspire/Ndless (WIP)
« Reply #17 on: August 09, 2013, 10:50:59 am »
Anyways, great work Compu, that will surely help people installing their programs. I think there should be (if not already present) a way to decide if the installation is done in a specified folder (for in-dev programs that still don't support to be in any folder or don't support their dependencies to be in random folders, or for programs that must be in startup) or in a folder that the user would choose (for programs that can be run from any folder and that the user would like to put in the Game folder for example).
Thanks!
Selecting a folder should be pretty easy to add.
Sorry, I may have used too much parentheses or used a not understandable enough English, so there is a part of my request that you didn't see.
-I was indeed asking for a "folder selection menu" or something.
-But also a way for developers to force the "unpacking folder", so that a program that must be put in "startup" will always be put in startup (doesn't ask the user where to unpack), or so that a program that is still in-dev and that must be ran from the Ndless folder (and nowhere else) will be unpacked in the Ndless folder.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: pacspire - A simple package manager for the TI-Nspire/Ndless (WIP)
« Reply #18 on: August 09, 2013, 10:54:03 am »
Why not a simple Web UI for submitting and updating apps?
That's what I was thinking of + a command-line client that downloads packages and sends them to the calc (I guess that would be possible with libti*?).
I just tried to read the libticalcs2 HTML-documentation and it seems so outdated, that "nspire" isn't mentioned one singe time.
But as tilp runs fine and some files in src begin with nsp_*, I think it's the right library in the right version.
So is tilp the only reliable source for documentation?
And I wonder why there are four libti* librarys. In my opinion it would have made more sense to combine them into one libticalcs..

Quote
Great! If you want to, I could help :D
Sure, why not :)
I'll try setting up a small application which sends a file to the calculator and maybe even executes it.
Quote
The [great, in my option] idea of an Nspire App-Store has been in mind of several people for quite some time, yet nothing has been done on that path :P
It could be coupled with some remote control software to automatically extract/isntall/launch whatever. nRemote for example can do that quite easily with its "script" support.
Thanks, I will take a look at nRemote, but if it doesn't work on Linux as Vogtinator says, it probably won't be an option.
Even with WINE it doesn't. It needs the navnet device driver installed. TINCL shows a splash screen and then it exits with "Connectivity Library is missing".

How should the calculator and the App Store play together? Should the store extract the archive and send all the files or should the appstore send the package to the calculator and start pacspire to install it? The latter sounds better in my opinion, but I think it'll get close to impossible, as pacspire can't communicate with the appstore in any ways except screenshots and files (and that only if no ndless app is running!)  :banghead:

Offline compu

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 275
  • Rating: +63/-3
    • View Profile
Re: pacspire - A simple package manager for the TI-Nspire/Ndless (WIP)
« Reply #19 on: August 09, 2013, 11:12:32 am »
Sorry, I may have used too much parentheses or used a not understandable enough English, so there is a part of my request that you didn't see.
-I was indeed asking for a "folder selection menu" or something.
-But also a way for developers to force the "unpacking folder", so that a program that must be put in "startup" will always be put in startup (doesn't ask the user where to unpack), or so that a program that is still in-dev and that must be ran from the Ndless folder (and nowhere else) will be unpacked in the Ndless folder.
forcing an installation folder is easy as well and could be added to the pkginfo.txt, but I'd like to have another solution:
Putting all resources/executables in one central folder with subdirectories for each package (that could be outside of the /documents/ folder) and put something like shortcuts into the Documents folder.
The same could be done with the startup folder: just put a shortcut in there and it wouldn't matter where the program is actually located.
Since r820 Ndless has the function enable_relative_paths() so programs shouldn't care about the location of their resources (as long as programs are adapted to use this function, which is pretty easy).
Well, let me know what you think. But I think this would be easier when we are turning pacspire into a fully-fledged package manager.

I just tried to read the libticalcs2 HTML-documentation and it seems so outdated, that "nspire" isn't mentioned one singe time.
But as tilp runs fine and some files in src begin with nsp_*, I think it's the right library in the right version.
So is tilp the only reliable source for documentation?
And I wonder why there are four libti* librarys. In my opinion it would have made more sense to combine them into one libticalcs..
Yup, I only found outdated documentations as well. Maybe, Lionel, if you are reading this... :P

Quote
I'll try setting up a small application which sends a file to the calculator and maybe even executes it.
Nice :)

Quote
Even with WINE it doesn't. It needs the navnet device driver installed. TINCL shows a splash screen and then it exits with "Connectivity Library is missing".
:/

Quote
How should the calculator and the App Store play together? Should the store extract the archive and send all the files or should the appstore send the package to the calculator and start pacspire to install it? The latter sounds better in my opinion, but I think it'll get close to impossible, as pacspire can't communicate with the appstore in any ways except screenshots and files (and that only if no ndless app is running!)  :banghead:
I'd let pacspire do the work. Some posts ago Lionel said libticalcs has support to send keystrokes, maybe that would work somehow? ;D

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: pacspire - A simple package manager for the TI-Nspire/Ndless (WIP)
« Reply #20 on: August 09, 2013, 11:22:44 am »
But doesn't nRemote use the mysterious NavNet.jar to interface with the Nspire windows driver?
That would make it completely useless to me, as I'm using Linux.
But doesn't nRemote use the mysterious NavNet.jar to interface with the Nspire windows driver?
That would make it completely useless to me, as I'm using Linux.
Same here. libti* supports this functionality though as Lionel stated a few posts up. ;)

Yes sure, but at least it will function directly and more quickly (no install time, I mean) for those on windows (and mac) with TINC[L]S installed, with no need of filter driver and such because of that crappy windows roadblock...
For Linux obviously libti* is the choice as it's easy to use there (and, well, is the only one).
Remember the main point here, whatever the choice : it has to be extremely simple for the user (no installation would be great)

And, also, let's not forget that if such App-Store project comes to life, it'll have to be for all .tns of course (there are tons of TI activities that could use this, but also Lua scripts, and duh, the ndless programs (especially those with external resources), so if it ever gets popular (who knows :P), the majority of users will be PC, then Mac, then Linux (and the order of file type will be TI BASIC things, then the Lua stuff, then the ndless stuff...)

Also, it'd be good to have such a program linked to the major community repos (ticalc, omni, tiplanet, cemetech...)

Anyway, interesting ideas :)


Also : nice gif compu :)
« Last Edit: August 09, 2013, 11:25:56 am by adriweb »
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: pacspire - A simple package manager for the TI-Nspire/Ndless (WIP)
« Reply #21 on: August 09, 2013, 11:30:36 am »
Quote
So is tilp the only reliable source for documentation?
The documentation of libti* was already incomplete / partially outdated when I became the maintainer, and (with the help of contributors) I have focused more on the code (which needs bugfixes, feature expansion and hardening) than on the documentation (all the more libti* have relatively few users, and documentation of the API has pretty little user-visible effect, eh ?), so yeah, the source code of the libraries and testcases is your best bet. You're coders as well, after all ;)
Have a look at libticalcs (calc_xx -> calc_nsp -> nsp_cmd -> nsp_vpkt -> nsp_rpkt) and the testcase, libticables (link_xxx -> link_usb) and the testcase, TILP (especially tilp_calcs.c), titools. The testcases and titools are about as bare-bones as you can get.

One of the NavNet JARs (don't remember which one) contains the 3-byte key code definitions. Adriweb, remind us which one ;)
BTW, libticalcs contained support for Nspire remote control before nRemote was released, though I used a beta version of nRemote in a Windows VM to debug and fix my implementation of the feature through sniffing USB packets.

Quote
And I wonder why there are four libti* libraries.
Actually, for the combination of TI-Z80, TI-68k and Nspire, four libraries is not enough ;)
There's a clear need for a fifth library on top of the four current ones, so as to consolidate some code currently duplicated, with variations, across clients (TILP, TIEmu, TilEm, titools). I started creating it locally, though it contains pretty little.
The whole libti* framework looks complex and seems to have deep nesting of functions, but after a while maintaining the code base, I realized that for the purposes of presenting a single, mildly abstracted API to clients (instead of at least three sets of APIs with significant overlap, due to TI-Z80/TI-68k/Nspire, DBUS/DUSB/NSP, and some commonalities between TI-Z80 and TI-68k), it's not easy to do simpler. Just follow the call chains I outlined above - there's a use for each file, in the complete framework :)

Quote
In my opinion it would have made more sense to combine them into one libticalcs.
It's equally clear that for the narrower purposes of interacting with the sole Nspire series, four libraries are far too much, and you're completely right about a single library making sense:
* libticonv deals with character conversion, which is necessary on TI-Z80 and TI-68k models, but the Nspire uses Unicode (and conversions can be handled more directly by other frameworks);
* libtifiles deals with file types... but the Nspire has very few of them, unlike the TI-Z80 and TI-68k series;
* libticables deals with multiple cables... most of which don't work on modern computers due to lack of the physical interfaces, and the Nspire uses a single cable type;
* libticalcs deals with the raw DBUS, DUSB and NSP protocols and transport protocols built on top of them.

On my Github, you'll find a one-off experiment of a few hours, where I fused libticonv, libtifiles, libticables, libticalcs and tilp into a single code base (I probably should have let libti* on the one side and tilp on the other side, but oh well), shaved most code related to TI-Z80 and TI-68k calculators. Doing so slashed the size of the code base by more than half (~78K RLOC -> <35K RLOC). I didn't bother thoroughly purging the code base, there remain some bits directly aimed at TI-Z80 or TI-68k series and some APIs which are not necessary for dealing with the Nspire series.
I didn't merge developments from mainline since I created that one-off experiment. With several months of full-time paid work, it would be possible to make a fresh API, simplified from the current one while keeping the good bits, tailored to Nspire interaction, replacing Glib with C++11/STL, making a whole new Qt UI on top of it (GTK+ is falling out of favor), making a solid up-to-date documentation, etc... but who can afford that kind of luxury, all the more it's for the benefit of relatively few users ? At least, I cannot ;)

Quote
Even with WINE it doesn't.
USB support in Wine is in the "TODO" group, anyway.

Quote
Remember the main point here, whatever the choice : it has to be extremely simple for the user (no installation would be great)
Well, the "no installation" part is not going to happen, especially on Windows, due to the "everything USB needs a driver, which in turns requires admin privileges for installing" behaviour. On the day the two main FLOSS Web browsers (Firefox and Chrome) start providing an interface to USB peripherals on the host (notwithstanding the severe security problems), maybe...
« Last Edit: August 09, 2013, 11:46:03 am by Lionel Debroux »
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline compu

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 275
  • Rating: +63/-3
    • View Profile
Re: pacspire - A simple package manager for the TI-Nspire/Ndless (WIP)
« Reply #22 on: August 09, 2013, 11:48:30 am »
Thanks for the explanation :)

Vogtinator:
get_event() will be helpful. (http://hackspire.unsads.com/wiki/index.php/Libndls#Keyboard )
It receives keystrokes AND you can receive files while waiting for an event to happen. Pretty awesome and it should solve many problems :D

Test attached. It waits for an event and prints the event data (through serial). If you send a file while waiting, it will be received successfully. (Press ESC to close)

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: pacspire - A simple package manager for the TI-Nspire/Ndless (WIP)
« Reply #23 on: August 09, 2013, 12:24:22 pm »
Attached to this post you can find NspireHub and TinyWeb. Nspire hub is a Linux application using libti* to communicate with your TI-Nspire. It allows you to send files, keypresses and capture screenshots. It provides some "wrappers" for simple Lua scripts (you run ./nspirelink yourluascript.lua) to allow simple applications. At the moment it contains a script that provides support for TinyWeb. TinyWeb is a (pure) Nspire Lua web browser. At the moment it's not really stable software, but is perfect to demostrate what you can do. It incorporates 1) sending a request to the computer 2) receiving data back 3) receiving the html file converted to a tns 4) parsing the file and displaying the file.

So, I hope the code will help you take advantage of libti* and make an awesome package manager :)
« Last Edit: August 09, 2013, 12:25:55 pm by Jim Bauwens »

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: pacspire - A simple package manager for the TI-Nspire/Ndless (WIP)
« Reply #24 on: August 09, 2013, 12:34:37 pm »
One of the NavNet JARs (don't remember which one) contains the 3-byte key code definitions. Adriweb, remind us which one ;)
I... don't remember off the top of my head, but I've read here and there it can be in commproxy.jar ; seems about right. (then, a class like NspireVirtualKeyStroke )

BTW, libticalcs contained support for Nspire remote control before nRemote was released, though I used a beta version of nRemote in a Windows VM to debug and fix my implementation of the feature through sniffing USB packets.
Well, it's not as if it was a competition :P
« Last Edit: August 09, 2013, 12:35:54 pm by adriweb »
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: pacspire - A simple package manager for the TI-Nspire/Ndless (WIP)
« Reply #25 on: August 09, 2013, 12:38:16 pm »
You (mostly) don't need the 3-byte key code definition. You can just send ascii, as shown in my code ;)
« Last Edit: August 09, 2013, 12:38:42 pm by Jim Bauwens »

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: pacspire - A simple package manager for the TI-Nspire/Ndless (WIP)
« Reply #26 on: August 09, 2013, 12:38:54 pm »
You don't need the 3-Byte key code definition. You can just send ascii, as shown in my code ;)
Yes, but in case you want to actually send nspire-related keystrokes :P
« Last Edit: August 09, 2013, 12:39:04 pm by adriweb »
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: pacspire - A simple package manager for the TI-Nspire/Ndless (WIP)
« Reply #27 on: August 09, 2013, 12:43:20 pm »
Well yeah, that's true.

In that case, here are the codes
Spoiler For Spoiler:
Code: [Select]
private static final byte[] ESC_KEY_BYTES = { 27, -106, 0 };
 private static final byte[] CTRL_ESC_KEY_BYTES = { 0, -17, 0 };

 private static final byte[] TAB_KEY_BYTES = { 9, -107, 0 };
 private static final byte[] SHIFT_TAB_KEY_BYTES = { 124, -107, 0 };
 private static final byte[] CTRL_TAB_KEY_BYTES = { 0, -19, 0 };

 private static final byte[] HOME_KEY_BYTES = { 0, -3, 0 };
 private static final byte[] CTRL_HOME_KEY_BYTES = { 0, -2, 0 };

 private static final byte[] MENU_KEY_BYTES = { 0, 54, 0 };
 private static final byte[] CTRL_MENU_KEY_BYTES = { 0, -50, 0 };
 private static final byte[] MOUSE_CONTEXT_MENU_KEY_BYTES = { 0, -96, 0 };

 private static final byte[] CLICK_KEY_BYTES = { 0, -83, 0 };
 private static final byte[] CTRL_CLICK_KEY_BYTES = { 0, -84, 0 };
 private static final byte[] SHIFT_GRAB_KEY_BYTES = { 0, -7, 0 };

 private static final byte[] LEFT_KEY_BYTES = { 0, 7, 0 };
 private static final byte[] SHIFT_LEFT_KEY_BYTES = { 0, -15, 0 };
 private static final byte[] SHIFT_HOLD_LEFT_KEY_BYTES = { 0, 7, 3 };
 private static final byte[] CTRL_LEFT_KEY_BYTES = { 0, -38, 0 };

 private static final byte[] RIGHT_KEY_BYTES = { 0, 39, 0 };
 private static final byte[] SHIFT_RIGHT_KEY_BYTES = { 0, -14, 0 };
 private static final byte[] SHIFT_HOLD_RIGHT_KEY_BYTES = { 0, 39, 3 };
 private static final byte[] CTRL_RIGHT_KEY_BYTES = { 0, -37, 0 };

 private static final byte[] UP_KEY_BYTES = { 0, 23, 0 };
 private static final byte[] SHIFT_UP_KEY_BYTES = { 0, -13, 0 };
 private static final byte[] SHIFT_HOLD_UP_KEY_BYTES = { 0, 23, 3 };
 private static final byte[] CTRL_UP_KEY_BYTES = { 0, -36, 0 };

 private static final byte[] DOWN_KEY_BYTES = { 0, 55, 0 };
 private static final byte[] SHIFT_DOWN_KEY_BYTES = { 0, -12, 0 };
 private static final byte[] SHIFT_HOLD_DOWN_KEY_BYTES = { 0, 55, 3 };
 private static final byte[] CTRL_DOWN_KEY_BYTES = { 0, -35, 0 };

 private static final byte[] EQUAL_KEY_BYTES = { 61, 117, 0 };
 private static final byte[] CTRL_EQUAL_KEY_BYTES = { 0, -23, 0 };

 private static final byte[] SUCH_THAT_KEY_BYTES = { 124, -19, 0 };

 private static final byte[] A_KEY_BYTES = { 97, 102, 0 };
 private static final byte[] SHIFT_A_KEY_BYTES = { 65, 102, 0 };
 private static final byte[] CTRL_A_KEY_BYTES = { 97, 102, 0 };

 private static final byte[] B_KEY_BYTES = { 98, 70, 0 };
 private static final byte[] SHIFT_B_KEY_BYTES = { 66, 70, 0 };
 private static final byte[] CTRL_B_KEY_BYTES = { 2, -79, 0 };

 private static final byte[] C_KEY_BYTES = { 99, 38, 0 };
 private static final byte[] SHIFT_C_KEY_BYTES = { 67, 38, 0 };
 private static final byte[] CTRL_C_KEY_BYTES = { 3, -78, 0 };

 private static final byte[] FLAG_KEY_BYTES = { 0, -89, 0 };
 private static final byte[] CTRL_FLAG_KEY_BYTES = { 0, -8, 0 };

 private static final byte[] LESS_THAN_KEY_BYTES = { 60, -90, 0 };
 private static final byte[] CTRL_LESS_THAN_KEY_BYTES = { 0, -49, 0 };

 private static final byte[] D_KEY_BYTES = { 100, -123, 0 };
 private static final byte[] SHIFT_D_KEY_BYTES = { 68, -123, 0 };
 private static final byte[] CTRL_D_KEY_BYTES = { 4, -77, 0 };

 private static final byte[] E_KEY_BYTES = { 101, 101, 0 };
 private static final byte[] SHIFT_E_KEY_BYTES = { 69, 101, 0 };
 private static final byte[] CTRL_E_KEY_BYTES = { 5, -76, 0 };

 private static final byte[] F_KEY_BYTES = { 102, 69, 0 };
 private static final byte[] SHIFT_F_KEY_BYTES = { 70, 69, 0 };
 private static final byte[] CTRL_F_KEY_BYTES = { 6, -75, 0 };

 private static final byte[] G_KEY_BYTES = { 103, 37, 0 };
 private static final byte[] SHIFT_G_KEY_BYTES = { 71, 37, 0 };
 private static final byte[] CTRL_G_KEY_BYTES = { 7, -74, 0 };

 private static final byte[] TILDE_KEY_BYTES = { 39, -11, 0 };
 private static final byte[] CTRL_TILDE_KEY_BYTES = { 36, 5, 0 };

 private static final byte[] GREATER_THAN_KEY_BYTES = { 62, -122, 0 };
 private static final byte[] CTRL_GREATER_THAN_KEY_BYTES = { 0, -34, 0 };

 private static final byte[] H_KEY_BYTES = { 104, -124, 0 };
 private static final byte[] SHIFT_H_KEY_BYTES = { 72, -124, 0 };
 private static final byte[] CTRL_H_KEY_BYTES = { 8, -73, 0 };

 private static final byte[] I_KEY_BYTES = { 105, 100, 0 };
 private static final byte[] SHIFT_I_KEY_BYTES = { 73, 100, 0 };
 private static final byte[] CTRL_I_KEY_BYTES = { 9, -72, 0 };

 private static final byte[] J_KEY_BYTES = { 106, 68, 0 };
 private static final byte[] SHIFT_J_KEY_BYTES = { 74, 68, 0 };
 private static final byte[] CTRL_J_KEY_BYTES = { 10, -71, 0 };

 private static final byte[] K_KEY_BYTES = { 107, 36, 0 };
 private static final byte[] SHIFT_K_KEY_BYTES = { 75, 36, 0 };
 private static final byte[] CTRL_K_KEY_BYTES = { 11, -70, 0 };

 private static final byte[] QUOTE_KEY_BYTES = { 34, -95, 0 };

 private static final byte[] IMAGINARY_KEY_BYTES = { 0, -94, 0 };
 private static final byte[] CTRL_IMAGINARY_KEY_BYTES = { 0, -95, 0 };

 private static final byte[] L_KEY_BYTES = { 108, -125, 0 };
 private static final byte[] SHIFT_L_KEY_BYTES = { 76, -125, 0 };
 private static final byte[] CTRL_L_KEY_BYTES = { 12, -69, 0 };

 private static final byte[] M_KEY_BYTES = { 109, 99, 0 };
 private static final byte[] SHIFT_M_KEY_BYTES = { 77, 99, 0 };
 private static final byte[] CTRL_M_KEY_BYTES = { 13, -68, 0 };

 private static final byte[] N_KEY_BYTES = { 110, 67, 0 };
 private static final byte[] SHIFT_N_KEY_BYTES = { 78, 67, 0 };
 private static final byte[] CTRL_N_KEY_BYTES = { 14, -67, 0 };

 private static final byte[] O_KEY_BYTES = { 111, 35, 0 };
 private static final byte[] SHIFT_O_KEY_BYTES = { 79, 35, 0 };
 private static final byte[] CTRL_O_KEY_BYTES = { 15, -66, 0 };

 private static final byte[] COLON_KEY_BYTES = { 58, 1, 0 };
 private static final byte[] CTRL_COLON_KEY_BYTES = { 59, 2, 0 };

 private static final byte[] EXP_KEY_BYTES = { 0, -92, 0 };

 private static final byte[] P_KEY_BYTES = { 112, -126, 0 };
 private static final byte[] SHIFT_P_KEY_BYTES = { 80, -126, 0 };
 private static final byte[] CTRL_P_KEY_BYTES = { 16, -65, 0 };

 private static final byte[] Q_KEY_BYTES = { 113, 98, 0 };
 private static final byte[] SHIFT_Q_KEY_BYTES = { 81, 98, 0 };
 private static final byte[] CTRL_Q_KEY_BYTES = { 17, -64, 0 };

 private static final byte[] R_KEY_BYTES = { 114, 66, 0 };
 private static final byte[] SHIFT_R_KEY_BYTES = { 82, 66, 0 };
 private static final byte[] CTRL_R_KEY_BYTES = { 18, -63, 0 };

 private static final byte[] S_KEY_BYTES = { 115, 34, 0 };
 private static final byte[] SHIFT_S_KEY_BYTES = { 83, 34, 0 };
 private static final byte[] CTRL_S_KEY_BYTES = { 19, -62, 0 };

 private static final byte[] QUESTION_MARK_KEY_BYTES = { 63, 3, 0 };
 private static final byte[] CTRL_QUESTION_MARK_KEY_BYTES = { 0, -53, 0 };

 private static final byte[] PI_KEY_BYTES = { 0, -93, 0 };
 private static final byte[] CTRL_PI_KEY_BYTES = { 0, -12, 0 };

 private static final byte[] T_KEY_BYTES = { 116, -127, 0 };
 private static final byte[] SHIFT_T_KEY_BYTES = { 84, -127, 0 };
 private static final byte[] CTRL_T_KEY_BYTES = { 20, -61, 0 };

 private static final byte[] U_KEY_BYTES = { 117, 97, 0 };
 private static final byte[] SHIFT_U_KEY_BYTES = { 85, 97, 0 };
 private static final byte[] CTRL_U_KEY_BYTES = { 21, -60, 0 };

 private static final byte[] V_KEY_BYTES = { 118, 65, 0 };
 private static final byte[] SHIFT_V_KEY_BYTES = { 86, 65, 0 };
 private static final byte[] CTRL_V_KEY_BYTES = { 22, -59, 0 };

 private static final byte[] W_KEY_BYTES = { 119, 33, 0 };
 private static final byte[] SHIFT_W_KEY_BYTES = { 87, 33, 0 };
 private static final byte[] CTRL_W_KEY_BYTES = { 23, -58, 0 };

 private static final byte[] COMMA_KEY_BYTES = { 44, -96, 0 };

 private static final byte[] THETA_KEY_BYTES = { -120, 6, 0 };

 private static final byte[] X_KEY_BYTES = { 120, -128, 0 };
 private static final byte[] SHIFT_X_KEY_BYTES = { 88, -128, 0 };
 private static final byte[] CTRL_X_KEY_BYTES = { 24, -57, 0 };

 private static final byte[] Y_KEY_BYTES = { 121, 96, 0 };
 private static final byte[] SHIFT_Y_KEY_BYTES = { 89, 96, 0 };
 private static final byte[] CTRL_Y_KEY_BYTES = { 25, -56, 0 };

 private static final byte[] Z_KEY_BYTES = { 122, 64, 0 };
 private static final byte[] SHIFT_Z_KEY_BYTES = { 90, 64, 0 };
 private static final byte[] CTRL_Z_KEY_BYTES = { 26, -55, 0 };

 private static final byte[] SPACE_KEY_BYTES = { 32, 32, 0 };
 private static final byte[] CTRL_SPACE_KEY_BYTES = { 0, -51, 0 };

 private static final byte[] NEW_LINE_KEY_BYTES = { 0, 10, 0 };

 private static final byte[] CTRL_KEY_BYTES = { 0, -86, 4 };
 private static final byte[] SHIFT_KEY_BYTES = { 0, -85, 3 };
 private static final byte[] CTRL_SHIFT_KEY_BYTES = { 0, -85, 7 };

 private static final byte[] BACK_SPACE_KEY_BYTES = { 8, 21, 0 };
 private static final byte[] SHIFT_BACK_SPACE_KEY_BYTES = { 8, 21, 0 };
 private static final byte[] CTRL_BACK_SPACE_KEY_BYTES = { 0, -29, 4 };

 private static final byte[] VAR_KEY_BYTES = { 0, -81, 0 };
 private static final byte[] CTRL_VAR_KEY_BYTES = { 0, -88, 0 };

 private static final byte[] LEFT_PARENTHESES_KEY_BYTES = { 40, 85, 0 };
 private static final byte[] CTRL_LEFT_PARENTHESES_KEY_BYTES = { 0, -25, 0
};

 private static final byte[] RIGHT_PARENTHESES_KEY_BYTES = { 41, 53, 0 };
 private static final byte[] CTRL_RIGHT_PARENTHESES_KEY_BYTES = { 0, -27,
0 };

 private static final byte[] CATALOG_KEY_BYTES = { 0, -111, 0 };
 private static final byte[] CTRL_CATALOG_KEY_BYTES = { 0, -18, 0 };

 private static final byte[] POWER_KEY_BYTES = { 94, -109, 0 };
 private static final byte[] CTRL_POWER_KEY_BYTES = { 0, -21, 0 };

 private static final byte[] SIN_KEY_BYTES = { 0, 116, 0 };
 private static final byte[] CTRL_SIN_KEY_BYTES = { 0, -24, 0 };

 private static final byte[] COS_KEY_BYTES = { 0, 84, 0 };
 private static final byte[] CTRL_COS_KEY_BYTES = { 0, -26, 0 };

 private static final byte[] TAN_KEY_BYTES = { 0, 52, 0 };
 private static final byte[] CTRL_TAN_KEY_BYTES = { 0, -28, 0 };

 private static final byte[] SLASH_KEY_BYTES = { 47, 20, 0 };
 private static final byte[] CTRL_SLASH_KEY_BYTES = { 0, -30, 0 };

 private static final byte[] SQUARE_KEY_BYTES = { 0, -109, 0 };
 private static final byte[] CTRL_SQUARE_KEY_BYTES = { 0, -110, 0 };

 private static final byte[] SEVEN_KEY_BYTES = { 55, 113, 0 };
 private static final byte[] CTRL_SEVEN_KEY_BYTES = { 0, -41, 0 };

 private static final byte[] EIGHT_KEY_BYTES = { 56, 81, 0 };
 private static final byte[] CTRL_EIGHT_KEY_BYTES = { 0, -40, 0 };

 private static final byte[] NINE_KEY_BYTES = { 57, 49, 0 };
 private static final byte[] CTRL_NINE_KEY_BYTES = { 0, -39, 0 };

 private static final byte[] TIMES_KEY_BYTES = { 42, 19, 0 };
 private static final byte[] CTRL_TIMES_KEY_BYTES = { 0, -31, 0 };

 private static final byte[] TEN__POWER_KEY_BYTES = { 0, -20, 0 };
 private static final byte[] CTRL_TEN_POWE_KEY_BYTES = { 0, -108, 0 };

 private static final byte[] FOUR_KEY_BYTES = { 52, 114, 0 };
 private static final byte[] CTRL_FOUR_KEY_BYTES = { 0, -44, 0 };

 private static final byte[] FIVE_KEY_BYTES = { 53, 82, 0 };
 private static final byte[] CTRL_FIVE_KEY_BYTES = { 0, -43, 0 };

 private static final byte[] SIX_KEY_BYTES = { 54, 50, 0 };
 private static final byte[] CTRL_SIX_KEY_BYTES = { 0, -42, 0 };

 private static final byte[] MINUS_KEY_BYTES = { 45, 18, 0 };
 private static final byte[] CTRL_MINUS_KEY_BYTES = { 0, -32, 0 };

 private static final byte[] E_POWER_KEY_BYTES = { 0, -54, 0 };
 private static final byte[] CTRL_E_POWER_KEY_BYTES = { 0, -87, 0 };

 private static final byte[] ONE_KEY_BYTES = { 49, 115, 0 };
 private static final byte[] CTRL_ONE_KEY_BYTES = { 0, -47, 0 };

 private static final byte[] TWO_KEY_BYTES = { 50, 83, 0 };
 private static final byte[] CTRL_TWO_KEY_BYTES = { 0, -46, 0 };

 private static final byte[] THREE_KEY_BYTES = { 51, 51, 0 };
 private static final byte[] CTRL_THREE_KEY_BYTES = { 0, -45, 0 };

 private static final byte[] PLUS_KEY_BYTES = { 43, 17, 0 };
 private static final byte[] CTRL_PLUS_KEY_BYTES = { 0, -33, 0 };

 private static final byte[] ON_KEY_BYTES = { 0, 11, 0 };
 private static final byte[] CTRL_ON_KEY_BYTES = { 0, -16, 0 };

 private static final byte[] ZERO_KEY_BYTES = { 48, 80, 0 };
 private static final byte[] CTRL_ZERO_KEY_BYTES = { 0, -48, 0 };

 private static final byte[] POINT_KEY_BYTES = { 46, 112, 0 };

 private static final byte[] NEG_KEY_BYTES = { -79, 48, 0 };
 private static final byte[] CTRL_NEG_KEY_BYTES = { 0, -82, 0 };

 private static final byte[] ENTER_KEY_BYTES = { 13, 16, 0 };
 private static final byte[] CTRL_ENTER_KEY_BYTES = { 0, -90, 0 };

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: pacspire - A simple package manager for the TI-Nspire/Ndless (WIP)
« Reply #28 on: August 09, 2013, 12:49:54 pm »
But doesn't nRemote use the mysterious NavNet.jar to interface with the Nspire windows driver?
That would make it completely useless to me, as I'm using Linux.
But doesn't nRemote use the mysterious NavNet.jar to interface with the Nspire windows driver?
That would make it completely useless to me, as I'm using Linux.
Same here. libti* supports this functionality though as Lionel stated a few posts up. ;)

Yes sure, but at least it will function directly and more quickly (no install time, I mean) for those on windows (and mac) with TINC[L]S installed, with no need of filter driver and such because of that crappy windows roadblock...
For Linux obviously libti* is the choice as it's easy to use there (and, well, is the only one).
Remember the main point here, whatever the choice : it has to be extremely simple for the user (no installation would be great)

I think the requirement to have tilp installed is as easy for the average windows user as having the TI software.

With the big advantage of not having a 42th abstraction over the real communication.
Quote
And, also, let's not forget that if such App-Store project comes to life, it'll have to be for all .tns of course (there are tons of TI activities that could use this, but also Lua scripts, and duh, the ndless programs (especially those with external resources), so if it ever gets popular (who knows :P), the majority of users will be PC, then Mac, then Linux (and the order of file type will be TI BASIC things, then the Lua stuff, then the ndless stuff...)

For a real package manager (like pacspire  ;) ) every file is just a file, nothing special (except the metadata, of course).
Quote

Also, it'd be good to have such a program linked to the major community repos (ticalc, omni, tiplanet, cemetech...)
Oh, that wouldn't be a good idea. I prefer having a single repo. Fetching packages and metadata would get horribly slow and what is with different version (but same version number!) of the same app in two repos?

Quote
So is tilp the only reliable source for documentation?
The documentation of libti* was already incomplete / partially outdated when I became the maintainer, and (with the help of contributors) I have focused more on the code (which needs bugfixes, feature expansion and hardening) than on the documentation (all the more libti* have relatively few users, and documentation of the API has pretty little user-visible effect, eh ?), so yeah, the source code of the libraries and testcases is your best bet. You're coders as well, after all ;)

Oh, the usual fear of documentation :P
Quote

Have a look at libticalcs (calc_xx -> calc_nsp -> nsp_cmd -> nsp_vpkt -> nsp_rpkt) and the testcase, libticables (link_xxx -> link_usb) and the testcase, TILP (especially tilp_calcs.c), titools. The testcases and titools are about as bare-bones as you can get.

That's good, although some things like
Code: [Select]
#define TRYF(x) { int aaa_; if((aaa_ = (x))) return aaa_; }can already be called obfuscation :P

Does "ticalcs_calc_execute" still work for nspires? That would be perfect, escpecially if you can pass arguments!
Quote

One of the NavNet JARs (don't remember which one) contains the 3-byte key code definitions. Adriweb, remind us which one ;)

It's c:/Program Files (x86)/TI Education/TI-Nspire Computer Link/lib/commproxy/commproxy.jar /com/ti/et/education/commproxy/NspireVirtualKeyStroke.java
Quote

BTW, libticalcs contained support for Nspire remote control before nRemote was released, though I used a beta version of nRemote in a Windows VM to debug and fix my implementation of the feature through sniffing USB packets.

Oh, I don't think sending keys is a good solution. What if the user presses a key manually or disconnects the calc?
Quote

Quote
And I wonder why there are four libti* libraries.
Actually, for the combination of TI-Z80, TI-68k and Nspire, four libraries is not enough ;)
There's a clear need for a fifth library on top of the four current ones, so as to consolidate some code currently duplicated, with variations, across clients (TILP, TIEmu, TilEm, titools). I started creating it locally, though it contains pretty little.
The whole libti* framework looks complex and seems to have deep nesting of functions, but after a while maintaining the code base, I realized that for the purposes of presenting a single, mildly abstracted API to clients (instead of at least three sets of APIs with significant overlap, due to TI-Z80/TI-68k/Nspire, DBUS/DUSB/NSP, and some commonalities between TI-Z80 and TI-68k), it's not easy to do simpler. Just follow the call chains I outlined above - there's a use for each file, in the complete framework :)

Quote
In my opinion it would have made more sense to combine them into one libticalcs.
It's equally clear that for the narrower purposes of interacting with the sole Nspire series, four libraries are far too much, and you're completely right about a single library making sense:
* libticonv deals with character conversion, which is necessary on TI-Z80 and TI-68k models, but the Nspire uses Unicode (and conversions can be handled more directly by other frameworks);
* libtifiles deals with file types... but the Nspire has very few of them, unlike the TI-Z80 and TI-68k series;
Why seperate conversion from file types?
Quote
* libticables deals with multiple cables... most of which don't work on modern computers due to lack of the physical interfaces, and the Nspire uses a single cable type;
* libticalcs deals with the raw DBUS, DUSB and NSP protocols and transport protocols built on top of them.
Why seperate libticables from libticalcs? Calcs without cables don't work :P
Quote

On my Github, you'll find a one-off experiment of a few hours, where I fused libticonv, libtifiles, libticables, libticalcs and tilp into a single code base (I probably should have let libti* on the one side and tilp on the other side, but oh well), shaved most code related to TI-Z80 and TI-68k calculators. Doing so slashed the size of the code base by more than half (~78K RLOC -> <35K RLOC). I didn't bother thoroughly purging the code base, there remain some bits directly aimed at TI-Z80 or TI-68k series and some APIs which are not necessary for dealing with the Nspire series.
I didn't merge developments from mainline since I created that one-off experiment. With several months of full-time paid work, it would be possible to make a fresh API, simplified from the current one while keeping the good bits, tailored to Nspire interaction, replacing Glib with C++11/STL, making a whole new Qt UI on top of it (GTK+ is falling out of favor), making a solid up-to-date documentation, etc... but who can afford that kind of luxury, all the more it's for the benefit of relatively few users ? At least, I cannot ;)
The code base is too huge too be maintainable.. A complete rewrite would take years, though.
Quote
Quote
Even with WINE it doesn't.
USB support in Wine is in the "TODO" group, anyway.
What means: It's finished in two years but every second application will crash horribly. At least it's my current wine experience..
Quote
Quote
Remember the main point here, whatever the choice : it has to be extremely simple for the user (no installation would be great)
Well, the "no installation" part is not going to happen, especially on Windows, due to the "everything USB needs a driver, which in turns requires admin privileges for installing" behaviour. On the day the two main FLOSS Web browsers (Firefox and Chrome) start providing an interface to USB peripherals on the host (notwithstanding the severe security problems), maybe...
Browsers having USB support? Why not integrate firefox in the linux kernel and booting firefox directly?  <_<
Vogtinator:
get_event() will be helpful. (http://hackspire.unsads.com/wiki/index.php/Libndls#Keyboard )
It receives keystrokes AND you can receive files while waiting for an event to happen. Pretty awesome and it should solve many problems :D

Test attached. It waits for an event and prints the event data (through serial). If you send a file while waiting, it will be received successfully. (Press ESC to close)
The problem is more the other direction.. How do you get feedback from the calc(whether the installation has finished successfully, the ndless version..)?
Reading a logfile (after executing pacspire) would -again- be slow as hell.
« Last Edit: August 09, 2013, 12:53:39 pm by Vogtinator »

Offline compu

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 275
  • Rating: +63/-3
    • View Profile
Re: pacspire - A simple package manager for the TI-Nspire/Ndless (WIP)
« Reply #29 on: August 09, 2013, 12:58:49 pm »
Thanks Jim for the code :)

Quote
Oh, I don't think sending keys is a good solution. What if the user presses a key manually or disconnects the calc?
Well, we could... disable bus access to the keypad while receiving stuff? ;D

Quote
The problem is more the other direction.. How do you get feedback from the calc(whether the installation has finished successfully, the ndless version..)?
Reading a logfile (after executing pacspire) would -again- be slow as hell.
True. How does nRemote receive data from a calc?