maandag 16 februari 2015

Use the build in TFTP server in OSX

Use the build in TFTP server in OSX

To start the TFTP server: 
sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist

To stop the TFTP Server: 
sudo launchctl unload -F /System/Library/LaunchDaemons/tftp.plist

You can put your files in the folder: 
/private/tftpboot

You can change this folder in: 
/System/Library/LaunchDaemons/tftp.plist

To test the TFTP setup

Create a file named test.txt in:
/private/tftpboot

Change into your home folder: 
cd ~

Enter the following command: 
tftp 127.0.0.1 

You will get a prompt: 
tftp>

To get the test file: 
get test.txt 

You will get a response like: 
Received 8 bytes in 0.0 seconds

Use SCREEN to connect to a serial device on OSX with a USB-Serial adapter

Use SCREEN to connect to a serial device on OSX 

How to use the SCREEN command how to connect to a serial device with a USB-serial adapter. Plug in your USB-serial adapter and install the driver.
To start you open a terminal, Applications->Utilities->Terminal.app

First we need to find out where the USB-serial is located.
ls /dev/tty.*

This gives an output like:
/dev/tty.Bluetooth-Modem /dev/tty.PL2303-0000201A   /dev/tty.Bluetooth-PDA-Sync

You can ignore the bluetooth devices. Mostly you see something like  PL2303-xxxxxxxx of USBxxxxxxxx those are most common. PL2303 stands for a Profilic chipset. To connect to this device use this command.

screen /dev/tty.PL2303-0000201A 9600

In this case we use a baudrate of 9600 bps (Cisco) in other cases you can fill in another baudrate, the most common are:
9600
38400
115200

The standard values are: 9600/8-N-1
9600
8 bits
Parity None
1 stopbit

These values are very usefull in most cases but you can change them with the following
cs7 / cs8 = 7 databits / 8 databits
parodd / -parodd = Parity odd / Parity even
cstopb / -cstopb = 2 stopbits / 1 stopbit

For example if you would want to use 38400 7E2 we fill in:
screen /dev/tty.PL2303-0000201A 38400,cs7,-parrodd,cstopb
To disconnect use ctrl-a followed by ctrl-k