Leapster Explorer: SFTP Access

From eLinux.org
Revision as of 09:57, 27 October 2011 by Peter Huewe (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This how-to will show you how to gain SFTP access into your Leapster Explorer, making it very easy to transfer files to and from the device.

Programs Needed

WinSCP or similar client

Software Needed

Leapfrog Connect installed, for windows, no need to start it.

Hardware

DJHI or similar cartridge for access to UART console

On Explorer

Connect your UART cable and cartridge and open up a terminal program, 115200 8/n/1 you can test your connect by typing ls in the console, it should list the root directory structure.

 $ cd /etc/ssh
 $ vi sshd_config

You should now have a config file opened in the text editor, scroll down with the arrows or page button till you find PermitRootLogin make sure it is uncommented and set to yes. Scroll down some more till you see PermitEmptyPasswords make sure its uncommented and set to yes. Simple vi commands, hit the i key to allow you to insert and delete text with the backspace key. Once done editing, hit ESC key, then type :x and hit return to close and save. Tip :q close with out saving.

Next you need to start the daemon, this will take a while the first time, while it generates the keys, just let it do its thing for a few minutes.

 $ /etc/init.d/sshd start

stop or restart are also valid commands if needed. Next get your Explorer IP address

 $ ifconfig

You should find it near the usb0:avah text addr:169.254.119.166 this should stay the same, but if you end up with some connection problems, check it again, it may have changed.

Under Windows

Open Task Manager and click on the Processes tab, scroll thru them until you find Monitor.exe, right click on it, and click End Process.

Plug your Explorer into the USB on your host PC, and turn it on.

Open the command prompt and run the command.

 C:\>ipconfig /all

Look for the leapfrog adapter and make a note of its IP address along with the IP you found in the last step on the LX device.

Under Network Connections right click on the Local Area Connection X button, on mine X was 4. Click on Status and then Properties highlight Internet Protocol (TCP/IP) and click Properties. Click the radio button Use the following IP address enter IP Address: <LF Adapter's IP Address> Subnet mask: 255.255.0.0 Default Gateway: <Host PC's IP>. Click okay, and then open a command prompt. The first IP address is the LX device itself, the second is the LeapFrog LAN adapter.

 C:\>route.exe 169.254.3.208 169.254.138.17

Your computer should now be configured to use the USB network adapter with out having to run LFConnect. You will need to run the route.exe command every time you connect your LX to your host, I recommend a batch file to set it up. Some caution if you set it to a persistent route, the LX will change it's IP address.

Some things to look out for: This is a bit delicate of a setting, the LX could change its IP, which from what I can tell, it only does if 169.254.3.208 has been taken by something else, it will then change it, and use it as its new address each time you start it. Also when configuring the adapter, if your host PC obtains its IP address automatically, it could change, and cause issues with the LF USB Adapter, you can either change your host to a static IP or bank on your router not changing it, I don't think mine ever has.

Python script to automate this

As an alternative to the route batch file, I wrote a Python script that gets the Explorers IP address, what ever it generates, and runs the route command with it. You'll need the network adapters IP address, which you can configure at the top of the file. This will need to be the static IP you set up previously. You can double click the file to run it, or run it from a command prompt, which will give you the host name of the Explorer, which will be Explorer-<SERIAL NUMBER>.local you can then use that host name in any applications that you use to hook up to the Explorer, like winSCP. This will allow the Explorer to change its address, with out having to configure a new batch script or settings in your programs. After starting Explorer with usb hooked up, run the script.

File:Cellphone.v0.1.zip


Open up winSCP or which ever SFTP client you want to use and configure the server address to the IP you got from your Explorer, put root' as the username and leave the password blank, then you should be able to log in.

For some reason I was not able to get a connection, with out LFConnect running, it may be possible with a better understanding of this system.

Under Linux

Open up a terminal window, plug in to USB and turn on your Explorer. Run command.

 $ dmesg

You should see some info about CDC and a MAC address, and eth[X], you'll need to know which number [X] your Explorer was assigned.

 $ sudo ifconfig eth[X] 10.0.0.1 netmask 255.255.255.0

Then using the UART console to your Explorer run this command on it

 $ ifconfig usb0 10.0.0.2 netmask 255.255.255.0

You can now log into the Explorer either with

 $ ssh root@10.0.0.02

Or in Places>Connect to Server in Ubuntu, set it to SSH, enter 10.0.0.2 for address, 22 for port, root for username, and connect.