Comtrol eCos User Manual

Page 719

Advertising
background image

Testing

or alternatively using some combination of

--with-tcl-include

,

--with-tcl-lib

and

--with-

tcl-version

.

One of the host-side executables that gets built, usbchmod, needs to be installed with suid root privileges.
Although the Linux kernel makes it possible for applications to perform low-level USB operations such as
transmitting bulk packets, by default access to this functionality is restricted to programs with superuser priv-
ileges. It is undesirable to run a complex program such as usbhost with such privileges, especially since the
program contains a general-purpose Tcl interpreter. Therefore when usbhost starts up and discovers that it does
not have sufficient access to the appropriate entries in

/proc/bus/usb

, it spawns an instance of usbchmod to

modify the permissions on these entries. usbchmod will only do this for a USB device

"Red Hat eCos USB

test"

, so installing this program suid root should not introduce any security problems.

During make install the following actions will take place:

1. usbhost will be installed in

/usr/local/bin

, or some other

bin

directory if the default location is

changed at configure-time using a

--prefix=

or similar option. It will be installed as the executable

usbhost_<version>, for example usbhost_current, thus allowing several releases of the USB slave package to
co-exist. For convenience a symbolic link from

usbhost

to this executable will be created, so users can just

run usbhost to access the most recently-installed version.

2. usbchmod will be installed in

/usr/local/libexec/ecos/io_usb_slave_

<

version

>

. This program

should only be run by usbhost, not invoked directly, so it is not placed in the

bin

directory. Again the

presence of the package version in the directory name allows multiple releases of the package to co-exist.

3. A Tcl script

usbhost.tcl

will get installed in the same directory as usbchmod. This Tcl script is loaded

automatically by the usbhost executable.

4. A number of additional Tcl scripts, for example

list.tcl

will get installed alongside

usbhost.tcl

. These

correspond to various test cases provided as standard. If a given test case is specified on the command line
and cannot be found relative to the current directory then usbhost will search the install directory for these test
cases.

Note: Strictly speaking installing the

usbhost.tcl

and other Tcl scripts below the

libexec

directory devi-

ates from standard practice: they are architecture-independent data files so should be installed below the

share

subdirectory. In practice the files are sufficiently small that there is no point in sharing them, and

keeping them below

libexec

simplifies the host-side software somewhat.

The usbhost should be run only when there is a suitable target attached to the USB bus and running the usbtarget
program. It will search

/proc/bus/usb/devices

for an entry corresponding to this program, invoke usbchmod

if necessary to change the access rights, and then interact with usbtarget over the USB bus. usbhost should be
invoked as follows:

$ usbhost [-v|--version] [-h|--help] [-V|--verbose]

<

test

>

[

<

test parameters

>

]

1. The

-v

or

--version

option will display version information for usbhost including the version of the USB

slave package that was used to build the executable.

2. The

-h

or

--help

option will display usage information.

615

Advertising