Linux System Exploration
by Tika Carr
There is a way in which you can explore the Linux system in RS Media. It's very time consuming and tedius, but it does work, and may give you some clues as to what is on the system. I want to thank Nocturnal for his help as well, since the command to get all the files on the system come from one of his scripts. Once you have that magic list, you can then go on and get the contents of the files, or even the files themselves. You won't be able to execute the files though, but at least it might help you learn what all is on the system. You also do not need the RS Media Suite Editor to do this. We will do this all manually, which will help. I am assuming you have an SD card in your RS Media. However, even if you don't, treat the internal memory you access as if we are calling it an "SD card". All the steps should otherwise be the same.
Contents |
Back up your files
Decide what bodycon slot you'll put this macro into. Let's for this example use slot 1. Hook up your RS Media to the USB port on your PC. On the robot end, do the following: Media Mode -> Options -> USB Mode. He should indicate that the connection is successful. On your PC in Windows Explorer, find the USB Drive letter. Click on the arrow to the left of it and wait a few minutes for it to expand. If it collapses right away, re-expand it. Now copy all the files from the SD Card's Personalities\RS Media\Macros\CONANIM01 folder to a folder on your PC, maybe My Documents\TEMP or something. This is so you have a copy should anything go wrong. Do not edit these files you copied! Now go ahead and delete all the files from only the Personalities\RS Media\Macros\CONANIM01 directory.
Create a new BodyCon Macro
Create a new text file (NOT in the directory you saved the files to, but a different one, like My Documents\TEMP\Work for example). Name it Bodycon1.sh. Edit it in a text editor which can save to the Unix text file format. This is VERY important because if you do not save this file in Unix text file format, it will not work! A good editor for this is EditPlus. If using this editor, go to Document -> File Format (CR/LF) -> Change File Format -> Unix and then click OK.
Now add the following text:
echo "1" > /tmp/state/scriptrun /usr/bin/robot/pipe /tmp/robot_pipe 9 2 0 0 0 /bin/mount /dev/mmc /mnt/sd -o rw,remount /bin/ls -alcR * > /mnt/sd/ls.txt /bin/mount /dev/mmc /mnt/sd -o ro,remount /usr/bin/robot/scripts/play_audio.sh "Beep.wav" 0 0 /usr/bin/robot/pipe /tmp/robot_pipe 9 2 1 0 0 echo "0" > /tmp/state/scriptrun
Save this file.
Add the sound file
Find a wav file you'd like to use so that it will alert you when the script finishes. Copy it to the same directory with your bodycon script and rename the wav file to "Beep.wav".
Add this to the robot
Hook up the USB to the robot so you can access it again. Now copy the bodycon script and beep wave file to the Personalities\RS Media\Macros\CONANIM01 directory.
Run the script
Press the 'a' key on the remote to back out to the main Media menu. Select Personalities. Then change the personality to RS Media (if it isn't already chosen, even if it is - it's still best to choose it to be sure). Back out to the Personalities menu using the 'a' key on the remote and choose "Audition". Now find the first BodyCon (Bodycon 1) and press the 'select' button to activate it. Do not press any other buttons until you hear the wave sound you uploaded. When you do, press 'a' on the remote to go back to the main Media menu.
Retrieving the data
Hook up to the USB again from the Options menu. Access the SD card drive on your PC again and you'll see in the main directory a file called 'ls.txt'. Copy this to another directory on your PC (not on the SD card) and then delete it from the SD card.
Now you can open this file in a text editor and look at all the different files available on RS Media!
Other Useful Commands
If you want to get the contents of the file, you'll have to adjust your script by replacing this one line:
/bin/ls -alcR * > /mnt/sd/ls.txt
You can use one of the following:
To get contents of a file:
/bin/cat filename > /mnt/sd/file.txt
Note that 'filename' should be changed to the full path of the file, such as /usr/bin/robot/scripts/MotorRel.sh for example. 'file.txt' can be anything you want the resulting output file to be named. This is what will show up on your SD card.
To copy a file:
You can copy any file using this method:
/bin/cp filename /mnt/sd/file.txt
Again, adjust the 'filename' and 'file.txt' as described above.
Remember to attach to the USB to retrieve your files!
To run an executable:
Put the executable program in the same directory with your bodycon script, and add this to your script:
./executable
If you want to have executables in another directory, say /bin on you SD card and not anywhere in the Personalities or other folders, you could do this:
/mnt/sd/bin/executable
You will have to be sure they will run on RS Media's processor architecture. I will hopefully cover this in another article sometime in the future.