Support for Auxillary Devices

From OpenAlchemy.org

It is needless to say that a device that cannot communicate to other devices will be practically useless. A standalone device has its own use, but when it gets the capability to communicate to the external world, its power is boundless. At PicoPeta Simputers, we have decided that Amida should be able to communicate with devices that support popular communication protocols. As a result, in addition to the serial line interface, the following interfaces are built into Amida.

  1. USB interface
  2. IrDA interface
  3. Smartcard interface

In the following sections, each one of interfaces is described in detail to enable Amida programmers to design and implement new software.

Contents

Amida and USB

Amida has two USB ports. The mini USB port can be configured as master or slave, while the other USB port is always master. The mini USB port is configurable as master or slave by usb switch command. usb switch master on configures the mini USB port as master, whereas, usb switch slave on configures the mini USB port as slave.

Amida USB master and a slave conforms to USB 1.1. Both master and slave can have maximum transmission rate of 12Mbps.

USB master on Amida

Amida USB master can support wide range of devices. The user can connect USB slave devices like keyboard, storage devices like memory stick to Amida on the USB master. Linux modules for USB storage devices, USB-Ethernet adapter, USB-Wireless adapter, USB keyboards, Reliance cellphone handsets, logitech webcam are loaded in Amida. As soon as a USB device is connected to Amida the appropriate module will be loaded.

Storage devices like USB memory stick are automatically mounted on /usr/local/usb1 or /usr/local/usb2. USB-Ethernet adapters or USB-Wireless adapters can be configured through the settings application. Once the device is unplugged, the corresponding module will be uninstalled from the kernel.

USB slave on Amida

Amida provides a ethernet interface over USB. So, after connecting to the Amida with USB cable, you can execute any networking applications like ftp, telnet to access Amida and transfer files.

The ethernet interface on Amida, comes up with an IP address 192.168.0.1. This can be changed through settings application. After configuring the IP address on Amida, plug in the USB cable on the mini USB slot. Your Linux workstation should be able to detect Amida. If your Linux box is USB-hotplug enabled, add an entry for module usbnet for Vendor ID: 0x49f and Product ID: 0x505a in modules.usbmap for autoloading of usbnet each time Amida is plugged into a Linux machine. Otherwise, you can install the usbnet module and configure the IP address of usb0 to setup a point to point link between the Linux box and Amida.

Amida does not save its status of USB slave on sleep-wakeup. Therefore, do not put Amida to sleep when you are using it as a USB slave and the usb cable is connected. If Amida was put to sleep when the cable was connected, after wake up from sleep, pull out the cable and plug it back in.

Peripharal Device Connectivity to USB

Table 17.1.3 provides a list of USB devices supported by Amida Simputer. supported in this document means it is tested successfully. However it does not mean other makes and models are not supported. Any protocol compliant device would work fine with Amida Simputer. It is also true with IrDA and peripherals. See the footnotes 1 2 3 for keyboards, printers, etc.

USB related References

Following are some useful links for understanding of USB protocol stack on Linux and peripharal driver development.

Amida and IrDA

Amida can do IrDA communication with other IR enabled devices. Amida conforms to IrDA 1.1 standard. It has a maximum transmission rate of 4Mbps. Amida can connect to any IR device within 1m distance and in an angle of 30 degree.

When the user brings Amida near to any IR enabled device, Amida should be able to detect that device and an entry for that device will show up in /proc/net/irda/discovery. You can now send or receive files between that device and Amida. Amida supports most commonly used application layer protocols IrOBEX and IrLPT.

IrOBEX

IrOBEX is the popular protocol for file transfer between IR enabled devices but it is most commonly used for transferring image, addressbook and plain text files.
IrOBEX runs as conventional client/server model. Amida runs IrOBEX receiver/server as a deamon and this deamon copies any file received in /tmp directory of Amida. If the file received is of vcf format IrOBEX receiver calls Addressbook application to take up that new address. Similarly it calls Photoalbum application when image and Notebook Notebook application when plain text file are received. IrOBEX receiver is started by running irobex (without any argument). IrOBEX sender/client is invoked with a filename as follows,
irobex <filename with fullpath>

IrLPT

IrLPT is used for printing. (It is important to note that most printers support IrOBEX also). IrLPT service is provided via /dev/irlp0. Applications can open that device and write data to be printed.
Reader can look up http://www.irda.org/ to understand IrDA protocol.


Amida and Accelerometer

Amida has an in-built accelerometer and can detect its planar coordinates in a relative mode. That is, if Amida is tilted to the left (at a particular speed) then its X-coordinate will be smaller then the previous value. SImilarly for the Y-coordinate. This capability enables the Amida to recognize (hand) gestures. The possible gesture recognitions include zoom-in, zoom-out, fliping pages in a notebook, photoalbum etc and rotation of the screens to align with orientation of the device.
The nice thing about the accelerometer is that the user can read the values of the current coordinates from the /proc/accel entry. This is a readonly entry. A simple cat command would display the current acceleromter positions in X and Y.
For generating accelerometer key events use /proc/accel key.
For example, the command echo N > /proc/accel_key would generate the corresponding key event. N can range from 1 to 8 inclusive. The following table gives the value of the corresponding key event generated.

Finally, whether to enable or diable the accelerometer the proc entry /proc/accel key pressed can be used. The command 'echo 1 > /proc/accel_key_pressed' will enable the accelerometer events.
'echo 0 > /proc/accel_key_pressed' will disable the accelerometer events.

Amida and Printing APIs

Amida provides a command line interface to printing. Amida can print to any PCL Compliant Printers. Following is the syntax for print.

To print PLAIN TEXT file: print text filename

Note: Print module puts \r after each \n for proper formatting of the text file.

To print VCF file: print vcf filename

Note: If application is not sure whether to print vcf or text file, it can provide both the vcf and text filenames on the command line as follows:

print vcf filename text filename or

print text filename vcf filename

Print module tries to print the vcf file to IR printer. If it fails to find the IR printer, it will try to print the text file in USB printer. Please note that, user can override printing priorities by modifing the /usr/local/settings/printer.cf file. See the end of this page for more info on printer.cf.

To print PNM IMAGE file: print image filename

Note: We support ONLY pnm images for now. Images with other formats need to be converted to pnm before printing.

To print SCREEN SHOT OF SIMPUTER: print screen X1 Y1 X2 Y2

Note: Application can print screenshot of simputer using this command. (X1, Y1) is the leftmost co-ordinate of the screenshot and (X2, Y2) is the rightmost co-ordinate. The range of X1, X2, Y1, Y2 are as follows, 0 <= X1,X2 < 3200 <= Y 1, Y 2 <= 240.X1 <= X2 and Y 1 <= Y 2.

To print raw file: print raw filename

Note: Print module uses PCL encoding before sending any file to printer. Application using their own PCL encoding can override this PCL encoding of Print module by using the above command.

If simputer is connected to a printer either through USB or IrDA, it will use that interface to print. In case simputer is connected to the printer with both IrDA and USB, it reads the file /usr/local/settings/printer.cf to find the user set priority.

A sample /usr/local/settings/printer.cf with first priority to IrDA and second priority to USB is shown below.

$cat /usr/local/settings/printer.cf

IrDA USB

printerdetectd

This deamon sends alchemyctl -C on message to alchemy if printer is connected to USB or is near an IR printer AND alchemyctl -C off message to alchemy if printer is disconnected from USB or is moved outside the range of an IR printer.

This deamon writes the current status of connectivity of printer in the /tmp/printerconnected. /tmp/printerconnected is one character long and a 1 in that file means printer is connected to USB or is near an IR printer and 0 means printer is disconnected from USB or is moved outside the range of an IR printer.

Users

OpenAlchemy is a Free and Open Source Software project
proudly supported by
Geodesic Information Systems Limited

Comments? Feedback? Contact Us.

MediaWiki