Browse DevX
Sign up for e-mail newsletters from DevX


Sharpen Your Java Wireless Skills with the Zaurus SL-5500 PDA  : Page 5

Developing software for PDAs has often been restricted to C/C++ due to performance issues. Lately, advances in hardware and Java technology are making the PDA suitable for development and deployment with Java. Learn how to leverage your Java knowledge, and much of your existing Java object libraries, to deploy a wide range of functionality on one new PDA, Sharp's Zaurus SL-5500.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Exorcise The RS-232 Serial Port
Many info-gadgets existed before the PDA, and none of them were very successful. Palm provided seamless connectivity, and PDAs have been a huge hit ever since. Virtually all PDAs today have an RS-232 serial port. Supporting this interface is important since there are hundreds of millions of electronic devices—computers, GPS receivers, barcode scanners, modems, digital cameras, environmental sensors, etc.—that also have RS-232 serial ports (and not USB ports). If you wish to develop applications (Java or otherwise) that communicate with the serial port, you will need to know how the port is controlled. In many designs the same physical port also provides USB-slave-mode connectivity. Vendors provide different ways of controlling the serial port. To use the port on WinCE you simply open the port when idle (i.e. no ActiveSync session). The Symbian OS provides control of the port, allowing the desktop link feature to be enabled/disabled through a native system call (even when active) or via the keyboard using Ctrl-L.

The Zaurus has multiple serial port modes. The default mode is "INIT 5," which runs a getty daemon on the built-in serial port (/dev/ttyS0) providing a PPP connector. If you open the serial port in this mode (which the flexible architecture of Linux allows) your application can send data, but it will not receive any because the getty process gets it. To completely control the built-in serial port on the Zaurus you must 'soft reset' in "INIT 3" mode. To accomplish this:

  • Toggle the battery cover switch on the back of the device.
  • Slide open the keypad cover to display the keypad.
  • Power on the Zaurus.

During the boot process you will see a 'Wait' message displayed followed by a number that decrements from 5. Before the number decrements to 0, press the '/?' key on the keypad. This will display the following menu:

q (x): Qtopia
a (e): Linux Console
e (e): init 3 (ttyS0: -free-)
r (e): init 4 (ttyS0: terminal)
t (e): init 5 (ttyS0: pppd)

Press the 'E' key on the keypad. The device will boot with the serial port configured in INIT 3 mode (exorcised, or free of daemons as it were). This selection must be done each time the PDA is soft reset in order for the serial port to be free for your application. Resetting is not commonly required due to Linux's stability.

Author's Note: To enable synchronization via USB, soft reset the Zaurus in INIT 5 mode (the default).

I discovered a serious bug in the Zaurus related to INIT 3 mode, which affects both the consumer SL-5500 and SL-5000D developer version. When running with INIT 3 mode, the bug prevents the clock from being set, and setting any alarms in the calendar will cause the Zaurus to completely lock up. Sharp is informed of this issue and plans to fix it in a future ROM version. The bug affects ROM 2.12 (SL-5500) and ROM 1.12 & 1.13 (SL-5000D). Fortunately there is a workaround, and with the handy Zaurus keypad, it is not difficult. The fix need only be done once as it maintains itself during subsequent soft resets.

  • Once booted in INIT 3 mode, switch to the "Applications" area.
  • Start the "Terminal" application.
  • From terminal, enter the following commands
    # cd /etc/rc.d/rc3.d # ln -s ../init.d/atd S41atd # cd /etc/rc.d/init.d # ./atd start

Another option is to use a routine that I specifically created to fix this problem. Start Add/Remove Software and tap Install packages via networks. Tap the switch icon in the lower right portion of the screen, and tap New. In the Name field enter serialio.com (or some other name) and in the URL field enter http://www.serialio.com/zpkgs. Then tap or push the OK button on the Zaurus. After the Package Manager displays, double-tap the serialio-fixatd package and the package details will be displayed.

You then tap Install and the icon will indicate the package is selected for install. From here push or tap OK and you will be prompted to select an install location with RAM being the default. Choose OK and you will again see the Add/Remove Software screen; tap the X in the upper right of the screen or push the Cancel button and the package install will complete. Then go to the Jeode panel and tap the fixatd program. Once the fix is complete the program can be removed. A screen shot sequence for this process is available at http://www.serialio.com/zpkgs.

The Zaurus opens the PDA world to Java in a manner previously known only to developers and users of desktops and servers. Java on PDAs no longer needs to be restricted to the enterprise where significant developer knowledge and user training is required.

David Boydston is CTO of Restock.com located in Santa Barbara, CA. He holds multiple patents for electronic commerce methods and devices. He authored the world's first commercial SerialPort class for Java, which runs on at least 26 computing platforms and is used by developers in virtually every country. He does a significant amount of electronic commerce design with Java and other technologies.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date