top
About Buy News Guide Ideas
The phatIO project has finished, and I'm no longer selling ready made boards - but you're welcome to look around - send any questions to the email below

Back to Table of Contents

#OS Specifics When connected to a computer, phatIO should appear as a USB filesystem and keyboard.

Note that in all documentation and examples on this website “PHATIO” is used as a place holder for this location. $PHATIO in shell scripts, %PHATIO% in DOS batch files, PHATIO as variable name

This page is preliminary - please contribute your experiences of different Operating Systems on the forums or by email.

Microsoft Windows

When inserted into a windows machine (XP and later) for the first time, it will announce that new hardware has been detected (a keyboard and mass storage device). Windows should use default Microsoft drivers for both devices.

The phatIO filesystem will appear as a Disk Drive in explorer, for example: PHATIO (E:) and the phatIO keyboard will appear as a “Standard” HID Keyboard Device.

The files .metadata_never_index, .Trashes, and the folder .fseventsd are OS X specific and can be deleted.

Apple OS X

phatIO will appear as /Volumes/PHATIO and as an icon in the desktop. On first connecting OS X will detect a new keyboard and start the new keyboard wizard - this can be closed.

Despite phatIO telling OS X it is a removable drive, OS X will expect the device to be ejected (right click “Eject PHATIO” or dragged to Trash) before being removed and will complain if not.

phatIO includes some hidden files in the root of the drive to stop OS X from creating index, event and trash files on the phatIO filesystem.

Linux

To Be Written.

To delete all caches to allow for repeated IO pin file reading the following can be performed (this deletes all filesystem caches not just phatIO)

echo 3 > /proc/sys/vm/drop_caches

#Writing files to phatIO When files are written to phatIO it attempts to detect changes and act accordingly. To do this efficiently files within the “io” directory shouldn’t be moved around or deleted (except the “dev” directory explained in the Devices section). For example on a *nix computer:

# echo "1" > $PHATIO/io/pins/0

Will write 1 to pin 0 value file fairly efficiently, replacing the existing contents.

Editing the file with an editor or wordprocessor may be more circuitous. For example, some editors will create another file with the new contents, rename the old file, change the name of the new file, then delete the old file. Although phatIO detects this, the IO will be obviously be slower than a direct write of the file. Text editors and word processors can also make backup and other hidden temporary files that clutter the directory, slowing phatIO.

Following gives some patterns for writing to phatIO files efficiently from you computer:

##Editors On Windows Notepad and Textpad have been tested to edit IO files and the run.lio file. On OS X vim, emacs, and TextMate have been used successfully.

Note that if your favourite editor can be configured to stop making backup files and saving preferences on the phatIO filesystem it will improve performance.

##Shell Scripts Echo can be used to efficiently write values to files on phatIO:

# echo OUT > $PHATIO/io/mode/0
# echo "1" > $PHATIO/io/pins/0
# echo "(keyboard \"hello world\")" > $PHATIO/io/run.lio

##DOS Scripts

Echo can be used to efficiently write values to IO, device, and run files on phatIO:

# echo OUT > %PHATIO%\io\mode\0
# echo 1 > %PHATIO%\io\pins\0
# echo (keyboard "hello world") > %PHATIO%\io\run.lio

##Python

To be written - if anyone can contribute versions of the shell and ruby scripts in ruby please do so on the forums or email.

##Ruby If communicating with your phatIO in Ruby you can call out to the operating system to write to a file

`echo #{value} > #{file}`

or use the built-in File object. Some of the Ruby examples in the ideas section use the following write_to_file function:

PHATIO=ENV['PHATIO']

def write_to_file(filename, value)
  file = File.open(filename, "w")
  file.write(value)
  file.close
rescue Exception => e
  puts "Failed to write to '#{filename}': #{e}"
  puts "Make sure PHATIO environment variable points to phatIO " \
  		"mount point (currently '#{PHATIO}')"
  file.close unless file == nil
  exit
end

#Keyboard

phatIO behaves as a USB keyboard allowing it to mimic keyboard behaviour on IO conditions. Details and issues are documented separately and including in an ideas section.

@Contact  |   Legal & Privacy  |    RSS  |   Development Twitter  |   Official Twitter
© phatIO 2012, All Rights Reserved.