Monday Oct 20, 2008

Use ekiga and a usb webcam for video conference

It is easy to setup a video conference by using ekiga.

1. Plug your USB webcam.
(See the list of webcams supported on opensolairs)

You then should have the device file /dev/video0 created automatically.

2. Configure ekiga with GUI.

When the first time running Ekiga or you click Ekiga menu
Edit -> Configuration Druid, you can see a dialog pop up. After click
"Forward" button for a couple of times, you see a dialog to ask for an
account, you can just click "I do not want to sign up for the
free service", and then go forward. When you are asked for choosing
"Video Manager", please choose V4L2. After these configuration steps,
can see the application window, and then click the video camera button
to see
the video. Now you will see the local video captured by your usb webcam.

3. To connect with others to see the remote video.

It is easy to use h323 protocol to connect two PCs. Just one step:

In the address blank of Ekiga main window, type:
h323:ip-address, e.g., h323:

The hostname or ip address belong to the PC that you want to call. Then type return or click the call button to issue the call. After the peer accepted the call, then you are connected. Remote video will be displayed on both sides.

If ekiga can not detect the webcam but the /dev/video0 file is already created, it might be the file permission problem. The access to /dev/video0 is
granted to login user only. So, if you are running ekiga using another user
name, then ekiga can not detect the webcam. Just change the user to the
login user will make it work.

After you are connected, clicked the "View" menu to try various ways of displaying remote/local video or zoom the video.

Sunday Jun 22, 2008

ugen driver in Solaris

ugen (USB generic) driver in Solaris is useful for users because it exports device nodes for each of the end point of a USB device. Users can access the raw data of the USB device via the ugen nodes. libusb or openusb interfaces are built upon this driver. It is not that staight forward that in what cases ugen nodes will be exported. Recently I was asked by people who want to utilize ugen device nodes in their projects. The following is trying to summarize all the cases.

ugen nodes are exported by default for the following devices:
1. Any USB devices that have not a class or vendor unique driver in
2. USB storage devices bound to scsa2usb(7D) driver. (refer to
scsa2usb(7D) manpage)
3. USB printer devices bound to usbprn(7D) driver. (refer to
usbprn(7D) manpage)
4. For a multi-interface USB device, usb_mid driver is by default
attached to it.

If none of the device's interfaces are explicitly
bound to the ugen(7D) driver, then usb_mid driver will create ugen
nodes for the device.

ugen nodes are not by default exported for some USB devices (a USB mouse, for example),
because it is bound to hid driver by USB class number and hid driver
does not create ugen nodes.

Thursday Jun 12, 2008

A simple VNC step-by-step experience on OpenSolaris

VNC is really a good tool for sharing desktops to your remote peers.
The following is my personal experience with VNC on OpenSolaris. I am
running OpenSolaris build 86. It should be the same case in other

Check the binaries I am using:

$ which vncserver


$ which vncviewer


I add a new user "vncuser" with "Basic Solaris User" privilege.
(This step is just my personal favor. But it helps you to have a clean
test environment.)

# users-admin

Try the first run.

$ su - vncuser

$ vncserver

Some files will be created in $HOME/.vnc/ directory, including "xstartup".

Connect to the vncserver.

$ vncviewer localhost:1

A VNC desktop window appears.

The default window manager seems not that good. Edit the file
"xstartup" to use JDS desktop. Comment all lines, and add
"gnome-session" to it.

$ cat xstartup


#[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

#xsetroot -solid grey

#vncconfig -iconic &

#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

#twm &


Run vncserver again. This time I specify more options to customize
it a bit. (Check manpage vncserver(1) for details of the options.)

$ vncserver :16 -alwaysshared -deferupdate 100 -geometry 1024x768 -depth 16

Run vncviewer:

$ vncviewer localhost:16

I then see a nice desktop window appears.

BTW, to kill the VNC servers that are run above, just type:

$ vncserver -kill :1

$ vncserver -kill :16

Monday Jun 02, 2008

Association: The Difference between USB and Wireless USB

The Wireless USB technology from tries to make it easy for end
users to connect a wireless USB device with a wireless USB host, quoted
from the specification: “The goal is that end users view it as the same
as wired USB, just without the wires.
”. However, there have to be
something different because of the difference of wireless and wired
environment. The most significant thing is "Association". It is
something happened before the first time that a wireless USB device can
be enumerated by the host system.

Association is special for wireless host and device, it is new for
wired USB users and it is not a straight forward concept for most
people. But if we take a look at the following question, we might know
it well.

Suppose two PC boxes are put in one room, each of them has a WUSB host.
A user brings a WUSB device to the room and turn on the device radio.
The question is, which PC box should enumerate the device? Or the
question can be asked in another way, how can the user choose a PC box
with which he would like to connect the wireless device?

It is not a question at all if in a wired case: the user just plug the
device to the PC box with which he want to connect the device. In
wireless case, a new way must be invented to let the specific wireless
hosts and devices know that which device should be connected to which
host. So, comes the technologies called "Association Model". It
makes the specific WUSB host and device create a shared CC (Connection
Context). A CC includes three elements: CHID (Connection Host ID), CDID
(Connection Device ID), CK(Connection Key). Once the CC is created
during the association process, it will be saved in the non-volatile
memory on both host and device. Thus, the host and device will "know"
each other and trust each other in a wireless environment.

According to WUSB specification, there are two Association Models optional for device manufactures and users.

- Cable Association

  User need to connect the WUSB device with his PC box with a USB cable
for a few seconds. The WUSB host on the PC box then talks to the device
to create a CC. The user then unplug the WUSB device and need not to
plug it any longer, unless he decide to connect the WUSB device with
another PC. With the CC stored in both WUSB host and device, when user
turn on the device radio, because the device and host already know each
other, they can authentication each other and be connected just as
wired USB. The only difference is, the connection is over air.

- Numeric Association

  User need not a USB cable in this case. But the WUSB device need to
have a screen to display digit numbers. The process is, user turns on
the device radio, and run the WUSB administration software on the host
to specify a WUSB host on the system to start to associate itself with
the device which is beaconing. The specified WUSB host then talk to the
device over air and create a CC. Because it is performed in the open
radio, user is asked manually confirm the association. A digital number
is displayed both on the host system screen and the device screen. If
they are the same, user press OK on both sides. If not, then the
association is not right.

From the host software's view, there must be an utility to manage the
CCs stored in host system. Because, on one system (e.g., a PC box),
there could be multiple WUSB hosts. And also, there could be multiple
WUSB devices associated with a WUSB host. What's more, when system
booting up, a daemon is needed to load the CCs from file system to the
WUSB host driver instances. A specific CC belongs to a specific WUSB
host instance.
To support the above issue, on Solaris, a software design is under
review. A daemon wusbd is introduced to be used to manage the CCs for
WUSB hosts and devices. It add/remove the CCs to CC database, load the
CC to host driver instances. A admin tool wusbadm is introduced for
user interfaces. It sends requests to wusbd when needs to operate CCs.

After the association process, from the host software view or the end
user view, it is all the same as wired USB devices, e.g., device
enumeration, USB client driver attach, connect/disconnect event
handling, devfs nodes, etc.

One of the goals for this design is the similar as the what the WUSB
spec tells, to have a simple user interface and make end user view WUSB
the same as wired ones. Connect and play, just without wires. Users
just need to turn on the device radio to connect, or, turn off the
device to disconnect. And something better in WUSB case: there are
always enough "ports" there. A WUSB host is supposed able to connect up
to 127 WUSB devices, theoretically. So, you just put WUSB devices
around your PC box, associated for once, then enjoy them as USB ones,
and without wires.

Saturday Dec 15, 2007

In practice: Ekiga video conference

It happened on this Tuesday (December 11, 2007). By running the latest Solaris Express on laptops, we had the first dual way Ekiga video conference between Sun engineering teams in Beijing and headquarter staff in MPK, US. During the whole meeting, which lasted more than one hour, the video stream is quite stable and the video quality is fine. I like video conferences much than audio only ones. People smile to each other and wave to each other, very nice. Many people know each other by emails or by conference calls, now, they see faces and smiles.

Not like some dedicated video conference equipments, the hardware equipments we used are very simple, just a laptop + a webcams + a projector. All are low cost commodity devices. In Beijing conference room, we use a Lenovo laptop running Solaris Express (build 76) and a Logitech USB webcam. US staff were using the similar equipments.

More detail usage info about Ekiga application and USB webcam driver can be found in my previous blogs:
USB webcams and video conferencing on Solaris
Have a larger video size in Ekiga

Monday Nov 26, 2007

amsn on OpenSolaris

amsn is a nice instance chatting application. It supports video chatting. A talent community member just ported it to Solaris. I received emails from him and had a chance to see the screen shots of amsn running on Solaris. It looks great! The video is captured from a USB webcam which is supported by usbvc(7D) driver. The following link is also from him, the patch for Solaris is submitted to amsn community:

I believe Solaris users will enjoy it!

Have a larger video size in Ekiga

Learned from an Ekiga developer, Ekiga supports a larger video size if you change the default value by gconf-editor. It is easy to have a larger video size in Ekiga application. I tried the following on my Solaris desktops, it works.

Login JDS, run 

# gconf-editor

In the gconf-editor window, select apps->ekiga->devices->video->size. Change the value of size from 0 to 1. Before quit, click somewhere else to save the change. Done.

Note, you need to "fully" quit Ekiga before change the above value. My favorite way is to run 'pkill ekiga' first.

Thursday Oct 04, 2007

Build OpenSolaris Step by Step

The following are steps to build OpenSolaris. My co-workers and I figured out these steps according to the documents on These steps are easy to follow and tested on Solaris Express build 63.

1. Download & Install Build Environment:

1.1 Download Compiler (Sun Studio is the preferred compiler, and it is free)
Install the compiler according to the instructions at the download site.
The result should have the compilers installed in /opt/SUNWspro.

1.2 Download ON build tools package (SUNWonbld.PLATFORM.tar.bz2)
and install:

# cd $TEMP
# bunzip2 -c SUNWonbld.i386.tar.bz2 |tar xvf -

# yes y | pkgadd -d ./ SUNWonbld

1.3 Fetch ON (OS & Network) source code

# hg clone ssh://

Source tar balls have been deprecated in favour of the onnv project's Mercurial repository. Please see the onnv project page for more information on how to checkout/clone the repository to download the source.

1.4 Download Encumbered binaries tarball (on-closed-bins[-nd].PLATFORM.tar.bz2) for debug and non-debug version

Need to extract from tarball and put root_i386 and root_i386-nd under $CODEMGR_WS/closed,

For example:

If the source code is in "/export/testws/usr/src", then the binaries will be in "/export/testws/closed/root_PLATFORM"
(i.e., closed/root_i386 or closed/root_sparc). For non-debug version, it is closed/root_i386-nd or closed/root_sparc-nd.

2. Environment setup

2.1 PATH

# PATH=/opt/SUNWspro/bin:/opt/onbld/bin:/opt/onbld/bin/i386:$PATH

2.2 Copy and set environment file

# cp usr/src/tools/env/ /export/testws/
modify for your $CODEMGR_WS, $STAFF, $MAILTO settings

  • change GATE to none or the name of the top-level directory (e.g., "testws").

  • change CODEMGR_WS to the your workspace (e.g., "/export/testws").

  • change STAFFER to your login (e.g., root).

  • (optional) change MAILTO to you email address.

  • (optional) customize VERSION. This is the string that "uname -v"
    will print.

3. Build

3.1 Nightly Build (build the whole ON source)

# nightly ./ & tail -f log/nightly.log
nightly options:

  • -n: no bringover (default)

  • -i: incremental build (no clobber)

  • -D: do a build with DEBUG on

  • -F: do not do a non-DEBUG build

3.2 Single module Build

  • make a single module:
    bldenv; cd usr/src/uts/intel/i915; make
[ Reference links]

  • ON source
  • SUNWonbld
  • on-closed-bins

Thursday Sep 27, 2007

New USB webcams tested on Solaris

I received five Logitech webcams weeks ago. They are all new models, very fancy. I then had a quick test on Solaris Express. Four of them work well with Ekiga application integrated in Solaris, just plug and play. One of them can not work, the reason is that it does not conform to USB video class spec from, it needs chip specific driver. The other four webcams passed more tests later. I have updated one of my previous blog to add the names of them to a device list which tells all the tested webcams on Solaris video class driver (usbvc(7D)).

 Device Name                          Vendor ID, Product ID

Logitech Quickcam Pro for Notebooks       046d,0991
Logitech Quickcam Deluxe for notebooks    046d,09c1
Logitech Quickcam Communicate Deluxe      046d,0992
Logitech Quickcam Pro 9000                046d,0990

So far, there are about 9 or more webcams are supported by Solaris video class driver (usbvc(7D)). Again, for a full device list, please refer to my updated blog for USB video webcams and applications.

Tuesday Jul 17, 2007

Data Alignment Issue

If a data structure will be used in both a 32bits binary and a 64bits
binary, e.g., an ioctl structure which is passed from a 32bit
application to the 64bit kernel, then we need to consider the code
alignment issue. Because:

  •   The structure size might be different for a same structure.
  •   The offset of each structure member might be different for a same

The alignment can be decided by compiler options. The default compiler behavior will conform to the top rule: all structure members must start at its alignment addresses, and, the whole structure should start at the alignment address of its largest member.
For example, uint16_t will always start at even address, uint32_t will always align at 4 bytes boundary, etc. There are also some points as following:


    The whole structure's size will be according to the biggest member's
    alignment. e.g., if the biggest member is uint32_t, then the whole
    sizeof(struct) will be divided exactly by 4bytes.


    If there are "long", "pointer", or "long double" types in the
    members, then the alignment in 32bit and 64bit binaries will be
    different. Because they are different length. For example, if there is
    a pointer in a structure, then, in a 32bits binary, it aligns at 4
    address; in a 64bits binary, it aligns at 8 bytes address.


    The max alignment of 32bits binary is 32bits, The max alignment of
    64bits binary is 64bits. So, if there is a "long long" in a 32bits
    binary, it aligns at 4 bytes address; however, the same type aligns at
    8 bytes address in a 64bits binary.


    "enum" type is considered as uint_t.

Code alignment feature can be disabled by setting specific compiler options, such as, gcc -fpack-struct, which will remove the code alignment feature, that is, there are no gaps between structure members.

And "pack" pragma can also do the same job, details refer to the related section of "C User's Guide". Note that the pragma might cause problems on different hardware platforms.

The following table is comparing the data types between 32bits and 64bits binaries.

C Type                      ILP32                LP64

char                            8                    8
  short                          16                   16
  int                              32                   32
  long                           32                   64
  long long                   64                   64
  float                           32                   32
  double                       64                   64
  long double               96                   128
  pointer                      32                   64

An data structure Example:

    typedef enum list {

        a0 = 0,

        a1 = 1,

        a2 = 2,

    } list_t;

    struct align {

        uint16_t a;

        uint8_t  b;

        list_t    list;

        uint8_t    c;  

        uint8_t    d;  

    } sa;

offset_a=fffffd7fffdff954, offset_b=fffffd7fffdff956,
offset_list=fffffd7fffdff958, offset_c=fffffd7fffdff95c,
offset_d=fffffd7fffdff95d, sizeof_allign=12

Sunday Jun 24, 2007

USB Documents: for Solaris users and driver developers

I collected some useful links for Solaris USB users and driver developers as following. For ease of use, they are grouped into classes. Most of them are frequently updated and quite up to date. Before I put them here, I sent them to my colleagues, so you can also find them posted on some opensolaris forums by others.

USB overview

  1. Solaris USB FAQ
  2. Lists of USB devices verified on Solaris
  3. USB in the future -- Wireless USB technology

Using USB devices on Solaris

  1. Use USB devices on Solaris 10
  2. Use USB devices on Solaris Express
  3. Use USB printers on Solaris 10
  4. USB Security Script for USB device access control

Develop USB device drivers

  1. Develop USB drivers on Solaris
  2. USB project page on
  3. Documents for USB driver development on Solaris

Mail lists for Solaris USB user/developers



Colin Zou is a software engineer enjoying improving operating systems. Besides sitting at a computer all day like a dull boy, he also likes hiking and the activities on the beach.


« June 2016