Page 340 - Hacking Roomba
P. 340

Chapter 14 — Putting Linux on Roomba                321




                               Listing 14-3 Continued

                               E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=255ms
                               T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12  MxCh=
                               0
                               D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
                               P:  Vendor=0557 ProdID=2008 Rev= 3.00
                               S:  Manufacturer=Prolific Technology Inc.
                               S:  Product=USB-Serial Controller
                               C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
                               I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00
                               Driver=serial
                               E:  Ad=81(I) Atr=03(Int.) MxPS=  10 Ivl=1ms
                               E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
                               E:  Ad=83(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
                               root@OpenWrt:~# ipkg install lsusb
                               [...]
                               root@OpenWrt:~# lsusb
                               Bus 001 Device 001: ID 0000:0000
                               Bus 001 Device 004: ID 0557:2008 ATEN International Co., Ltd
                               UC-232A  i
                               Serial Port [pl2303]




                             Scripting Language Control

                             Now you have an embedded Linux system with a functioning serial port. It is time to hook it
                             up to Roomba. Since the USB-to-serial adapter has the same RS-232 connector as the serial
                             tether of Chapter 3, just connect it to the adapter and Roomba and you’re good to go.

                             There have been efforts to get Java working in OpenWrt via the SableVM (http://
                             sablevm.org/) or JamVM (http://jamvm.sourceforge.net/), but getting a working
                             Java VM with the system classes in the remaining space of the WL-HDD would be difficult.
                             There are many alternatives to Java, however, and it would be interesting to try some of them.
                             Shell Script Control
                             Linux supports many ways of dealing with serial ports. Unix-like operating systems treat
                             everything as files, even devices such as serial ports. This level of abstraction enables you to
                             deal with almost any device in any language, all just by opening files. Need to format a disk?
                             Open /dev/hdd. Need to play an audio file? Send your WAV file to /dev/audio. You can
                             even control Roomba from the command line:
                             % printf “\x89\x00\xc8\x80\x00” > /dev/usb/tts/0   # DRIVE
                             straight at 200 mm/s

                             (You use \x89 to send bytes using hexadecimal codes.)
   335   336   337   338   339   340   341   342   343   344   345