2010年8月27日 星期五

How to use libupnp sample code

First, download the libupnp source code

http://sourceforge.net/projects/pupnp/files/

version is libupnp-1.6.6

now we extract and compiler it


mad@mad-desktop:~$ tar -jxvf libupnp-1.6.6.tar.bz2
mad@mad-desktop:~$ cd libupnp-1.6.6/
mad@mad-desktop:~/libupnp-1.6.6$ ./configure
mad@mad-desktop:~/libupnp-1.6.6$ make


now we compiler sample code


mad@mad-desktop:~/libupnp-1.6.6$ cd upnp/
mad@mad-desktop:~/libupnp-1.6.6/upnp$ cd sample/
mad@mad-desktop:~/libupnp-1.6.6/upnp/sample$ make check


now you can see the execute file.upnp_tv_ctrlpt and upnp_tv_device
upnp_tv_ctrlpt is UPnP control point and
upnp_tv_device is upnp virtual device
we execute it


mad@mad-desktop:~/libupnp-1.6.6/upnp/sample$ ./upnp_tv_device


you can see upnp virtual device information


mad@mad-desktop:~/LAB/libupnp/libupnp-1.6.6/upnp/sample$ ./upnp_tv_device
Initializing UPnP Sdk with
ipaddress = (null) port = 0
UPnP Initialized
ipaddress= 192.168.0.123 port = 49154
Specifying the webserver root directory -- ./web
Registering the RootDevice
with desc_doc_url: http://192.168.0.123:49154/tvdevicedesc.xml
RootDevice Registered
Initializing State Table
Found service: urn:schemas-upnp-org:service:tvcontrol:1
serviceId: urn:upnp-org:serviceId:tvcontrol1
Found service: urn:schemas-upnp-org:service:tvpicture:1
serviceId: urn:upnp-org:serviceId:tvpicture1
State Table Initialized
Advertisements Sent

>>


you can see the device's service at the url
http://192.168.0.123:49154/tvdevicedesc.xml



and then you execute control point

mad@mad-desktop:~/LAB/libupnp/libupnp-1.6.6/upnp/sample$ ./upnp_tv_ctrlpt


mad@mad-desktop:~/LAB/libupnp/libupnp-1.6.6/upnp/sample$ ./upnp_tv_ctrlpt
Initializing UPnP Sdk with
ipaddress = (null) port = 0

UPnP Initialized
ipaddress= 192.168.0.123 port = 49153

Registering Control Point
Control Point Registered




then you can see virtual device's discovery



======================================================================

----------------------------------------------------------------------

UPNP_DISCOVERY_SEARCH_RESULT

ErrCode = 0

Expires = 100

DeviceId = uuid:Upnp-TVEmulator-1_0-1234567890001

DeviceType = urn:schemas-upnp-org:device:tvdevice:1

ServiceType =

ServiceVer =

Location = http://192.168.0.123:49155/tvdevicedesc.xml

OS = Linux/2.6.28-18-generic, UPnP/1.0, Portable SDK for UPnP devices/1.6.6

Ext =

----------------------------------------------------------------------

======================================================================



to be continued

How to run 0xlab android 2.1 audio player on devkit8000

How to run 0xlab android 2.1 audio player

Step 1:

reference to:http://code.google.com/p/0xdroid/wiki/Source

then repo the android2.1 source code

just "make" it

when successfully built,we want to generated new root file system, just copy the rebuild file


mad@mad-desktop:~$ mkdir fatma
mad@mad-desktop:~$ cd fatma
mad@mad-desktop:~$ cp out/target/product/beagleboard/root/* .
mad@mad-desktop:~$ cd ~/fatma/system
mad@mad-desktop:~$ cp out/target/product/beagleboard/system/* .
mad@mad-desktop:~$ cd ~/fatma


solve thing the 0xlab cant play audio,we add some script command in android script


mad@mad-desktop:~$ vim ~/fatma/system/etc/init.goldfish.sh


add command to last line


# kernel 2.6.29
alsa_amixer set 'PredriveL Mux' DACL2
alsa_amixer set 'PredriveR Mux' DACR2
# kernel 2.6.32
# alsa_amixer set 'PredriveR Mixer AudioR2' on
# alsa_amixer set 'PredriveL Mixer AudioL2' on

alsa_amixer set PreDriv 100 unmute
alsa_amixer set 'DAC2 Digital Fine' 50



mad@mad-desktop:~$ vim ~/fatma/system/etc/init.omap3.sh


add command to last line


# kernel 2.6.29
alsa_amixer set 'PredriveL Mux' DACL2
alsa_amixer set 'PredriveR Mux' DACR2
# kernel 2.6.32
# alsa_amixer set 'PredriveR Mixer AudioR2' on
# alsa_amixer set 'PredriveL Mixer AudioL2' on

alsa_amixer set PreDriv 100 unmute
alsa_amixer set 'DAC2 Digital Fine' 50


ok! now we compress the "fatma folder" to ubi fs image

we must use CD's attach tool, copy three files"mkfs.ubifs","ubinize","ubinize.cfg" to the linux OS.


mad@mad-desktop:~$ mkdir fatmaubi
mad@mad-desktop:~$ cd fatmaubi
mad@mad-desktop:~$ ls
total 78344
drwxr-xr-x 2 mad mad 4096 2010-07-29 22:01 .
drwxr-xr-x 6 mad mad 4096 2010-07-29 17:28 ..
-rw-r--r-- 1 mad mad 174424 2010-01-04 19:28 mkfs.ubifs
-rw-r--r-- 1 mad mad 79030 2010-01-04 19:28 ubinize
-rw-r--r-- 1 mad mad 124 2010-01-04 19:28 ubinize.cfg


we must change file mode to excutable


mad@mad-desktop:~$ chmod 755 mkfs.ubifs
mad@mad-desktop:~$ chmod 755 ubinize
mad@mad-desktop:~$ sudo ./mkfs.ubifs -r ~/fatma -m 2048 -e 129024 -c 812 -o ubifs.img
generate ubifs.img
mad@mad-desktop:~$ sudo ./ubinize -o ubi.img -m 2048 -p 128KiB -s 512 ubinize.cfg
generate ubi.img


download the 0xloab's devkit8k-eclair-0x4.zip and flash-uboot.bin
http://downloads.0xlab.org/release/devkit8k-eclair-0x4/devkit8k-eclair-0x4.zip
http://downloads.0xlab.org/release/devkit8k-eclair-0x4/flash-uboot.bin
unzip devkit8k-eclair-0x4.zip,and put flash-uboot.bin to folder
now we can see 5 file

0xkernel.bin
android.ubi
flash-uboot.bin
install.conf
uImage.bin

reference to http://code.google.com/p/0xdroid/wiki/UsingPreBuiltImages
copy to SD card FAT32 partition

rename ubi.img to android.ubi and cover the android.ubi on the folder