QConsole is an utility I wrote to
allow me to login in my Symbian devices and perform certain operations
in a more easy and fast way than the standard GUI. Running applications
(especially gdbstub) with parameters was especially what drove with to
write QConsole. It is a
Syambian executable (exe) that listen to the next available RFCOMM
channel and serves only one connection at a time. While it is possible
to have multiple connections served at the same time, I think that
given the nature of Symbian devices, such feature can be skipped (at
least for the very first releases, and you can always run multiple
copies of QConsole). The QConsole client is available for
Linux and Windows. From now on I'll assume a Linux setup
though, even because a Windows workstation will typically work as-is
without requiring extra libraries to be installed.
Build
In order to use QConsole, you
need the QTTY console client (valid for QConsole and WmConsole), and
the qconsole
server EXE. Please take a look at the QTTY
home page for a description about how to build it and use it (no need
to build the Windows version if you don't want to - a pre-built binary
is availble inside the package). About the qconsole
EXE, you have the .mmp file, so you can use your preferred tools to
build an ARMI binary for your device. I personally use an
all-native-Linux SDK that allows me to run the full development cycle
on my Linux workstation (if I will find time to polish it, I will
probably publish my Perl scripts and modified tools somewhere on this
site). Once you built the qconsole EXE
(you can also use the ready-to-use SIS install package available for
download below, in case you're unwilling or unable to make a build),
you need to upload it on the device. I personally find the NFS
connection very handy for this (even though YMMV using p3nfs):
http://www.koeniglich.de/p3nfs.html
Through QConsole get and put commands you can still upload
and download files on and from your device though.
Setup
First off, setup you kernel to have BlueTooth modules available for
load, of directly linked inside the kernel. If you use a modern distro
they already are in the correct plane for you. If you're using an old
distro that doesn't have them, I'm assuming you can figure it out by
yourself how to compile a new kernel with the required features
(BlueTooth support). The you need to install BlueZ Linux packages to
set up the userspace infrastructure for BlueTooth. In my current setup:
# apt-cache search bluez
bluez-bluefw - Bluetooth firmware
loader
bluez-hcidump - Bluetooth HCI
protocol analyzer
bluez-libs - Bluetooth libraries
bluez-libs-devel - Development
libraries for Bluetooth applications
bluez-pan - Bluetooth PAN
bluez-pin - D-BUS Bluetooth PIN helper
bluez-sdp - Bluetooth SDP libraries
and utilities
bluez-sdp-devel - Development headers
and libraries for Bluetooth SDP
bluez-utils - Bluetooth utilities
If you're planning to play with Linux BlueTooth, I suggest you to
install them all. Then you can activate the BlueTooth stack. You can
use this simple script, that if all goes well should bring you BT stack
up in place:
#!/bin/sh
/usr/sbin/hciconfig hci0 up
/usr/sbin/hcid
/usr/sbin/sdpd
# HCI needs some time to "stabilize"
before it starts accepting commands (/me think)
sleep 4
/usr/sbin/hciconfig hci0 noauth
/usr/sbin/hciconfig hci0 name MYDEV
You can find out if everything went fine by doig:
# /usr/sbin/hciconfig -a
This is the output in my machine (will be different on yours, depending
mainly on the BT device you have):
hci0: Type: USB
BD Address: 00:04:61:80:77:0F ACL MTU: 192:8 SCO MTU: 64:8
UP RUNNING PSCAN ISCAN ENCRYPT
RX bytes:3521272 acl:126808 sco:0 events:30041 errors:0
TX bytes:4021524 acl:35060 sco:0 commands:1562 errors:0
Features: 0xff 0xff 0x0b 0x00
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: HOLD SNIFF PARK
Link mode: SLAVE ACCEPT
Name: 'MYDEV'
Class: 0x120104
Service Classes: Networking, Object Transfer
Device Class: Computer, Desktop workstation
HCI Ver: 1.1 (0x1) HCI Rev: 0x1bb LMP Ver: 1.1 (0x1) LMP Subver: 0x1bb
Manufacturer: Cambridge Silicon Radio (10)
The next step is to edit your /etc/bluetooth/pin
file to set a PIN different from "BlueZ". Then you can start by
activating the BlueTooth stack on your device. In my Nokia 6600 is
inside the "Connections" folder inside the main menu. Then, it is time
to pair your device with your PC BlueTooth link. Somewhere inside your
device's BlueTooth menus there is the option to pair your device with
other ones. Select that and let your portable device to scan for
available devices in your piconet. It should fine your PC node with the
name you set in your BT startup script (MYDEV in the example above).
Select it and input the PIN you set in your /etc/bluetooth/pin file. If it
doesn't accept it, you likely changed the /etc/bluetooth/pin after you
started the BT stack on your machine. Stop the BT stack with something
like:
#!/bin/sh
/usr/bin/killall -TERM sdpd
/usr/bin/killall -TERM hcid
/usr/sbin/hciconfig hci0 down
Then restart it again using the same script you used before. This time
you should be able to successfully pair you portable device with your
Linux box. It's not over on that side, since you will need to set you
Linux box BT node (that you just paired) as authorized. The qtty client accepts either BlueTooth
device names or BlueTooth device addresses to be specified with the
"--qc-addr BTADDR" command line directive. You can
use 'hcitool' to find out all reachable device in your area. In my
case it will show:
# hcitool scan
00:0E:6D:20:3E:ED
Dudi6600
Here "Dudi6600" is the name I gave to my BT device, and
"00:0E:6D:20:3E:ED" is the BT device address (BTADDR) we were searching
for. The next step involves editing the c:\system\data\qconsole.txt file to
change/add users. The file lists many lines in the "USERNAME PASSWORD"
format. It's time to start the QConsole
binary on your device, that, if nothing really wrong happen, will
display:
QConsole ready on channel NN
At this point you can finally run qtty to connect
with your device QConsole
server:
$ qtty --qc-addr BTADDR --qc-channel
NN --user USER --pass PASS
In my case it will end up to:
$ qtty --qc-addr Dudi6600 --qc-channel 4
--user USER --pass PASS
If you use BlueTooth device names instead of addresses, it can happen
that, if the BlueTooth name is not cached inside the qtty device cache file, it can take
ten to fitheen seconds for the name lookup (once the name is cached, it
will be instantaneous). You should see the QConsole
welcome message and its prompt ("$ "). The default USER as installed by
the .SIS file supplied with the tarbal is "qconsole", while the default
PASS is "server" (and you are suggested to change them).
Commands
Reference
[help]
Usage:
help
Prints the QConsole help screen.
[pwd]
Usage:
pwd
Prints the current working
directory. File names that are not prepended by drive names or
backslash are assumed from the current directory (pwd).
[exit]
Usage:
exit
Quits the QConsole session.
[shutdown]
Usage:
shutdown
Quits the QConsole session and tells
the QConsole server to shutdown.
[reboot]
Usage:
reboot
Quits the QConsole session and
reboot the remote device.
[cd]
Usage:
cd DIR
Change the current directory to DIR.
The DIR parameter can be the string "..", that will make the current
directory to go up one level.
[ls]
Usage:
ls [DIR/FILE]
Lists the current directory or the
specified path.
[ps]
Usage:
ps
Lists currently running processes.
The format of the output lines is:
PID PPID FLG
PRI UID2 UID3 NAME
Where:
PID = Process Id
PPID = Owner process Id
FLG = Flags:
P = Protected
R = Loaded from ROM
PRI = Priority
UID2 = Second UID of the
application
UID3 = Third UID of the
application
NAME = Process name
[kill]
Usage:
kill PID
Terminates the process identified by
PID.
[prio]
Usage:
prio PID PRIO
Adjust process PID priority to PRIO.
the priority PRIO can be one of:
L = Low
B = Background
F = Foreground
H = High
[prot]
Usage:
prot PID PROT
Set/unset process PID protected
state. The PROT parameters can be one of:
P = Protected
U = Unprotected
[pinf]
Usage:
pinf PID
Display process PID informations.
[pren]
Usage:
pren PID NAM
Change process PID name to NAME.
[run]
Usage:
run APP/EXE ...
Starts the application or exe with
the specified parameters.
[drives]
Usage:
drives
Lists available drives and
associated information. The output of the command is composed by many
lines with the format:
DR
FST SIZE FREE
Where:
DR = Drive name
FST = File system type
SIZE = Drive size in Kb
FREE = Drive's free space in Kb
[mkdir]
Usage:
mkdir DIR
Creates the directory specified by
DIR.
[rmdir]
Usage:
rmdir DIR
Removes the directory specified by
DIR.
[rmtree]
Usage:
rmtree DIR
Removes the whole tree underneath
DIR. Note that no confirmation is asked, so the command can result
pretty dangerous.
[rm]
Usage:
rm FILE
Removes the file specified by FILE.
[chmod]
Usage:
chmod MODE FILE
Change the access mode of FILE
applying MODE changes. The MODE paremeter is composed by a first
character either '+' (add mode) or '-' (remove mode), and one or more
mode characters:
h = Hidden
w = Write
s = System
[mv]
Usage:
mv OLD NEW
Renames files or directories from
OLD to NEW. The two file names must be on the same drive for the `mv`
command to succeed.
[cp]
Usage:
cp SRC DST
Copy SRC file onto DST file.
[cat]
Usage:
cat FILE
Dump the content of remote file FILE
on screen.
[lsthr]
Usage:
lsthr [PID]
Lists threads of process PID, or all
existing threads if PID is not specified. The output of the command is
composed by multiple lines with the format:
TID PID FLG
PRI HSIZ SSIZ PH TH NAME
Where:
TID = Thread Id
PID = Process Id
FLG = Thread flags:
P = Protected
R = Loaded from ROM
PRI = Thread priority
HSIZ = Heap size in Kb
SSIZ = Stack size in Kb
PH = Process
handle count
TH = Thread handle
count
NAME = Thread name
[lssem]
Usage:
lssem
Lists all global semaphores
available on the system. The output of the command is composed by
multiple lines with the format:
CNT NAME
Where:
CNT = Semaphore internal
count value
NAME = Semaphore name
[lsrchk]
Usage:
lsrchk
Lists all global memory chunks
available on the system. The output of the command is composed by
multiple lines with the format:
CSIZ
MSIZ FLG MADDR NAME
Where:
CSIZ = RChunk current size in
Kb
MSIZ = RChunk maximum size in
Kb
FLG = RChunk flags:
R = Readable
W = Writable
MADDR = Mapping address seen by the
QConsole process
NAME = RChunk name
[lspdd]
Usage:
lspdd
Lists all physical devices
available on the system. The output of the command is composed by
multiple lines with the format:
NAME
Where:
NAME = Physical device name
[lsldd]
Usage:
lsldd
Lists all logical devices
available on the system. The output of the command is composed by
multiple lines with the format:
NAME
Where:
NAME = Logical device name
[lsdll]
Usage:
lsdll
Lists all loaded DLLs
available on the system. The output of the command is composed by
multiple lines with the format:
NAME
UID2 UID3 FILENAME
Where:
NAME = DLL
internal name
UID2 = Seconds UID of the DLL
UID3 = Third UID of the DLL
FILENAME = Full path of the executable from where the DLL was loaded
from
[hdump]
Usage:
hdump
Dumps all the device infromation available on the system.
[find]
Usage:
find PATH MATCH
Recursively searches inside PATH for MATCH file or directory name
(wildcards are allowed in MATCH).
[getchk]
Usage:
getchk CHK LOC
Dumps the content of the remote
chunk (on device) CHK to local file LOC.
[get]
Usage:
get [-R] REM LOC
Copies the remote file(s) (on
device) REM to local file/path LOC. Wildcards allowed in REM. Allowed
flags for the command are:
R =
Recurse to subdirectories
[put]
Usage:
put [-fR] REM LOC
Copies the local file(s) LOC to the
remote file/path (on device) REM. Wildcards allowed in LOC. Allowed
flags for the command are:
R = Recurse to subdirectories
f = Force the missing subdirectories creation
Download
The latest version of QConsole
is available here:
qconsole-1.60.tar.gz
Note: When updating the qconsole binary on the device to the newest
version, you need also get the latest QTTY
console client since changes in the protocol might be required in order
to support new features.
Author
QConsole has been written by
Davide Libenzi <[email protected]>
(across an hot summer 2004 weekend) and is released to public domain
under GPL version 2
(please read the COPYING file included in the source tarbal). For the
author home page you can click here.
Links
FreshMeat Home Page