[Galaxy S II Q&A, Help & Troubleshooting] E:V:A:
Recap of recent results

After the last post by Paul, things have become more clear. The following are the results I got up until then.

The problem is to understand why I can communicate with ATC's from

outside (USB connected) terminal, but not from a local (on phone)

terminal, like for example /dev/ttyGS0. At this point I do understand that

the "SAMSUNG Mobile USB Modem" interface, together with ADB drivers,

provides some kind of (USB to HCI-socket to Modem) protocol converter,

and probably speaks directly to RIL and not the CP or Modem. We now

know that this is the Proprietary protocol called "Samsung IPC Protocol".

But if this is the case I thought I should still be able to find (and intercept)

whatever internal sockets or protocols used, to be able to establish and

send ATC's to the modem. But so far I have only been able to do the

following.

The setup:

[MY-PC] [RealTerm] <-- USB-cable --> [I9100]

Sending ATC's here is working as expected. I then tried to find the

devices/sockets/processes that handle this communication, and suddenly

I found myself in very murky waters. Trying to connect to the various local

devices on the phone, and not to sockets, as I do not know how to do that.

I had partial success, when I earlier tracked down /dev/ttyGS0 as having

something to do with the DataRouter. As I used nc to connect to

the ttyGS0 device during a RealTerm session, like this:

# nc -f /dev/ttyGS0

I could send characters to

RealTerm side, but the Modem never got anything. And when I typed on

RealTerm, only a few characters appeared on ttyGS0, but the modem did

respond normally. So I concluded that /dev/ttyGS0 is somehow used for

receiving modem responses, while some other protocol or device is used

for transmitting to modem. (This is now confirmed by the previous posts!)

How did I do this?

Unlike on other/older Android phones, the ATC's are not shown in logcat

under the tag "D/AT" but rather under "E/DataRouter"! So open another

window (adb shell) session and run: # logcat DataRouter:E *:S

Then open your (PC) terminal and send a few ATC's.

When sending an "AT"command, they will appear as:

E/DataRouter( 2585): After the usb select
E/DataRouter( 2585): Before checking the modem suspend state
E/DataRouter( 2585): PDP is resumed now
E/DataRouter( 2585): After checking the modem suspend state
E/DataRouter( 2585): Path set is [B][COLOR=Black]DATA_PATH_CHAR_MODEM[/COLOR][/B]
E/DataRouter( 2585): Send [1] bytes to SMD. message:A
E/DataRouter( 2585): Sending data to SMD: Len = [1]
E/DataRouter( 2585): buffer = [A]
E/DataRouter( 2585): Wrote 1 chars to EXTERNAL PORT [B][COLOR=Red]fd=17 ch = 41[/COLOR][/B]
E/DataRouter( 2585): Before the usb select
E/DataRouter( 2585): After the Modem Read select
E/DataRouter( 2585): Read 1 chars from SMD Modem file fd = 17
E/DataRouter( 2585): buf = A
E/DataRouter( 2585): Wrote 1 chars to USB PORT fd=29
E/DataRouter( 2585): buf=A
E/DataRouter( 2585): Before the Modem Read select
E/DataRouter( 2585): After the usb select
E/DataRouter( 2585): Before checking the modem suspend state
E/DataRouter( 2585): PDP is resumed now
E/DataRouter( 2585): After checking the modem suspend state
E/DataRouter( 2585): Path set is DATA_PATH_CHAR_MODEM
E/DataRouter( 2585): Send [1] bytes to SMD. message:T
E/DataRouter( 2585): Sending data to SMD: Len = [1]
E/DataRouter( 2585): buffer = [T]

But I didn't know exactly what to make from this, for example;

a) What is the "ch = 41" specification? It is just the ASCII of an "A" sent to

a device/file called 17. But when writing, it is called "EXTERNAL PORT"

while on reading, it's from "SMD Modem file"...

b) What is the DATA_PATH_CHAR_MODEM variable? I cannot find any

reference to this anywhere! I then found the devices and sockets by

identifying the file handles (fd) in the (datarouter) process directory:

[B]# busybox ls -al --color=never /proc/2585/fd[/B]
fd=17 --> socket:[1904]
fd=29 --> /dev/ttyGS0

NOTE: I prefer to always use the busybox binaries, as I no longer trust

the Samsung ones to give the complete/proper information...

Given the more recent information from previous posts, I decided to look for svnet.

[B]# find / -iname "*svnet*"[/B]
/proc/sys/net/ipv4/neigh/svnet0
/proc/sys/net/ipv4/conf/svnet0
/proc/sys/net/ipv6/neigh/svnet0
/proc/sys/net/ipv6/conf/svnet0
...
/proc/[B][COLOR=SeaGreen]<process-id>[/COLOR][/B]/net/dev_snmp6/svnet0
...
/sys/devices/virtual/net/svnet0
/sys/bus/usb/drivers/cdc_svnet
/sys/class/net/svnet0
[B]
# ls -l /sys/devices/virtual/net[/B]
drwxr-xr-x root root 2012-02-03 05:56 lo
drwxr-xr-x root root 2012-02-02 12:34 svnet0
drwxr-xr-x root root 2012-02-02 12:34 sit0
drwxr-xr-x root root 2012-02-02 17:21 pdp0

These are all interesting and relevant , but I have no idea what

they all do... But /sys/bus/usb/drivers/cdc_svnet are all linked to

the HCI-USB devices under: /sys/devices/platform/s5p-ehci/usb1/1-2

and contain 4 of each of:

- "CDC Communication Interface"

- "CDC Data Interface"