Writing Command Line Interfaces for Embedded Devices

By | April 1, 2009

Several times while developing applications for embedded devices I have had the need to test part or all of their functionality in an efficient and very quick way. A GUI is tedious and slow, but a Command Line Interface (CLI) can be perfectly suited for this task.

I had these situations when I developed software for a modem/router, a management system for an optical network and more recently for a HD digital receiver. In the latest case for example, I needed a fast way for scanning channels and zapping. Doing these operations using the GUI is slow because each time I had to go all along the menus and select the right parameters (in the case of a manual scanning) or moving along the channels list to a specific channel (in the zapping case).
Even more, sometimes these applications need a Command Line Interface (CLI) available for the final user. This was the case of the management application for the optical network. It needed a Cisco-like shell in which only specific commands can be given to it and no access to the real shell (like bash or busybox) is allowed.

I wrote some while ago a prototype project that tries to address these kind of situations. I noticed that a lot of time was spent in parsing and validating the input from the CLI and this only distracted me from the real purpose of the application. Thus, I decided that this software handled automatically all the parsing and validation, allowing me to concentrate in the real functionality of the system.

I ended having a software in which I only had to specify in a configuration file the modes (eg. user or privileged), commands (eg. scan or zap) and arguments/parameters (eg. channel frequency in the case of the zap command), and the source files in which I only get the input already parsed and validated and execute the desired function like scanning manually a given satellite.

This article describes, hopefully, with a clear and in-depth approach, the design and implementation I followed for writing this project.

The project is called Tarasca Project, it’s a bit out dated, but I will make a new release soon with some bug fixes and new tested platforms!

Leave a Reply

Your email address will not be published.