Author Topic: rshell - A simple RS232 shell for the Nspire  (Read 14744 times)

0 Members and 2 Guests are viewing this topic.

Offline compu

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 275
  • Rating: +63/-3
    • View Profile
rshell - A simple RS232 shell for the Nspire
« on: August 18, 2011, 03:51:12 pm »
rshell is a command-line interface for Nspire using the RS232 port.

It has the ability to launch ndless executables and pass C's argc and argv to them.

I have included some programs for filesystem operations:

ls - list content of a directory
cp - Copy a file
mkdir - Create a directory
stat - Show size and type of a file
rm - Remove a file (for some reason buggy sometimes)

All these commands are in their own TNS-File that has to be located in /documents/bin or the current directory.

Built-in commands are:

cd - Change directory
exit - Exit rshell

Demonstration:

ls
Code: [Select]
A:\documents\>ls.tns
.\
..\
Examples\
bin\
A:\documents\>ls.tns /
dev\
tmp\
phoenix\
documents\
ti84\
logs\
widgets\

cp
Code: [Select]
A:\documents\>cp.tns
USAGE: cp.tns SOURCE DESTINATION
Copies a file from SOURCE to DESTINATION.
A:\documents\>cp.tns bin/stat.tns copied.tns
A:\documents\>ls.tns
.\
..\
Examples\
bin\
copied.tns

mkdir
Code: [Select]
A:\documents\>mkdir.tns
USAGE: mkdir.tns NAME
Creates a directory named NAME.
A:\documents\>mkdir.tns lol
A:\documents\>ls.tns
.\
..\
Examples\
bin\
copied.tns
lol\

stat
Code: [Select]
A:\documents\>stat.tns
USAGE: stat.tns FILE
Shows stat data for FILE.
A:\documents\>stat.tns copied.tns
Mode: File
Size: 0 KBytes
(Shows 0KB here, because it is smaller than 0.5KB and got rounded down...)

rm
Code: [Select]
A:\documents\>rm.tns
USAGE: rm.tns FILE
Removes the FILE.
A:\documents\>rm.tns copied.tns
A:\documents\>ls.tns
.\
..\
Examples\
bin\
lol\

cd
Code: [Select]
A:\documents\>cd examples
A:\documents\examples\>cd ..
A:\documents\>cd /
A:\>cd phoenix
A:\phoenix\>cd /documents
A:\documents\>cd \
A:\>

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: rshell - A simple RS232 shell for the Nspire
« Reply #1 on: August 18, 2011, 03:52:57 pm »
Looks very nice :)
Good job!
« Last Edit: August 18, 2011, 03:53:15 pm by jimbauwens »

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: rshell - A simple RS232 shell for the Nspire
« Reply #2 on: August 18, 2011, 03:54:12 pm »
This is even more than awesome, really nice indeed !
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: rshell - A simple RS232 shell for the Nspire
« Reply #3 on: August 18, 2011, 03:54:43 pm »
WANT. Also, any chance of integrating such a shell into the nspire without the RS232? :P

Offline compu

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 275
  • Rating: +63/-3
    • View Profile
Re: rshell - A simple RS232 shell for the Nspire
« Reply #4 on: August 18, 2011, 03:57:06 pm »
WANT. Also, any chance of integrating such a shell into the nspire without the RS232? :P
Maybe I can use one of my older projects for on-screen output and keyboard input, it shouldn't be too hard to integrate.

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: rshell - A simple RS232 shell for the Nspire
« Reply #5 on: August 18, 2011, 03:57:48 pm »
yay, because that's been something I've wanted for a while.

Oh, also, if we cp to a non-tns name, will it then not show up in the menu, but still be in the calc? That would rock.
« Last Edit: August 18, 2011, 03:59:39 pm by willrandship »

Offline compu

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 275
  • Rating: +63/-3
    • View Profile
Re: rshell - A simple RS232 shell for the Nspire
« Reply #6 on: August 19, 2011, 01:52:48 am »
yay, because that's been something I've wanted for a while.

Oh, also, if we cp to a non-tns name, will it then not show up in the menu, but still be in the calc? That would rock.
Yes, files with a non-tns extension will not be shown by the document browser, but you can "hack" the OS :P

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: rshell - A simple RS232 shell for the Nspire
« Reply #7 on: August 20, 2011, 01:33:16 am »
well, of course, but I was thinking it'd be a lot more organized to not see all the roms from gbc4nspire, or all the text files from that one text editor, and only the things we can actually execute in the main menu.

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: rshell - A simple RS232 shell for the Nspire
« Reply #8 on: August 20, 2011, 08:02:19 pm »
Nice job, compu!
Just one question though: does this require Ndless?

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: rshell - A simple RS232 shell for the Nspire
« Reply #9 on: August 20, 2011, 08:13:00 pm »
I'd bet on it: Lua doesn't have any RS232 support as far as I'm aware, so it'd have to be ndless.

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: rshell - A simple RS232 shell for the Nspire
« Reply #10 on: August 20, 2011, 08:14:17 pm »
Awwwww :(
Oh well... Still, great job!!! :)

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: rshell - A simple RS232 shell for the Nspire
« Reply #11 on: August 21, 2011, 12:00:58 am »
Ndless for 3.0 will come, just wait!

Offline compu

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 275
  • Rating: +63/-3
    • View Profile
Re: rshell - A simple RS232 shell for the Nspire
« Reply #12 on: August 21, 2011, 07:33:05 am »
I'd bet on it: Lua doesn't have any RS232 support as far as I'm aware, so it'd have to be ndless.
Lua has a function to send data via RS232, but you can't receive any data with it. So yes, this requires Ndless.

Ndless for 3.0 will come, just wait!
Lua + C would be awesome :D

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: rshell - A simple RS232 shell for the Nspire
« Reply #13 on: August 21, 2011, 07:36:01 am »
About that Lua outputting to the RS232 port, it's just a print() actually that outputs stuff to the console, which is actually the serial port
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: rshell - A simple RS232 shell for the Nspire
« Reply #14 on: August 21, 2011, 11:51:00 pm »
so, TI essentially set up the RS232 to be a shell, and ended it at that? Or is it just marked as stdout?

How hard would it be for you to integrate rshell into the calc if there was a way to display whatever went into and out of RS232 on-screen, in a terminal-like fashion? Just curious.