Home Contents | # Platform | dev

## DEVICES

The /dev directory is the interface to all available hardware devices of the system.

### Devices that are of interest to Lua applications

/dev/ttySx | A serial port. The 'x' indicates the number of the serial port.
/dev/ttyS0 | This is the debug console. It should not be used to connect external devices.
/dev/lpUSBx | A printer connected via USB. The 'x' indicates an USB location ID, see below.
/dev/watchdog | Provides access to the hardware watchdog.

### Block devices

Block devices are used primarily for formatting a device. If you want to access the files stored on a block device, you need to access it under /media.

/dev/df0b | The on board (NOR) dataflash chip
/dev/nv0 | The on board battery backed static RAM
/dev/ram0 | The volatile ram disk.
/dev/mmc0a | The memory card, if present
/dev/sdUSB1aa | Example of an USB stick in USB slot 1

### Classic device files

/dev/full | Trying to write to this file will always result in an No space left on device error.
/dev/null | Data written to this file will be ignored.
/dev/zero | Reading from this file will produce an endless stream of zeroes.
/dev/random | Reading from this file produces random numbers

## NOTES

### USB location ID

An USB location ID consists of one or more digits. Each digit numbers the port at the USB hub where the device is connected.

A device connected directly to the controller has a location ID consisting of a single digit, .e.g '1'. When using one hub, the location ID has two digits, .e.g '14': First port on controller, fourth port on hub.

### Naming of USB storage devices

USB storage devices are named /dev/sdUSBxyz

x is the USB location ID, as described above.
y is the slot number at the storage device. Most flash card readers have four slots, labeled 'a'...'d'.
z is the partition number on the media. Flash memories mostly use 'a' here, while harddisks may be labeled 'a'...'d'.

A plain USB Stick: /dev/sdUSB1aa

1: First port at controller.
a: First slot.
a: First partition.

A memory card in an external card reader behind two hubs: /dev/sdUSB243ba

243: Second port at controller, fourth port at first hub, third port at second hub.
b: Second slot.
a: First partition.

## SEE ALSO

/media, os.format