SETTING UP RASPBERRY PI FOR TOPPY FTP ACCESS (Draft 5) 1 INTRODUCTION These notes describe how I set up my Raspberry Pi to allow FTP connection to a Toppy. Text in blue indicates Linux commands or file contents. 2 START POINT I started with a clean Raspian installation, having selected the GUI option for booting. 3 LXTERMINAL OR SSH? For entering Linux commands, I used the LXTerminal on the Pi. Alternatively you could use SSH commands from something like PuTTY on a Windows PC with a network link to the Pi. You then only need one display/keyboard/mouse, and may even be able to copy and paste commands from this document with some Windows terminal programs (including PuTTY). See Appendix 1 for details as to how to set up PuTTY. 4 TEXT EDITOR I used "nano", but there is a wide selection of alternatives. "Leafpad" (available via the "Accessories" group on the GUI screen) is more user-friendly and includes line numbers as an option, but can only be used in the graphical environment so cannot be used via SSH. 5 DOWNLOADING FILES On my PC, downloaded and copied extracted the following files onto a USB stick: "ftpd-new_dev-scan-static" from http://birdman.dynalias.org/r2-d2/ (armv5tel version), which I renamed "ftpd-topfield". "puppy-new_dev-scan-static" from http://birdman.dynalias.org/r2-d2/ (armv5tel version), which I renamed "puppy". The latter is not essential, but provides a convenient tool for testing the interface to the Toppy from the Pi command prompt.
With the graphical environment running, I insert the USB stick into an unused Pi port, so that the drive is then automatically mounted and I selected the option to open with File Manager. I then opened a second copy of File Manager from the System Menu Accessories option, and copied the "ftpd-topfield" and "puppy" across from the USB stick to the "/tmp" directory on the Pi. Alternatively you can download the files directly using a browser on the Pi. I tried with Chromium (sudo apt-get install chromium to install) but it may be possible with the default browser Midora. 6 SETTING UP FTPD-TOPFIELD I next moved "ftpd-topfield" and "puppy" to "/usr/bin" using the LXTerminal commands: sudo mv /tmp/ftpd-topfield /usr/bin sudo mv /tmp/puppy /usr/bin and made them executable using: sudo chmod +x usr/bin/ftpd-topfield sudo chmod +x usr/bin/puppy 7 ALLOWING ACCESS BY NON-ROOT ACCOUNTS Using the command: sudo nano /etc/udev/rules.d/10-toppy.rules I generated a file with that name and the following contents: # Set the Toppy device to group toppy # This sets /dev/bus/usb/001/nnn, but not /dev/usbdev1.nn* # ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="11db", GROUP:="toppy", MODE:="0664" A copy of this file is available from here - if you wish to use this rather than create a new file copy it to "/tmp" as above and then: Next, using: I added: sudo cp /tmp/10-toppy.rules /etc/udev/rules.d/ sudo nano /etc/group toppy:x:2001:pi to the end of that file.
8 TESTING THE TOPPY INTERFACE As soon as I connected and switched on the Toppy, the File sudo Manager window opened showing the top level directories on the Toppy (DataFiles, ProgramFiles, & MP3), but I was unable to inspect their contents. I then ran puppy -c size to test the interface, BUT it returned error 16!! First I tried Iskra's solution of commenting out the line starting "ATTRS{idVendor}=="11db"", in " "/lib/udev/rules.d/60-libgphoto2-2.rules", but this merely changed the error code (after rebooting). I then tried Frank Haemorrhage's solution, of renaming the "topfield.so" file as follows: cd /usr/lib/arm-linux-gnueabihf/libgphoto2/2.4.14 cp topfield.so topfield.so.denied rm topfield.so which appears to have fixed the problem. I have reversed the former change, and all seems OK. 9 RUNNING FTPD-TOPFIELD To run ftpd-topfield manually, I typed: ftpd-topfield -D -P 2021 at the pi promt, which allowed me to connect with FileZilla using login name "anonymous" and password "password" at port 2021. However this will need to be restarted after every boot, so I modified the start-up. First I generated a start-up file using: sudo nano etc /init.d/toppy-connect with the following contents: #! /bin/sh # /etc/init.d/ftpd-topfield ### BEGIN INIT INFO # Provides: ftpd-topfield # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Script to start ftpd-topfield at boot # Description: As above ### END INIT INFO case "$1" in start)
echo "Starting ftpd-topfield" /usr/local/bin/ftpd-topfield2 ;; stop) echo "Stopping ftpd-topfield" killall ftpd-topfield2 ;; *) echo "Usage: /etc/init.d/ftpd-topfield {start stop}" exit 1 ;; esac exit 0 A copy of this file is available from here - if you wish to use this rather than create a new file copy it to "/tmp" as above and then: sudo cp /tmp/toppy-connect /etc/init.d I then made it executable and registered it with: sudo chmod +x /etc/init.d/toppy-connect sudo ln etc/init.d/toppy-connect /etc/rc5.d/toppy-connect sudo update-rc.d toppy-connect defaults Rebooting (sudo reboot), and running ps -e to provide a list of running processes confirmed ftpd-topfield had started automatically, and I was able to access the Toppy from my PC using FieZilla. 10 ACKNOWLEDGEMENTS Thanks to Birdman, Frank Haemorrhage, and others on the toppy.org.uk forum for providing the information on which this is based.
APPENDIX 1 - USING PuTTY This FREE Windows application can be downloaded from here. When run you will see something like: (The LinkStation code etc entries in the box are my saved settings, so will not appear). You need to enter/select: The IP address for your Pi (normally something like "192.168.0.3") SSH, which should automatically select the right port (22) If your are not booting your Pi in GUI mode, the initial boot display for the PI should have an entry "My IP address is a.b.c.d" - use this value. Otherwise you can get it by opening LXTerminal on the Pi, and typing "ifconfig". The IP address will be displayed on the second line of the results as "inet addr: a.b.c.d". Ignore the similar entry in the second block of results. Insert a name in The "Saved Sessions" box (e.g. "Pi"), and click on "save" for future use. Click on "open" and you should see:
Type "pi" + <Enter> at which point the password will be requested when "raspberry" or whatever you have changed it to will appear. N.B. As with the normal Pi password entry, no characters appear on the display as you type the password. On entering the right password you should see:
at which point you can proceed just as if you were using LXTerminal on the Pi itself. To paste from the clipboard, simply select the relevant point with your mouse pointer, and right click rather than more usual Ctrl-V. To terminate a command (e.g. which has stuck in a loop), press Crtl-Z