[Gen9, Gen10 General] scholbert:
tweaking UsbKeyManager

Hi,

i just thought to start over here to further discuss about 3G sticks on our G9 tablets.

The last days i did some investigations how stuff is handled with the supported Archos 3G stick.

In general i'd like to tweak some settings in UsbKeyManager to handle other devices as well and find a way how this could be reached.

Basically the manager interacts with libtcl-ril.so to handle most of the modem stuff (e.g. AT commands are implemented here).

Furthermore it would be awesome to get essential USSD commands to work or write a simple app that works with the given ril libraries provided by Archos.

So i started to diassemble a deodexed version with apktool.

Please see the attachment for the sources.

Most essential parts are simply compiled in (this had been stated before) and that's why sticks from other manufacturers won't work.

Here's is a sequence from Key3GService.smali:

# direct methods
.method public constructor <init>(Landroid/content/Context;)V
.locals 13
.parameter "context"

.prologue
const/16 v1, [B]0x1bbb[/B]

const/4 v12, 0x0

const/4 v9, 0x1

const/4 v10, 0x0

.line 208
invoke-direct {p0}, Lcom/archos/key3g/IKey3GService$Stub;-><init>()V

.line 96
new-array v11, v9, [Lcom/archos/usbkeymanager/KeyInfo;

new-instance v0, Lcom/archos/usbkeymanager/KeyInfo;

const/16 v2, [B]0xb7[/B]

const-string v3, "[B]/system/lib/libtcl-ril.so[/B]"

const-string v4, "[B]ttyHS3[/B]"

const-string v5, "[B]ttyHS4[/B]"

invoke-direct/range {v0 .. v5}, Lcom/archos/usbkeymanager/KeyInfo;-><init>(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

aput-object v0, v11, v10

iput-object v11, p0, Lcom/archos/usbkeymanager/Key3GService;->mKeyInfos:[Lcom/archos/usbkeymanager/KeyInfo;

.line 105
new-array v0, v9, [Lcom/archos/usbkeymanager/MscInfo;

new-instance v2, Lcom/archos/usbkeymanager/MscInfo;

const v3, 0xf000

const-string v4, "1bbb_f000"

invoke-direct {v2, v1, v3, v4}, Lcom/archos/usbkeymanager/MscInfo;-><init>(IILjava/lang/String;)V

aput-object v2, v0, v10

iput-object v0, p0, Lcom/archos/usbkeymanager/Key3GService;->mUsbMscInfos:[Lcom/archos/usbkeymanager/MscInfo;

As you might see the highlighted parts in source code directly refer to the Archos 3G stick (e.g. vendor, product, library, device nodes).

Further i found out that on the Archos G9 actually two ports are used to establish data connection:

/dev/ttyHS3 is the AT interface to work with the chat tool

/dev/ttyHS4 seems to be the data interface for pppd

Actually this is nothing new, but i put it down here for completeness...

While using a linux host there are five interfaces after loading usbserial:

/dev/ttyUSB0...4

It seems that 0..2 are not needed for modem function and had been left out in the Android enumeration process (could be service or debug interfaces with binary transfer modes).

So if we start to think about implementing other devices, we'll actually have to tweak these parts in UsbKeyManager sources and recompile the smali code.

Handling the usb_modeswitch is another thing, but more or less trivial if we got the other stuff to work.

For example the usb_modeswitch command has to fit the given hardware and placed in /etc/usb_modeswitch.

Anyway, this might be a nice playground and i'd like to know your thoughts about it :rolleyes:

See this thread as well:

http://xdaforums.com/showthread.php?t=1504719

Have fun!

scholbert