[A][SGS2][Serial] How to talk to the Modem with AT commands - Galaxy S II Q&A, Help & Troubleshooting

This is a LIVE guide to communicating with your phones modem by AT commands. The information contained here is collected on a continuous basis from various places after having some trouble finding all relevant information in one place. Now this place is here, and if not please post a comment on what's missing and where to find it, if you do know.
All results in this guide have been obtained using a Samsung Galaxy S2 running a stock rooted GB 2.3.4 with PDA:XWKI4 and PHONE:XXKI1 on the 2.6.35.7 Kernel.
The key documents to have as a reference when working with the Android AT command set are found at the 3GPP site. In particular these 2 documents:
[1] The ETSI GSM 07.07 (3GPP TS 27.007) specifies AT style
commands for controlling a GSM phone or modem.
[2] The ETSI GSM 07.05 (3GPP TS 27.005) specifies AT style
commands for managing the SMS feature of GSM.
These documents exists in many different versions, so they are not all equal in content. Make sure to check what document version you are using.
Background
To better understand mobile phone modems and the underlying hardware I strongly recommend reading Harald Welte's "Anatomy of contemporary GSM cellphone hardware" [3] and Telica's "Challenges in integrating modems on Open Platforms" [4]. To summarize enormously, I can say this. On a modern Android based "smart phone", there are essentially two processors. The Application Processor (AP) where your Android operating system (AOS) and user interface (UI) lives, and the Baseband/Cellular Processor (BP/CP) where all the GSM and other high-tech communication magic happens, including the modem we wish to communicate with. In the most modern phones the BP and the AP and all possible other peripheral devices are integrated into one piece of hardware, loosely known as a Smartphone or System on a Chip (SoC). On this SoC there are a number of peripheral devices such as RTC, UARTs, SPI, I2C, USB ports, SD/MMC card controllers and an ISO7816 SIM card reader. However, to preserve the layered hardware structure, the AP and BP still communicates via UART (serial line), USB, SPI or through shared RAM and/or a combination of these. Therefore there will always be some path directly accessible from the outside that we should be able to use to communicate directly with the BP. Exactly how this is done, is mostly unknown due to the closed source and protectionisitc nature of the SoC manufacturers, to the great dismay of the developer community.
Although there are several methods for invoking and controlling modem services, the two most common are through the AT Commands (ATC) and/or through Remote Procedural Calls (RPC). The ATC method is by far the most popular and the ATC set can be categorized as follows.
Code:
Call Control: Commands for initiating and controling calls.
Data Call Control: Commands for controlling the data transfer and QoS.
Network Service: Commands for Supplementary services,ME, operator
selection, locking and registraction.
SMS Control: Commands for sending, notifying, setting SMS services.
ME Control & Status: Commands for ME power,keypad,display,phonebook,RTC's.
The AOS provide support for this framwork in the Radio Interface Layer (RIL), which acts as the interface between the radio HW and the Java Applicaiton Programming Interface (API). However, the RIL is divided into 3 parts or layers if you want. (These are just arbitrary, and not GSM layers!)
L3. The Java RIL (AOS API) accessible to all but with a limited set of commands.
L2. The RIL Daemon (RILJ) acting as an interface between AOS and the Vendor RIL.
L1. The Vendor RIL, which is a closed-source and HW-specific implemetation.
L0. The OEM/Vendor modem HW and firmware then acts on the L1 ATC's. (?)
Thus the job of the RIL is to translate all the telephony requests from the Android telephony framework and map them to the corresponding AT commands to the modem, and back again.
Here are two useful pictures that try to explain the various RIL layers.
Fig.1.
Fig.2.
Finding the correct serial device for the phone modem
In your phone you will find hundreds of devices listed under /dev. Knowing which one is the serial device(s) used for communicating with your Baseband Processor's (BP) Modem, is key in getting a useful AT communication going. Here it is also good to know that there are several serial devices connected to the BP. These connections are working in parallel through a MUX. So it is very likely you will be able to use several different devices to send AT commands with.
So how do we find an appropriate local serial device on the phone? One way is of course to try to connect via some terminal application to all devices and send some AT commands and look for a response, but that is not very scientific or practical. Different phones may use different default (Modem) serial devices. One way to find the serial devices is by listing available tty drivers.
Code:
# cat /proc/tty/drivers
...
rfcomm /dev/rfcomm 216 0-255 serial
g_serial /dev/ttyGS 253 0 serial
ttySAC /dev/s3c2410_serial 204 64-68 serial
serial /dev/ttyS 4 64-67 serial
...
So what are these doing and which one should we try?
After Googling around we suspect that:
rfcomm = Used by Bluetooth serial devices
ttySAC = Used by serial SAmsung Console
g_serial = "DataRouter" (also see dun: (10,123) )
In addition and thanks to the documentation in Adam Outler's info package [5], it can be inferred from the block diagram that perhaps:
Code:
s3c2410_serial0 - UART0 - Bluetooth (ttySAC)
s3c2410_serial1 - UART1 - GPS
s3c2410_serial2 - UART2 - AP PMIC - A/S1 ??
s3c2410_serial3 - UART3 - AP PMIC --> AP Level Shifter --> BP UART ??
s3c2410_serial4 - UART4 - not used?
(PMIC = Power Management IC)
The block diagram is this one, from the SGS-2 service manual.
Connecting using: a local terminal application or the ADB shell
So from our previous results, we would suspect that we could use /dev/ttyGS0. Since Busybox contain the microcom terminal program, we can simply do:
Code:
# busybox microcom -t 5000 /dev/ttyGS0
AT
ATI
<nothing> :(
However, although the connection is successful, there is no AT reaction on that line...
[EDIT] (See notes in a later post.)
Connecting using: Windows
If you are using Windows, you can go into Device Manager (DM) to find the correct port(s) used by your phone. However, depending on whether you set your phone to be used as a "USB mass storage" device or not, there may appear different devices in the DM. Here we assume that we just physically connect the phone and do nothing more. I.e. We're not using the device as a USB storage.
Next, under the device class listed as "Modems", you will probably find at least two modem devices. For example, I have one called "HDAUDIO Soft Data Fax Modem with SmartCP", which has nothing to do with Samsung and most likely came with the computer with some bloatware. The other one is called "SAMSUNG Mobile USB Modem", which is what we want. Then right-click to open Properties of the USB Modem device and navigate to the "Diagnostics" tab. Click on the "Query Modem" to send some test AT commands to your modem. If this doesn't work, you have a problem, and I don't have an answer. The result should look something like this:
Code:
ATQ0V1E0 - OK
AT+GMM - AT+GMM
GT-I9100
AT+FCLASS=? - (0,8)
AT#CLS=? - COMMAND NOT SUPPORTED
AT+GCI? - COMMAND NOT SUPPORTED
AT+GCI=? - COMMAND NOT SUPPORTED
ATI1 - Manufacturer: SAMSUNG
Model: I9100
Revision: I9100XXKI1
IMEI: xxxxx
ATI2 - Manufacturer: SAMSUNG
Model: I9100
Revision: I9100XXKI1
IMEI: xxxxx
...
See below for an explanation of these commands.
Now try this yourself with some terminal application. My personal favorite is the free and fully feature loaded "RealTerm". In the Display tab, use ANSI and check the "newLine mode" box, then in the Port tab, find your port as listed in Device Manager. For example, for me the modem port is located on COM port 12. This is listed as "12=\ssudmdm0000" in RealTerm.
Connecting using: Cygwin (on Windows)
First thing to know about using Cygwin, is that the windows COMn ports are addressed as /dev/ttyS[n-1], thus if you have connected your phone with a USB cable, and you find it is connected to COM port 12, then it will be accessible only through /dev/ttyS11 under Cygwin. Other terminal applications may use different ports. In addition you need to have installed/compiled some terminal program like: picocom, microcom or cu etc. Also make sure the COM port is not already occupied by another terminal program.
$ picocom /dev/ttyS11
...
This works as expected.
Some basic AT command structure
I'm not going to say much about the AT commands themselves, as they are almost as old as home computers themselves. However, let's have a brief look at the "Modem Query" above.
Code:
ATQ0V1E0
- This is actually a concatenation of the 3 commands:
(ATQ0 + ATV1 + ATE0) where:
ATQ0 - Disables echo suppression
ATV1 - Enables Verbose command results mode
ATE0 - Turns off local Echo
AT+GMM
- This one doesn't work in direct serial mode (!) and
is equivalent to AT+CGMM which shows the device model
identification. (I9100)
AT+FCLASS=?
- This queries the phone (TA) mode: (data, fax, voice etc.)
ATI
- This lists: Manufacturer, Model, Revision, IMEI
NOTE: AT commands can be concatenated on one line with each line starting with AT, and each command separated by ";". In some cases the semicolon is not needed. Typically a command without "=" or "?" is a general command, that sets or gets some parameters. But any command with "=" is a setting command, unless it is directly followed by "?", in which case you are querying the available/allowed parameters and their range. If the command is followed by "?" without a "=" it is a query, asking the values for something.
WARNING!​DO NOT SEND RANDOM COMMANDS/CHARACTERS TO YOUR PHONE MODEM
Many AT commands can easily wipe or brick your phone or SIM card!
I am in no way responsible for anyone bricking their phones, and
I cannot help you if you do so. So you better know exactly what you
send before you send anything at all.​
General AT command list extracted from 3GPP TS 27.007
Here is a list with general AT commands and a brief description of their functions and the document section they are found at. The document version I used for the info extraction is shown on the first line.
Note: Several of these commands are deprecated or simply not available on the Android/Samsung phone modems, at least not int he form shown in that document.
Code:
3GPP TS 27.007 Release 9 145 V9.4.0 (2010-06)
AT+CAAP 7.25 - Automatic answer for eMLPP Service
AT+CACM 8.25 - Accumulated call meter
AT+CAEMLPP 7.22 - eMLPP Priority Registration and Interrogation
AT+CAHLD 11.1.3 - Leave an ongoing Voice Group or Voice Broadcast Call
AT+CAJOIN 11.1.1 - Accept an incoming Voice Group or Voice Broadcast Call
AT+CALA 8.16 - Alarm
AT+CALCC 11.1.6 - List current Voice Group and Voice Broadcast Calls
AT+CALD 8.38 - Delete alarm
AT+CALM 8.20 - Alert sound mode
AT+CAMM 8.26 - Accumulated call meter maximum
AT+CANCHEV 11.1.8 - NCH Support Indication
AT+CAOC 7.16 - Advice of Charge
AT+CAPD 8.39 - Postpone or dismiss an alarm
AT+CAPTT 11.1.4 - Talker Access for Voice Group Call
AT+CAREJ 11.1.2 - Reject an incoming Voice Group or Voice Broadcast Call
AT+CAULEV 11.1.5 - Voice Group Call Uplink Status Presentation
AT+CBC 8.4 - Battery charge
AT+CBCAP 8.59 - Battery Capacity
AT+CBCHG 8.61 - Battery Charger Status
AT+CBCON 8.60 - Battery Connection Status
AT+CBCS 11.3.2 - VBS subscriptions and GId status
AT+CBKLT 8.51 - Backlight
AT+CBST 6.7 - Select bearer service type
AT+CCFC 7.11 - Call forwarding number and conditions
AT+CCHC 8.46 - Close Logical Channel
AT+CCHO 8.45 - Open Logical Channel
AT+CCLK 8.15 - Clock
AT+CCUG 7.10 - Closed user group
AT+CCWA 7.12 - Call waiting
AT+CCWE 8.28 - Call Meter maximum event
AT+CDIP 7.9 - Called line identification presentation
AT+CDIS 8.8 - Display control
AT+CEAP 8.47 - EAP authentication
AT+CEER 6.10 - Extended error report
AT+CEMODE 10.1.28 - UE modes of operation for EPS
AT+CEPTT 11.1.10 - Short Data Transmission during ongoing VGCS
AT+CEREG 10.1.22 - EPS network registration status
AT+CERP 8.48 - EAP Retrieve Parameters
AT+CFCS 7.24 - Fast call setup conditions
AT+CFUN 8.2 - Set phone functionality
AT+CGACT 10.1.10 - PDP context activate or deactivate
AT+CGATT 10.1.9 - PS attach or detach
AT+CGCLASS 10.1.17 - GPRS mobile station class
AT+CGCLOSP 10.1.13 - Configure local Octet Stream PAD parameters
AT+CGCMOD 10.1.11 - PDP Context Modify
AT+CGCONTRDP 10.1.23 - PDP Context Read Dynamic Parameters
AT+CGCS 11.3.1 - VGCS subscriptions and GId status
AT+CGDATA 10.1.12 - Enter data state
AT+CGDCONT 10.1.1 - Define PDP Context
AT+CGDSCONT 10.1.2 - Define Secondary PDP Context
AT+CGEQOS 10.1.26 - Define EPS Quality Of Service
AT+CGEQOSRDP 10.1.27 - EPS Quality Of Service Read Dynamic Parameters
AT+CGEREP 10.1.19 - Packet Domain event reporting
AT+CGLA 8.43 - Generic UICC Logical Channel access
AT+CGMI 5.1 - Request manufacturer identification
AT+CGMM 5.2 - Request model identification
AT+CGMR 5.3 - Request revision identification
AT+CGREG 10.1.20 - GPRS network registration status
AT+CGSMS 10.1.21 - Select service for MO SMS messages
AT+CGSN 5.4 - Request product serial number identification
AT+CGTFT 10.1.3 - Traffic Flow Template
AT+CGTFTRDP 10.1.25 - Traffic Flow Template Read Dynamic Parameters
AT+CHLD 7.13 - Call related supplementary services
AT+CHSC 6.15 - HSCSD current call parameters
AT+CHSD 6.12 - HSCSD device parameters
AT+CHSR 6.16 - HSCSD parameters report
AT+CHST 6.13 - HSCSD transparent call configuration
AT+CHSU 6.17 - HSCSD automatic user initiated upgrading
AT+CHUP 6.5 - Hangup call
AT+CIMI 5.6 - Request international mobile subscriber identity
AT+CIND 8.9 - Indicator control
AT+CKPD 8.7 - Keypad control
AT+CLAC 8.37 - List all available AT commands
AT+CLAE 8.31 - Language Event
AT+CLAN 8.30 - Set Language
AT+CLCC 7.18 - List current calls
AT+CLCK 7.4 - Facility lock
AT+CLIP 7.6 - Calling line identification presentation
AT+CLIR 7.7 - Calling line identification restriction
AT+CLVL 8.23 - Loudspeaker volume level
AT+CMAR 8.36 - Master Reset
AT+CMEC 8.6 - Mobile Termination control mode
AT+CMEE 9.1 - Report mobile termination error
AT+CMER 8.10 - Mobile Termination event reporting
AT+CMOD 6.4 - Call mode
AT+CMOLR 8.50 - Mobile Originated Location Request
AT+CMOLRE 9.1 - Report mobile originated location request error
AT+CMOLRE 9.3 - Mobile termination error result code
AT+CMTLR 8.57 - Mobile Terminated Location Request notification
AT+CMUT 8.24 - Mute control
AT+CMUX 5.7 - Multiplexing mode
AT+CNAP 7.30 - Calling name identification presentation
AT+CNUM 7.1 - Subscriber number
AT+COLP 7.8 - Connected line identification presentation
AT+COLR 7.31 - Connected line identification restriction status
AT+COPN 7.21 - Read operator names
AT+COPS 7.3 - PLMN selection
AT+COTDI 11.1.9 - Originator to Dispatcher Information
AT+CPAS 8.1 - Phone activity status
AT+CPBF 8.13 - Find phonebook entries
AT+CPBR 8.12 - Read phonebook entries
AT+CPBS 8.11 - Select phonebook memory storage
AT+CPBW 8.14 - Write phonebook entry
AT+CPIN 8.3 - Enter PIN
AT+CPLS 7.20 - Selection of preferred PLMN list
AT+CPNET 7.27 - Preferred network indication
AT+CPNSTAT 7.28 - Preferred network status
AT+CPOL 7.19 - Preferred PLMN list
AT+CPOS 8.55 - Positioning Control
AT+CPOSR 8.56 - Positioning Reporting
AT+CPPS 7.23 - eMLPP subscriptions
AT+CPROT 8.42 - Enter protocol mode
AT+CPSB 7.29 - Current Packet Switched Bearer
AT+CPUC 8.27 - Price per unit and currency table
AT+CPWC 8.29 - Power class
AT+CPWD 7.5 - Change password
AT+CR 6.9 - Service reporting control
AT+CRC 6.11 - Cellular result codes
AT+CREG 7.2 - Network registration
AT+CRLA 8.44 - Restricted UICC Logical Channel access
AT+CRLP 6.8 - Radio link protocol
AT+CRMC 8.34 - Ring Melody Control
AT+CRMP 8.35 - Ring Melody Playback
AT+CRSL 8.21 - Ringer sound level
AT+CRSM 8.18 - Restricted SIM access
AT+CSCC 8.19 - Secure control command
AT+CSCS 5.5 - Select TE character set
AT+CSDF 6.22 - Settings date format
AT+CSGT 8.32 - Set Greeting Text
AT+CSIL 6.23 - Silence Command
AT+CSIM 8.17 - Generic SIM access
AT+CSNS 6.19 - Single numbering scheme
AT+CSQ 8.5 - Signal quality
AT+CSSAC 7.32 - Service Specific Access Control restriction status
AT+CSSN 7.17 - Supplementary service notifications
AT+CSTA 6.1 - Select type of address
AT+CSTF 6.24 - Settings time format
AT+CSVM 8.33 - Set Voice Mail Number
AT+CTFR 7.14 - Call deflection
AT+CTZR 8.41 - Time Zone Reporting
AT+CTZU 8.40 - Automatic Time Zone Update
AT+CUAD 8.49 - UICC Application Discovery
AT+CUSD 7.15 - Unstructured supplementary service data
AT+CVHU 6.20 - Voice Hangup Control
AT+CVIB 8.22 - Vibrator mode
AT+CVMOD 6.4 - Voice Call Mode
AT+FCLASS C.2.1 - Select mode
AT+VBT C.2.2 - Buffer threshold setting
AT+VCID C.2.3 - Calling number ID presentation
AT+VGR C.2.4 - Receive gain selection
AT+VGT C.2.5 - Transmit gain selection
AT+VIP C.2.6 - Initialise voice parameters
AT+VIT C.2.7 - Inactivity timer
AT+VLS C.2.8 - Line selection
AT+VRX C.2.9 - Receive data state
AT+VSM C.2.10 - Select compression method
AT+VTD C.2.12 - Tone duration
AT+VTS C.2.11 - DTMF and tone generation
AT+VTX C.2.13 - Transmit data state
Questions and Help Needed
Q1: What is the correct device on the SGS2, for ATC communication to the modem?
Q2: How and where is this device selected/configured?
Q3: What do the various Proprietary AT commands (AT+X...) do?
Q4: Where can I find more documentation on the BP/CP?​References:
[1] http://www.3gpp.org/ftp/Specs/html-info/27007.htm
[2] http://www.3gpp.org/ftp/Specs/html-info/27005.htm
[3] Harald Welte's "Anatomy of contemporary GSM cellphone hardware"
http://laforge.gnumonks.org/papers/gsm_phone-anatomy-latest.pdf
[4] Telica's White Paper: "Challenges in integrating modems on Open Platforms"
http://teleca.com/Home/news_room/Whitepapers.aspx
[5] Adam Outler's "The all-in-one Galaxy S2 Hack Pack"
[6] Fabien Sanglard's non-blog: "Tracing the baseband":
http://fabiensanglard.net/cellphoneModem/index2.php
[7] "Android Application Development" (Android Telephony Internals, Ch.15.2),
R.Rogers/J.Lombardo, O'Reilly Media 2009
http://androidapps.org.ua/i_sect18_d1e18369.html
​Keywords: AT Commands, Modem, Terminal, CDC-ACM, RIL, Serial, UART
If you like this work, please hit the thank you button!

The GT-I9100 Baseband Processor (BP/CP) Specifications
Currently I have got two different specifications regarding what BP is used in the SGS2, most likely due to the different versions available of the SGS2 in Europe vs. USA. The ones I have are:
Intel/Infineon XMM6260 is the "platform" that consists of:
a) The X-GOLD 626 (ARM1176?, 40nm) baseband processor
b) The SMARTi UE2 RF-transceiver (65nm CMOS)
c) The 3GPP Release 7 HSPA+ protocol stack with:
Downlink: Category 14, Uplink: Category 7
d) Alternative Names*: Infineon IFX6260 = Intel IMC6260 = Intel XMM6260
e) Picture: http://www.infineon.com/export/sites/default/media/press/Image/press_photo/X-GOLD626.jpg
f) Datasheet: N/A
g) Most likely used in European phones
h) is apparently also present in the iPhone 4S.. (check!)
i) Closest available documentation:
XMM6160 (X-GOLD 616, ARM1176) which is also used in the SGS-1:
http://www.infineon.com/dgdl/X-GOLD...f0004&fileId=db3a30431ed1d7b2011f5bee88ef75eb
The biggest difference is in the SMARTi-UE RF-chip. BP remains similar.
XMM6180 (X-GOLD 618, ARM1176 @416 MHz) used in the iPhone4 & iPad2:
http://www.infineon.com/dgdl/X-GOLD...f0004&fileId=db3a30431ed1d7b2011f5bec418f75e6
.
Qualcomm QSC6085 (65nm,424 CSP, 12x12mm) contain:
a) BP: ARM926EJS @ 192 MHz
b) + QDSP @ 96 MHz (also on BP)
c) Modem: IS-95 A/B, 1X Rel.0, EVDOr0, EVDOrA
d) is apparently also present in the "Verizon Wireless USB760 Modem"
e) Picture: N/A
f) Datasheet: N/A
g) Most likely used in North American (US) phones (CDMA)
*It should be noted that Infineon Technologies (Wireless Division) has been acquired by Intel Mobile Communications, in early 2011.
In fact these two differences just made a whole lot of sense from the available AT command sets. Basically the modem specific AT commands immediately give up the manufacturer of the modem firmware. (Yes, competing OEM developers do work together!) Because the command sets usually consists of 3 types.
The old school "Hayes" AT standard given by ETSI GSM 07.07.
Vendor Proprietary AT commands, specific for each OEM.
Carrier Proprietary AT commands, specific to some service providers. (E.g. AT&T, Sprint, T-mobile, Verizon etc.)
So for our 2 modem cases above we have the obvious Proprietary AT extensions:Qualcomm QSCnnnn: AT$Q<something>
Intel/Infineon XMMnnnn: AT+X<something>​which indeed confirms the BP of my SGS2. Obviously there is a far easier way to reach this conclusion...---------------------------------------------------------------
TIPS!
To see what baseband processor you have,
you can enter into ServiceMode and check.
This should always work as many ServiceMode
functions are directly modem dependent.
---------------------------------------------------------------
Why? Because the ServiceMode application
actually reside in the modem firmware!​Do this:Dial: *#197328640#
Code:
MAIN MENU:
...
[2] VERSION INFO. -->
[1] SW VERSION -->
[5] READ ALL SW VERSION:
...
======>[COLOR=Red] IFX [/COLOR]SW VER: [COLOR=Red]SP6260[/COLOR]_U1_01.1135
...
This implies the phone is using software for the (Infineon) IFX 6260...​But the ServiceMode is just talking to the modem, so you can get the
same information by opening an (external) terminal shell and send
the following ATC:
Code:
[B]AT+XGENDATA[/B]
+XGENDATA: " [COLOR=Red]SP6260[/COLOR]_U1_01.1135_DB110831 2011-Sep-2 18:14:20
PDB_NOT_AVAILABLE
*SP6260_U1_01.1135_DB110831*"
"*"
OK
Here is the FBGA pin-out of that chip:
Fig.4.
A small addendum about the SMARTi UE2 chip
The BP is communicating with the RF-tranceiver chip called SMARTi UE2
(labelled "5712"), using a communication interface that corresponds to
the (MIPI) DigRF 3G (V.3.09) standard. Through this protocol the BP
(or other device) can also control some aspects of the RF to some
minor extent. But without the proper specifications of the 5712, it
may also contain other interfaces...
The DigRF connections:
Fig.5.
The SMARTi UE2 chip:
Fig.6.
Here are more link for the interested reader:
General DigRF info:
http://www.mipi.org/specifications/digrfsm-specifications
http://www.mipi.org/sites/default/files/Specification Overview final.pdf
http://electronicdesign.com/article/test-and-measurement/digrf-faqs19953.aspx
The DigRF protocol details:
http://www.siliconreleasesolutions.com/pdf/DigRF-TMWorld0509-FINAL.pdf
http://www.docstoc.com/docs/53386199/DigRF-BASEBAND-RF-DIGITAL-INTERFACE-SPECIFICATION

Complete AT command list for Samsung Galaxy S2 (GB 2.3.4, KI4)
These were obtained by sending the "list all available AT commands" request: AT+CLAC .
Their functions have been collected from many different sources, none of which originates
from Samsung. Thus many ATC's are marked with one or more "?" to signify the uncertainty.
The standard AT set as shown in the OP, I have not bothered to describe here.
Code:
ATA - Answer
ATD - Dial ...
ATE - Enable command echo (0=disable, 1=enable)
ATH - ??? Hangup/Hook
ATO ?? - Return to Online Data Mode
ATQ - Result code supression
ATS - Command line termination? S[3,4,5]
ATV - Command response format (0=Numerical, 1=Verbose)
ATX - Result code format for CONNECT Mfg!
ATZ - Reset Modem (...)
ATl -
ATm -
AT&C ? - (Received line signal detector) Behaviour
AT&D ? - (Data terminal ready) Behaviour
AT&F ? - Restore Factory Default Configuration
AT\Q ? - Local flow control selection
AT+CACM
AT+CAMM
AT+CAOC
AT+CBC
AT+CBST
AT+CCFC
AT+CCHC
AT+CCHO - Open Logical Channel
AT+CCID - SIM Serial Number
AT+CCLK - Realtime clock
AT+CCUG
AT+CCWA
AT+CCWE
AT+CEER
AT+CFUN * ? This command selects the level of functionality <fun> in the MS. Only some values of<fun> are allowed (see Defined values).
AT+CGACT -
AT+CGATT -
AT+CGAUTO -
AT+CGCLASS -
AT+CGCMOD -
AT+CGDATA -
AT+CGDCONT -
AT+CGDSCONT -
AT+CGEQMIN -
AT+CGEQNEG -
AT+CGEQREQ -
AT+CGEREP * - Packet Domain event reporting
AT+CGLA E - Generic UICC Logical Channel access
AT+CGMI - Request manufacturer identification
AT+CGMM - Request model identification
AT+CGMR - Request revision identification
AT+CGPADDR -
AT+CGQMIN -
AT+CGQREQ -
AT+CGREG * - GPRS network registration status AT+CGREG=2;+CGREG?
AT+CGSMS -
AT+CGSN * - Request product serial number identification (IMEI)
AT+CGTFT
AT+CHLD
AT+CHUP - Hangup call
AT+CIMI * - Request international mobile subscriber identity (IMSI)
AT+CLAC - List all available AT commands
AT+CLAN
AT+CLCC
AT+CLCK
AT+CLIP
AT+CLIR
AT+CMEE - Report mobile termination error (+CME) verbosity mode (0,1,2)
AT+CMGC
AT+CMGD
AT+CMGF
AT+CMGL
AT+CMGR
AT+CMGS
AT+CMGW
AT+CMMS
AT+CMOD
AT+CMSS
AT+CMUX - Set multiplexing protocol control channel mode(s)
AT+CNAP
AT+CNMA
AT+CNMI * - This command selects the procedure, how receiving of new SMS from network is indicated to the TE
AT+CNUM
AT+COLP
AT+COLR
AT+CONNECTPORT
AT+COPN
AT+COPS -
AT+CPAS
AT+CPIN
AT+CPIN2
AT+CPLS
AT+CPMS
AT+CPOL
AT+CPUC
AT+CPWD
AT+CPWROFF
AT+CR
AT+CRC
AT+CREG
AT+CRES
AT+CRLA ? - Restricted UICC Logical Channel access
AT+CRLP * - Radio link protocol
AT+CRSM
AT+CSAS
AT+CSCA
AT+CSCB
AT+CSCS
AT+CSDH
AT+CSIM
AT+CSMP
AT+CSMS
AT+CSQ - Signal Quality
AT+CSSN
AT+CSTA
AT+CSVM
AT+CTFR
AT+CTZR
AT+CTZU
AT+CUAD - UICC Application Discovery
AT+CUSD
AT+CVHU
AT+FCLASS - Select mode: put TA into mode: (data, fax, voice etc.)
AT+IPR - This command specifies the data rate at which the DCE will accept commands. The full range of data rate values may be reduced dependent on HW or other criteria.
AT+NEER
AT+TRACE * ? (see: +XSIO) This command controls the trace; it allows selecting the trace mode, method and the trace data transfer rate.
AT+VTD
AT+VTS
AT+XAACOPS ?
AT+XAPP * ! - Known buffer overflow in Iphone 4S (unsigned code execution): Probably used to send executable code (application) to BB!
AT+XBANDSEL ? This command allows to switch from automatic band selection to selection of one or more (up to four) bands.
AT+XCALLSTAT * ? Set reporting call status: This command allows enabling / disabling the reporting voice call status on DTE using an unsolicited result code +XCALLSTAT: <call_id><stat>.
AT+XCEER ?
AT+XCGCLASS ?? Changing the startup MS Mobile class ("B", "CC")
AT+XCONFIG + ?? This command allows the configuration of DLCs (Data Logical Channels). (see +XMUX)
AT+XCOPS ? Display of the most adapted name of the network.The command parameter <type> allows requesting the name type which shall be displayed.
AT+XCSP ? This command reads the customer service profile (CSP) from the SIM. The CSP indicates the services that are user accessible.
AT+XCSPAGING ? This command allows enable/disable the circuit switching paging. The command has an effect only when used before +COPS or +CGATT.
AT+XCSSMS ? Initiate Resending of SMS over CS if GPRS Fails
AT+XCTMS ? This command allows to set the TTY/CTM behavior. The selected setting is stored also in NVRAM and remains valid also after switch off the mobile
AT+XDATACHANNEL ? This command configures the channel over which CSD or GPRS data shall be routed.
AT+XDLCTEST ?
AT+XDNS ? This command enables / disables a dynamic DNS (Domain Name Service) request before context activation.
AT+XDTMF ? This command allows setting the value of SEND DTMF user setting that controls whether the DTMF tone generation on request from SIM-TK is allowed.
AT+XEER ?
AT+XEONS ? displays the list of available networks with details like long operator name, short operator name, MCC/MNC, Long EONS name, Short EONS name for each PLMN.
AT+XFDOR ? Trigger Fast Dormancy
AT+XFDORT ? Set Fast Dormancy Timer
AT+XGAUTH ? This proprietary command allows to enter the type of authentication for a user-name (using a password) for the specified PDP context
AT+XGENDATA ? This command requests the software version and generation data.
AT+XHOMEZR ? This Set command enables and disables the home zone change event reporting. If the reporting is enabled; the MT returns the unsolicited result code +XHOMEZR: <label> whenever the home zone is changed.
AT+XHSDUPA ? This command configures the mode of HSDPA and HSUPA (by changing the appropriate dynamic NVRAM parameter)
AT+XL1SET ? Call the L1-specific function
AT+XLEMA ??? Emergency number list (Ofono)
AT+XLIN ? This command sets the current line.
AT+XLOG * ! - Known buffer overflow in Iphone 4S (unsigned code execution) ? This command allows displaying the exceptions stored in NVRAM on DTE. The MS-error LOG is contained in a response code formatted as +XLOG: <num>,<code>,<file>,<line>,<count> or an other appropriate format as specified below.
AT+XMER ? Enables or disables sending of unsolicited result codes from the MS to the DTE when the battery charge level or the radio signal level crosses a defined threshold.
AT+XMUX + ? Multiplexing mode: This command configures the GSM 07.10 multiplexing protocol.
AT+XNOTIFYDUNSTATUS ??? (LG) This command is used to notify DNS setting status
AT+XNVMMCC ?
AT+XNVMPLMN ?
AT+XPINCNT - This command reads the remaining attempts for SIM PIN, SIM PIN2, SIM PUK and SIM PUK2.
AT+XPOW ? This command sets the powersaving-mode.
AT+XPROGRESS ? This command allows enabling / disabling the display of an unsolicited result code + XPROGRESS: <cin> (call number indication), <status> on DTE while a call is in progress.
AT+XRAT ? This command forces the selection of the Radio Access Technology (RAT) in the protocol stack.
AT+XREDIAL ? Enabling of automatic redialing if the called party was busy.
AT+XREG ! ? Involved in the iPhone unlock hacks...
AT+XRXDIV * ? This command is used to allow external control of the Rx Diversity feature during runtime.
AT+XSETCAUSE ?
AT+XSIMSTATE ? Display SIM and Phonelock Status (write at+xsimstate=1 to turn on, at+xsimstate=0 to turn off)
AT+XSIO * ? This command allows the configuration of the modem-interface (AT), trace-interface, IrDA interface and MUX-interface by setting the variant number.
AT+XSMS ? Detection of Signal DR_SM_FINISHED_IND
AT+XSVM ? This command allows to set the voice mail server number.
AT+XSYSTRACE ?
AT+XTESM ?
AT+XTRACECONFIG ?
AT+XUBANDSEL ?
AT+XUICC - Checks for UICC Card, whether the current SIM is a 2G or 3G sim.
AT+XVTS -
As you can see there are quite a few OEM commands here, whose functions I have not been able to
figure out yet. Please post if you know anything or have any documentation on these. They all
start with: AT+X<something>. There are also others that, that are not documented at all, AFAIK.
[2012-02-05]
On this list, the most interesting ATC's for our purposes are AT+XSIO and AT+XTRACE as described here:
Code:
[B]AT+XSIO[/B] This command allows the configuration of the modem-interface (AT),
trace-interface, IrDA interface and MUX-interface by setting the
variant number.
• Set command allows the configuration of the modem-interface (AT), trace-interface, IrDA interface and
MUX-interface by setting the variant number. The set variant number becomes active only after a reset
• Read command allows seeing which is the current variant and which is the requested variant. A star marks
the active variant.
• Test command returns the possible and customizable variants.
Defined values:
<requested> requested variant, which may be in range 0-255
<active> currently active variant, which may be in range 0-255
<AT-interface> NULL, UART0, …, UARTn
<Trace> NULL, UART0, …, UARTn
<MUX> 1-x
<IrDA> NULL, UART0, …, UARTn
Example:
[B]AT+XSIO=?[/B]
+XSIO: [SP62XX_es1] Variant=0: AT= USART2 USB[03]; BB-Trace= USB1; 3G-Trace= USB2; OCT= USB6;
+XSIO: Variant=1 : AT= USART2 USB[03]; BB-Trace= TADO0; 3G-Trace= TADO1; OCT= USB1;
+XSIO: Variant=2 : AT= USART2 USB[01]; BB-Trace= BG0; 3G-Trace= BG1;
+XSIO: Variant=3 : AT= USB[01]; BB-Trace= USART2; 3G-Trace= USIF5; OCT= USB6;
+XSIO: Variant=4 : AT= USART2 USB[01]; BB-Trace=/bbt/0; 3G-Trace=/3gt/0;
[B]AT+XSIO? [/B]
+XSIO: 0, *0
-------------------------------------------------------------------------------
[B]AT+TRACE[/B] This command controls the trace; it allows selecting the trace mode,
method and the trace data transfer rate.
• Set command switches the trace on or off. It allows the trace mode, method and the trace data transfer rate.
• Read command allows seeing the current set mode value along with the speed, i.e. data transfer rate. It also
allows knowing which traceable unit is on or off.
• Test command returns all the possible values of mode, data transfer rate, traceable unit, their mode and
power saving countdown.
Command Syntax:
AT+TRACE=[<mode>],[<speed>],[<unit>=<umode>],[<method>],[PowerSavingCountdown]
Defined Valuse:
<mode> may be
0 switch trace off
1 switch trace on (all kinds of traces are switched on)
128 This value can not be entered, it is only displayed via read
syntax if trace configuration is done by unitdefinitions
the last time. See <umode> & <unit> for trace configuration;
<unit>=<umode>
<unit> indicates a traceable unit as follows:
St stack
Pf printf
Bt Bluetooth
Ap apoxi
Db debug
Lt LLT (Low Level Trace)
Li LwIP (Lightweight TCP/IP Stack)
Ga GATE (3rd Party Software Decoding with a Windows DLL)
<umode> defines whether the unit related trace is on or off and can have the values:
0 unit-trace off
1 unit-trace on
<method> sting type indicating the trace method with possible values:
"BTM" byte stuffing trace method
"EBTM" extended byte stuffing trace method
<PowerSavingCountdown>
Integer value indicating the power saving countdown
value in units of milliseconds. The maximum valid value is
30000.
Example:
[B]AT+TRACE? [/B]
+TRACE: 1,921600,"ap=1;st=1;db=1;pr=1;bt=1,lt=1;li=1;ga=1;ae=1","DTM",0
[2012-02-14]
Additional hidden AT commands on the SGS-2
Runing strings on the stock /system/bin/drexe , you will find the following AT commands embedded.
These are probably not directly supported by Modem, but rather interpreted by drexe, as
they're not present in the +CLAC list. In addition, some of them just don't work and maybe only
provided for backward compatibility for other devices and modems.
Code:
AT+APPLIST
AT+AUTHKEY=
AT+BATGETLEVEL?
AT+CERTKEY
AT+CGMM
AT+CGSN
AT+CGTEMR=NewPCStudio
AT+DEVAUTH
AT+DEVCONINFO
AT+DISSTRNO=
AT+FOTALOC?
AT+FOTAREADY?
AT+FOTASTART
AT+FUS?
AT+GMM
AT+GSN
AT+HIDSWVER
AT+IMEINUM
AT+PASSWORDINPUT
AT+PRODUCTCODE
AT+PROF=
AT+SECUKEY
AT+SUDDLMOD=
AT+SUPPORTFUS
AT+SWVER
AT+SYNCML=MOBEXSTART
AT+SYNCML=MOBEXSTOP
[2012-02-09]

Very good to read, thanks for linking me that.
But just to correct - AT is abit deprecated interface in SGS, SGS2 and similiar models. It can be used to control modem directly from PC (not sure if PC is really directly talking to modem or to part of Android's HALs, which is then talking to modem, for eg. USB-UART multiplexer in I9000 and S8500/S8530 is capable to switch phone MicroUSB port between AP USB/UART and CP USB/UART.
The main controlling interface used in above models is RPC through oneDRAM shared-memory area. You can find devices like "dpram", "onedram", "modemctl" in kernel - these are critical for proper working of modem. Even if RIL is using AT commands, it does send them through RPC.
AP-CP UART connection seems to be used only for early booting stage (at least in I9000 and S8500, haven't analysed I9100 but guess that's similiar)
Ad1. There may be no real ability to communicate with modem directly on SGS2 and AT responses you are getting may be from Android, working on AP only, not AMSS (Advanced Mobile Subscriber Software - RTOS working on Qualcomm's CP)
Ad4. These datasheets are most guarded secrets of manufacturers. Only single, incomplete manuals leak from Qualcomm, not really useful. Also AP-CP RPC protocol is proprietary of Samsung, they got AMSS sources from Qualcomm and they are adding their own drivers there.
Oh yes, I gave Qualcomm as example, but is CP in SGS2 Qualcomm? It wasn't QC product on SGS1 but tbh it is also very closed source.
While AP-CP low level protocol is opensource (you can find it in dpram/onedram/modemctl drivers in kernel), higher level of that layer - compiled into sec-RIL, is not.
AP-CP protocol is different between I9000 and S8500 (general concept remains the same, just it has been rewriten so packet types and structures are different), but if you are interested - we're creating opensource RIL for S8000/S8500/S8530/S8600 device series, supposed to work with Android ports for them - http://code.google.com/p/bada-modemril/ (branch experimental-MochaIPC)

As I understand, SGS2 use intel's xmm6260 platform, which might also contain it's own interface/firmware etc.
As long as the modem works well, there is little need to dig into the details of how ril communicate with modem, but when the modem does not work as it should (In my case it refused to register on only one specific mobile operator), an AT command which can do a factory reset of the modem might be helpful

EDIT: 2012-02-01
Rebellos said:
... not sure if PC is really directly talking to modem or to part of Android's HALs, which is then talking to modem, for eg. USB-UART multiplexer in I9000 and S8500/S8530 is capable to switch phone MicroUSB port between AP USB/UART and CP USB/UART.
Click to expand...
Click to collapse
Hi, thanks for deep insight! I had to read your post 5+ times to take it all in.
That the AT is deprecated is no secret, but the fact (at least according to some firmware specialists) is that it will still be a while before the OEM's can get rid of the (AT) dependence of their secret and crappy proprietary firmware, that often need to be backward compatible...
Regarding whether I'm talking to AP or CP. You are probably correct that I am talking to AP through HAL. At least from SGS2 block diagram, UART-3 is in the AP, but connected to a level-shifter in the PMIC (still on the same SoC), which is in turn connected to the BP UART-X. (I don't have a clue why this is done so.) So in any case it seem that the AT's are reaching their destination, through some abstraction layer, which may explain why I can only talk ATC's from Samsung Drivers and not from a local (phone) terminal shells.
The question is, what happens if we try to use the Bada trick, to go into ServiceMode (SM) and enable the corresponding BP access? But the SM is different on SGS and that option is not clearly available. However, there is:
Code:
MAIN MENU --> COMMON --> DIAG CONFIG
[1] LOG VIA USB *
[2] LOG VIA UART
[3] LOG VIA IPC
[4] SPEED 115200
[5] SPEED 921600 *
[6] DBG MSG OFF (toggle)
[7] RAMDUMP OFF (toggle)
[8] DUMP ALL TRACE
But these do not seem related to AP/BP connections...[EDIT]
I found it! The selection of AP/BP connection behavior
when connecting your phone as a USB client, to a PC
host, can be manually set in the PhoneUtil (PU) menu.
This sets the behavior of your phone when connecting it
to a PC, so that you can select whether you like it to act
as a Modem or PDA, on the USB and/or UART port.
The PU menu is different from the ServiceMode menu.
Dial: *#7284#
Code:
UART:
[[B]o[/B]] MODEM[B]*[/B]
[ ] PDA
USB:
[ ] MODEM
[[B]o[/B]] PDA[B]*[/B]
* is default SGS2 setting.
However, after making the change to use USB in MODEM mode,
my host is asking for new drivers, which I cannot find... ​Now, if the modem controlling interface is using RPC, how is this reflected at the OS level? Still, any Linux based kernel is device based, so there have to be a way to talk to that device. (I have no idea how to work with RPC's...)
There may be no real ability to communicate with modem directly on SGS2 and AT responses you are getting may be from Android, working on AP only, not AMSS (Advanced Mobile Subscriber Software - RTOS working on Qualcomm's CP)
Click to expand...
Click to collapse
A: There is no AMSS, since we are not using a Qualcomm BP in this device...
... Only single, incomplete manuals leak from Qualcomm, not really useful. Also AP-CP RPC protocol is proprietary of Samsung, they got AMSS sources from Qualcomm and they are adding their own drivers there.
Click to expand...
Click to collapse
A: Agree, but HW hackers are often too much concerned with getting the exact datasheets. Rather try to get an old/similar one that is available... The old device drivers probably have not changed THAT much, but at least it would be a start.
While AP-CP low level protocol is opensource (you can find it in dpram/onedram/modemctl drivers in kernel), higher level of that layer - compiled into sec-RIL, is not.
Click to expand...
Click to collapse
Can you be more specific? (I'm starting to get lost here somewhere...)
AP-CP protocol is different between I9000 and S8500 (general concept remains the same, just it has been rewriten so packet types and structures are different), but if you are interested - we're creating opensource RIL for S8000/S8500/S8530/S8600 device series, supposed to work with Android ports for them - http://code.google.com/p/bada-modemril/ (branch experimental-MochaIPC)
Click to expand...
Click to collapse
Yes, I am. How/where can I find what these differences are?
PS. Regarding the BP on the SGS2, see my 2nd post...

E:V:A said:
A: There is no AMSS, since we are not using a Qualcomm BP in this device...
Click to expand...
Click to collapse
Doesn't matter that much at all, it's likely almost the same stuff.
E:V:A said:
Can you be more specific? (I'm starting to get lost here somewhere...)
Yes, I am. How/where can I find what these differences are?
Click to expand...
Click to collapse
Not hard to get lost, it took me literally few months to understand all these things. Sources are very messy - pay attention to Makefiles, some of drivers aren't even compiled in.
I9000 GB driver (it was reorganised, comparing to Froyo)
https://github.com/project-voodoo/l...erbread-samsung/drivers/misc/samsung_modemctl
I9100 driver is in I9100 kernel sources in /drivers/svnet/ and /drivers/dpram/ (maybe also somewhere else, couldn't find direct link)
You can find my implementation of SHP OneDram frames-protocol there, based on I9000 GB driver - http://code.google.com/p/bada-modemctl/ (it isn't working yet - noone tested it)
As you can see - it's only lowlevel interface of sending frames and few parsers.
Real parsers and senders of frames are in libsec-ril.so library of platform - you can open it with IDA (I suggest 6.0+, it does deal with GOT of linux DLLs much better than previous versions) and find booting modem, installing callbacks inside of dpram/modemctl, parsing and sending packets and so on. Have fun.

I have to say I'm pretty lost on the topic already. I've read about such stuff at the replicant project a while ago. Maybe you find some useful information there.
replicant.us (can't link yet)
Looks to me like they have free ril implementations for dream, n1 and nexus S.

XdxH62 said:
I have to say I'm pretty lost on the topic already. I've read about such stuff at the replicant project a while ago. Maybe you find some useful information there.
Click to expand...
Click to collapse
Copy that! I don't even know where to begin...
But I have collected (thanks to you guys) the following very interesting links:
Available Source Code:
XGOLD-RIL (Omapzoom):
http://dev.omapzoom.org/?p=modem-int/xgold-ril.git;a=tree
Voodoo SGS-1 GB modem:
https://github.com/project-voodoo/l...ung/drivers/misc/samsung_modemctl/modem_ctl.c
https://github.com/project-voodoo/l...erbread-samsung/drivers/misc/samsung_modemctl
General...
https://github.com/GalaxySII/samsung-kernel-galaxysii
bada-modemril: Android RIL library for communication with baseband processor using Samsung OneDram.
https://code.google.com/p/bada-modemril/
bada-modemctl: Android kernel driver for communication with baseband processor using Samsung OneDram.
http://code.google.com/p/bada-modemctl/
Samsung H1 / Nexus S RIL/Modem support:
http://replicant.us/
http://trac.osuosl.org/trac/replicant/wiki
https://gitorious.org/replicant
https://gitorious.org/replicant/samsung-ril
http://github.com/morphis/libsamsung-ipc
http://ftp.osuosl.org/pub/replicant/
Nice!
http://trac.osuosl.org/trac/replicant/wiki/How_to_port_Replicant
https://github.com/morphis/libsamsung-ipc/tree/master/samsung-ipc/device/aries
Unrelated?
Android USB-to-serial: IOIO API
https://github.com/ytai/ioio/wiki
Android App: android-serialport-api
https://code.google.com/p/android-serialport-api/
Great USB GSM/3G stick hacking:
http://blogs.gnome.org/dcbw/category/drivers/
ModemManager Hmm??
https://launchpad.net/modemmanager
http://cgit.freedesktop.org/ModemManager/ModemManager/tree/README
http://cgit.freedesktop.org/ModemManager/ModemManager/tree/libqcdm/src/dm-commands.h

I am the Replicant developer who worked on Nexus S port and also did the work on aries (galaxy s, galaxy tab) devices and wrote a big part of the free RIL.
Replicant is a fully free Android derivate running on some devices (mostly Google phones).
If you have any question regarding samsung modems in Android phones, i'd be happy to answer them!
I'll attach the mail I sent back to E:V:A next
---------- Post added at 08:27 PM ---------- Previous post was at 08:22 PM ----------
Modems on Android devices is a wide domain.
Phones differ on many things, like:
* modem chipset
* modem firmware
* transport modem <-> AP
* modem protocol
* user-space integration (Android RIL)
First thing is the modem chipset. There are quite a few. For instance on
HTC phones, you'll have the ones included in the MSM or QSD SoCs (which
is quite unusual, modems aren't often part of the SoC) IIRC.
On other devices, it'll be a separate chip connected to the SoC via
various transport methods.
I know better the case of recent Samsung phones, like Nexus S, Galaxy S,
Galaxy Tab (first gen), Galaxy S2, etc.
There, you have the modem, usually an intel x-gold 6xx, that is wired to
the SoC. So transport is done via serial line and/or some dedicated RAM
memory (not from the main sticks).
Even though a phone can have the same modem wired (at hardware level)
the same way, the kernel drivers can be different. That's the case of
nexus s and galaxy s. On the first one, modem Rx/Tx with AP is done via
ioctls while on galaxy s it's done via a PHONET network interface
(svnet0). SO it's not (and particularly on Samsung phones) only a serial
interface you can open with screen: you need to understand how it's done
and write dedicated software to reproduce this (cf. the code on
libsamsung-ipc/devices/ that is device-specific).
So once you have transport set up, you need to know about the protocol
the modem speaks. This depends on the firmware the modem is running.
I know that the modem used in Nexus S is also used in some iPhone (4G
IIRC) but it has a different firmware and so speaks a different
protocol. I suspect it to be AT on the iPhone while Nexus S speaks a
samsung-specific modem protocol. They invented that protocol and
rewritten the modem firmware to use it instead of AT or anything else.
This protocol is usually called "Samsung IPC Protocol" and we have a
free implementation of it in libsamsung-ipc and samsung-ril.
On the Nokia N900, transport is also a PHONET socket and the protocol is
neither AT nor Samsung IPC but some protocol made by nokia and
implemented in ofono.
So you have exemples of different transport methods and modem protocols.
I could give you more exemples.
Of course, on Android, you need to have the user-space programs (the RIL
mainly) to match both the transport scheme and the modem protocol to
have anything working.
> Please have a look at our XDA-forum thread:
>
> "How to talk to the Modem with AT commands":
> http://forum.xda-developers.com/showthread.php?t=1471241
Apparently you were able to contact the modem with some AT commands.
Either the modem has an AT mode that can run along with IPC (would
surprise me, but why not), but it may very well be uncompleted and is
anyway not used at all in official binaries, either this is Android
emulating and AT device while sending back stuff from and to the RIL,
either this is not the modem.
Anyway I can tell you for sure that this is absolutely not the way to
talk to the modem properly. The correct way is to use the IPC protocol
and appropriate transport handling (which is way more complex than only
opening a serial line).
I just started the work on galaxy s2, I'll soon have done the transport
layer and we already know the protocol.

PaulKocialkowski said:
..Anyway I can tell you for sure that this is absolutely not the way to
talk to the modem properly. The correct way is to use the IPC protocol
and appropriate transport handling (which is way more complex than only
opening a serial line).
I just started the work on galaxy s2, I'll soon have done the transport
layer and we already know the protocol.
Click to expand...
Click to collapse
So no way to talk with the modem in Nexus S? Also if I use the REPLICANT rom?
Thanks.

alextreme said:
So no way to talk with the modem in Nexus S? Also if I use the REPLICANT rom?
Thanks.
Click to expand...
Click to collapse
Oh Nexus S status is very good (actually the best). That's the device we initally created libsamsung-ipc for (before, it was for samsung H1 and wasn't called libsamsung-ipc).
State of the modem using libsamsung-ipc and samsung-ril is at: redmine.replicant.us/projects/replicant/wiki/SamsungModems
basically, we have calls, sms, network registration and much more. Data is working but it's unclean on the code and needs more work. Note that I'm the only active dev on samsung-ril, and we're 2 on libsamsung-ipc. I'm also the one who added support for galaxy s and galaxy tab devices.
So in Nexus S, you can talk with the modem very easily, using libsamsung-ipc (which is a lib, so you need to use a binary, like modemctrl that comes with libsamsung-ipc).
Also, note that the SHR GNU/Linux distribution supports Nexus S as well and uses libsamung-ipc.

PaulKocialkowski said:
I am the Replicant developer who worked on Nexus S port and also did the work on aries (galaxy s, galaxy tab) devices and wrote a big part of the free RIL. ... I just started the work on galaxy s2, I'll soon have done the transport layer and we already know the protocol.
Click to expand...
Click to collapse
Hi Paul!
Thank you very much for your important contribution,
which really helped sort out, clarify and confirm many things!
I have just prepared a long response, but while writing it, more
fog has cleared and I will just go straight to my questions.
The rest (which is now less relevant) will be posted later as
a reference to others following this thread.
So my Questions to you at this point are:
Given the above pictures of the various abstraction layers,
how/where does the PHONET network interface fit in?
.
How does the "Samsung IPC Protocol" fit into this picture, regarding the translation and transmission of external terminal AT commands and their interpretation. [Perhaps you have link to a good/easy explanation of this protcol?]
.
How could we use this, to send ATC's from a local terminal?
I guess the ultimate reason for wanting to do this, is to be able to get closer to the radio-interface-layer, and thus be able to get access to those radio parameters, not normally available to applications via the limited Java API.
.
Alternatively, how would you propose a better way to obtain the various low-level modem variables such as the ones shown here? (Freesmartphone.org)
.
From the (poor) OMAPedia RIL-layer picture and the GT-I9100 block-diagram, it seem that there might perhaps be other channels available to communicate with the BP/Modem. (I.e. Through the UART, GPIO, McSPI?) Any ideas on how/if this could be done?
.
How could we build our own RIL(s) with minimal effort and test it?
.
For example, here is a copy of this, which is an example how to build Replicant RIL and then replace the local rild from command line to test with. Would be great to be able to do the same on the SGS2...without having to flash new ROMs.
.
How does the Replicant "libsamsung-ipc" differ from that used in the "Project-Vodoo: samsung_modemctl" ?
That was a bunch...
However, I would be happy to help contribute to Replicant if possible,
although you should keep in mind that I am not a professional
programmer in any way.
Here is the direct link to Replicant's Samsung RIL status page:
http://redmine.replicant.us/projects/replicant/wiki/SamsungModems

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.
On the first one [Nexus S], modem Rx/Tx with AP is done via
ioctls while on Galaxy S it's done via a PHONET network interface
(svnet0). SO it's not (and particularly on Samsung phones) only a serial
interface you can open with screen: you need to understand how it's done
and write dedicated software to reproduce this...
Click to expand...
Click to collapse
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:
Code:
[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:
Code:
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:
Code:
[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.
Code:
[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"

PaulKocialkowski said:
Oh Nexus S status is very good (actually the best). That's the device we initally created libsamsung-ipc for (before, it was for samsung H1 and wasn't called libsamsung-ipc).
State of the modem using libsamsung-ipc and samsung-ril is at: redmine.replicant.us/projects/replicant/wiki/SamsungModems
basically, we have calls, sms, network registration and much more. Data is working but it's unclean on the code and needs more work. Note that I'm the only active dev on samsung-ril, and we're 2 on libsamsung-ipc. I'm also the one who added support for galaxy s and galaxy tab devices.
So in Nexus S, you can talk with the modem very easily, using libsamsung-ipc (which is a lib, so you need to use a binary, like modemctrl that comes with libsamsung-ipc).
Also, note that the SHR GNU/Linux distribution supports Nexus S as well and uses libsamung-ipc.
Click to expand...
Click to collapse
Okay but I would like to send AT Commands from Android terminal to the modem or from an APP in Android. Can I find using REPLICANT ROM the folder /dev/smd0?

I found this an interesting read. http://download.maritex.com.pl/pdfs/wi/GSM-TM2.pdf It has a lot of information in it.

AdamOutler said:
I found this an interesting read. ... It has a lot of information in it.
Click to expand...
Click to collapse
Sorry, but I just can't see how it is relevant. Did I miss something? It's just another GSM module without HW specs as usual... Thanks anyway.

E:V:A said:
Sorry, but I just can't see how it is relevant. Did I miss something? It's just another GSM module without HW specs as usual... Thanks anyway.
Click to expand...
Click to collapse
It has AT command descriptions which may assist in adding more descriptions to the first page. I noticed alot of yours were incomplete, so I posted that.

AdamOutler said:
It has AT command descriptions which may assist in adding more descriptions to the first page. I noticed alot of yours were incomplete, so I posted that.
Click to expand...
Click to collapse
Ahh, yes. I was just updating the AT+Xzzzz sets form various sources. (The best one by far was the Google available: "AMOD HSPA Modules_AT_Command Specification".) I had to move the list to post #3. Now there are only a very few missing. The others I did not bother to re-explain/merge with the already known and "standard" ones...

There are a lot of implementations of the AT set. There are official documents with all the standard commands. Take a look at wiki.openmoko.org page: Hardware:AT_Commands (links to ETSI and 3GPP documents).
---------- Post added at 09:15 PM ---------- Previous post was at 08:41 PM ----------
IIRC, there is an UART debug line that can be used to talk to the modem directly. On Nexus S, the ttyFIQ0 node was related to UART. Maybe you can route the modem to ttyFIQ0 by dealing with /sys/class/sec/uart_switch/UART_SEL/value
Important fact: note this on Galaxy S2 init.rc:
chown radio system /sys/class/sec/uart_switch/UART_SEL/value
Really try to look at that sys node and you'll perhaps succeed to get it (modem UART line) routed on ttyFIQ0 on the device.
Also, look at the FSA something component in the kernel sources: it's highly related to the UART line. It was FSA9480 on Nexus S. Look at NexusSBootloader#Serial-Console on Replicant Redmine wiki to see how we used it.
I seriously doubt there is any kind of protocol converter that converts Samsung IPC data to AT commands on this line. In my opinion the line you get is most probably the modem debug UART line.
It looks like this:
Modem <-> UART line <-> FSA9480 <-> USB <-> Host PC
|<-> kernel driver <-> RIL <-> Android framework
And the idea would be to redirect the modem uart line to ttyFIQ0. I don't know if you have to do the routing via the FSA component. I know someone who perhaps knows better about that.
---------- Post added at 09:21 PM ---------- Previous post was at 09:15 PM ----------
The logs with DataRouter are really interesting. These are not part of the RIL (I checked with strings) but there is definitely something *software* between the modem and your terminal on PC.

Related

[MOD/HOW-TO] (UPD: 0.4.1) USB 3G modem and RNDIS tethering for urukdroid 0.7/0.6

After experimenting for a while, I've managed to successfully use USB 3G dongle, and to connect my Archos 101IT, running uruk-droid 0.4.1, to the Internet over 3G data network. Test was made with two different 3G USB dongles - Huawei E1552 and ZTE MF190.
First of all a big thanks to $aur0n for uruk-droid, because without uruk-droid kernel with adequate configuration, this 3G support would not be possible.
Second, a big thanks to all guys behind usb_modeswitch project (http://www.draisberghof.de/usb_modeswitch/), for providing us with Linux support needed to switch our 3G USB dongles from default cd-rom/mass-storage mode to usb-serial mode needed for 3G operation.
Process of initial setup of 3G USB dongle to a 3G provider under Linux (and Android/Archos) is fairly complex, and requires a little Linux knowledge, but once it is configured right, usage is simple.
Unfortunately I don't see a way to make it simpler, because lot of parameters in various files are greatly dependant on model of 3G USB dongle you are using, and on settings of your 3G data provider.
DISCLAMER:
This is a proof-of-concept modification. Don't expect that everything will work from a first try.
Please note that I don't take responsibility for anything that might happen with your Archos device and/or your data on it.
I didn't had any problems with my A101IT using this mod with Huawei E1552 3G dongle and ZTE MF190 3G dongle, but that doesn't mean that someone else won't have them.
Also, if you make your 3G USB dongle work as modem using steps described here, I don't take any responsibility for possible large bills form you 3G data service provider.
Be sure that you have good and cheap 3G data plan with your 3G data service provider, if you are planning to use 3G data network for Internet connection on a daily basis.
Also, try to avoid using 3G data service while in roaming, because it is very expensive.
Technical explanation:
Basically USB tethering system on Archos is designed to work over PPP connection, provided by /system/bin/pppd via "Serial-over-USB link", provided by cdc-acm.ko kernel module, when supported cdc-acm class device is connected to USB host port of Archos.
Here is a brief description of USB tethering on Archos 101, modified to work with 3G USB dongles, since you probably going to need to edit some of this files in order to adjust them for your 3G USB dongle and your 3G provider:
1. Kernel support for 3G USB dongles.
This is provided by uruk-droid kernel.
One part you'll use from this support is usbserial.ko kernel module that will be loaded by /system/xbin/3Gmodem_init.sh with adequate parameters, when you start tethering.​
2. usb_modeswitch program and support files
usb_modeswitch is responsible for switching of 3G USB dongles from default cd-rom/mass-storage mode to usb-serial mode ready for 3G operation.
You'll use it via /system/xbin/3Gmodem_init.sh, when you start tethering.​
3. Archos USB tethering support which is partially in Android framework, and partially in Linux scripts called by framework.
This part of tethering support is most complex one, and in order for Android framework to be aware of data connection, we must disguise 3G data connection as a USB tethering:
Android framework calls modified /system/bin/tether_start_usb.sh, which calls /usr/bin/pppd binary, responsible for data connection to your 3G data provider.
Android framework calls modified /system/bin/tether_stop.sh, for stopping data connection to your 3G data provider.
pppd uses couple of configuration files (and additional binary /usr/xbin/chat):
from '/system/etc/ppp/peers' directory, pppd uses configuration file 'tether' (with definition of pppd options for peer it connects to - this may need editing for your 3G provider)
from '/data/' directory, pppd (via /system/xbin/chat) uses 'tether_start' file as definition of <SEND> <EXPECT> pairs of commands sent to configure modem and responses received from modem, when it connects to a peer (this may need editing for your 3G provider).
from '/system/etc/chatscripts/' directory, pppd (via /system/xbin/chat) uses 'tether_stop' file as definition of <SEND> <EXPECT> pairs with commands sent to modem and responses received from modem, when it disconnects from a peer.
This modification relies on modified '/system/bin/tether_start_usb.sh' and '/system/bin/tether_stop.sh', to be able to correctly initialize RNDIS connection or 3G modem, load adequate kernel modules and start connection, while trying to keep compatibility with original "Archos designed" way of USB tethering.
Configured adequatly ('enable' parameter to 'off' in '/etc/uruk.conf/3Gsupport' file), this modified '/system/bin/terher_start_usb.sh' WILL behave as original one. - not needed anymore - scripts auto-detect connection type and behave adequatly.
For a list of changes in recent versions please se post #2 of this thread.
Tutorial how to use RNDIS USB Tethering:
No configuration needed - if your phone is indeed of USB-RNDIS type - everything will be auto-detected.
Just plug your Archos to a RNDIS capable phone in tethering mode via USB cable, wait for at least 5 seconds (or more - depending on phone), and start tethering on Archos.
Expample of RNDIS tethering device is HTC Desire phone with built-in USB Tethering support enabled. Android based phones from "same generation as HTC Desire" are quite probably of same USB-RDNIS type.
NOTE: due to a technical reasons (bad driver), RNDIS tethering support works only if usb host mode driver (musb_hdrc.ko) is loaded in PIO (as opposed to default DMA) mode. When tethering is started, USB host mode driver is reloaded in PIO mode, so this might be indicated on the phone like USB disconnection and re-connection. This is "normal" behaviour, and for now there is nothing I can do about it. When tethering is stopped USB host mode driver is re-loaded again to DMA mode.
Tutorial how to initially configure 3G USB dongle for USB tethering:
NOTE: Everything written here, should be done in Terminal Emulator or ConnectBot (connected as local) under root shell (after 'su' command)!
Install Terminal Emulator, or ConnectBot from Market.
This step is no longer needed if you are running Uruk-Droid 0.7 or later since 3G modem/RNDIS support is integrated in it
Get 3Gsupport-0.4.zip from attachment in this post. Extract 3Gsupport-0.4.tar.gz file from .zip file and copy it to your Archos to /sdcard. Archive contains everything needed (usb_modeswitch binary and support files, replacement tether_start_usb.sh, replacement tether_stop.sh, 3Gmodem_init.sh script, 3Gmodem_detect.sh).
NOTE: Since /system/bin/tether_start_usb.sh and /system/bin/tether_stop.sh from 3Gsupport-0.4.tar.gz will replace original ones, please backup originals.
The 3Gsupport-0.4.tar.gz file contains absolute paths for all files, and should be extracted to a root ('/' path in RootExplorer).
To backup original tether_start_usb.sh and tether_stop.sh:
Code:
# su
# cp /system/bin/tether_start_usb.sh /system/bin/tether_start_usb.sh.ORIGINAL
# cp /system/bin/tether_stop.sh /system/bin/tether_stop.sh.ORIGINAL
Assuming you have 3GSupport-0.4.tar.gz in /sdcard you should do following in Terminal Emulator or ConnectBot to extract 3Gsupport-0.4.tar.gz:
Code:
# su
# cp /sdcard/3Gsupport-0.4.tar.gz /
# cd /
# tar -zvxf 3Gsupport-0.4.tar.gz
Start the Terminal Emulator, or ConnectBot (to localhost).
Issue 'su' command in terminal window to gain root access.
Plug dongle in usb host port (full size USB on A101IT).
NOTE: For A70IT you'll need something called "mini USB Type-A to USB female host cable adapter", and maybe manually loading of host-mode USB driver (musb_hdrc.ko) – I don’t have A70IT so I can’t test.
Wait couple of seconds (at least 5) and then start 3G modem detection script with '/system/xbin/3Gmodem_detect.sh' command.
The output of the detect scripts should be pretty self-explanatory, and if your modem is supported by usb_modeswitch (in both switching and non-switching mode) you should be able to see that usb serial module is loaded and configuration file is written and support for 3G modems is started.
Output should look like this:
Code:
# /system/xbin/3Gmodem_detect.sh
Supported USB device found !!!! VendorID: 12d1 - ProductID: 1446
New VendorID: 12d1
New ProductID not detected in usb-modeswitch config file. Try to detect it later !
Switching device to usbserial mode !
Looking for target devices ...
No devices in target mode or class found
Looking for default devices ...
Found devices in default mode, class or configuration (1)
Accessing device 004 on bus 002 ...
Getting the current device configuration ...
OK, got current device configuration (1)
Using endpoints 0x01 (out) and 0x81 (in)
Using endpoints 0x01 (out) and 0x81 (in)
Inquiring device details; driver will be detached ...
Looking for active driver ...
OK, driver found ("usb-storage")
OK, driver "usb-storage" detached
SCSI inquiry data (for identification)
-------------------------
Vendor String: HUAWEI
Model String: Mass Storage
Revision String: 2.31
-------------------------
USB description data (for identification)
-------------------------
Manufacturer: HUAWEI Technology
Product: HUAWEI Mobile
Serial No.: not provided
-------------------------
Setting up communication with interface 0 ...
Using endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
OK, message successfully sent
Resetting response endpoint 0x81
Error resetting endpoint: -110
Resetting message endpoint 0x01
Error resetting endpoint: -19
Device is gone, skipping any further commands
Checking for mode switch (max. 20 times, once per second) ...
Searching for target devices ...
Searching for target devices ...
Found target device, now opening
Found correct target device
Mode switch succeeded. Bye.
Detected ProductID of a switched device: 140c
USB device VendorID: 12d1 ProdID: 140c. Probing serial mode
usbserial.ko module registered and /dev/ttyUSB{X} device nodes created sucessfully.
Writing default configuration to '/data/local.prop' file .....Done.
!!! REBOOT your A101IT now in order for your configuration to become active !!!
After reboot:
Disconnect your 3G USB dongle, do not connect anything to USB host port and go to Settings->Wireless & Networks->Cellphone tethering.
If there is tethering profile already defined, delete it - Archos handles only one tethering profile definition at a time.
Create new USB tethering profile.
Your APN, username and password won't be detected automatically, so fill them manually - find adequate info from your 3G service provider (for me on Telekom Srbija: APN is ‘gprsinternet’, username is ‘mts’, and password is ‘064’ (some 3G operators don't need username and password)).
This will create file '/data/tether_start' with adequate commands for ppp daemon to initialize 3G modem and make a connection to your 3G provider.
NOTE for uruk-0.6: It '/data/tether_start' file is not created after wizard finishes try following in terminal emulator:
Code:
su
chown 1000:1000 /data
chmod ug+rwx /data
then delete the tethering profile just created and re-create it again !!! Now everything should be OK.
File should look like this:
Code:
TIMEOUT 5
ECHO ON
ABORT BUSY
ABORT ERROR
ABORT 'NO CARRIER'
ABORT VOICE
ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
ABORT DELAYED
TIMEOUT 12
'' ATZ
OK AT+CGDCONT=1,"IP","[COLOR="DarkRed"]<your APN configured in tethering wizard>[/COLOR]"
OK ATD*99#
TIMEOUT 120
CONNECT ''
If steps 3 and 4 were OK, then you should be able to test pppd connection to the Internet.
NOTE: This test assumes following:
a) that SIM/USIM card in your 3G modem doesn't require PIN code.
b) that your 3G modem automatically register SIM/USIM to a network in Automatic mode (auto-band, 3G preferred mode (EDGE service if no 3G available))
​If this is not a case please take a look in section "Modifying tether_start script" later, for reference how to modify '/data/tether_start' script with adequate AT commands that should be sent to modem.
Re-plug your 3G USB dongle.
Wait at least 5 sec.
Start the Terminal Emulator, or ConnectBot (to localhost).
Issue 'su' command in terminal window to gain root access.
Issue '/system/xbin/3Gmodem_init.sh' command
Issue '/system/bin/pppd /dev/ttyUSB0 460800 debug mtu 1280 mru 1280 name <username> password <password> call tether'
If you get CONNECTED message then your dongle and /dev/ttyUSBx port is set right and everything is configured well.
Output should look like this:
Code:
ATZ
OK
AT+CGDCONT=1,"IP","[COLOR="DarkRed"]<your APN configured in tethering wizard>[/COLOR]"
OK
ATD*99#
CONNECT
You can interrupt pppd with Ctrl+C.
If you don't see CONNECT (or any) response from modem try with one of other ttyUSB[0-5] ports first, or refer to following section on modifying /data/tether_start script.
Assuming the step 5 was success, edit '3Gmod.usbPort' option to match the number you have used in test in step 5, in '/data/local.prop' file, and REBOOT your Archos.
From now you can use 3G USB tethering just by plugging 3G USB dongle, and starting 'Setup->Wireless & Network->Cellphone Tethering->Tether'.
Modifying '/data/tether_start' script for your particular 3G modem and 3G operator:
File '/data/tether_start' is standard chatscript for unix chat program ('man chat' on Google for more info and syntax reference) used by pppd when making connection.
In default tether_start file most important line is one for setting APN: ' OK AT+CGDCONT=1,"IP","<your APN configured in tethering wizard>" ' in example above.
Second important line is one that connects your modem to your 3G data provider: 'OK ATDT*99#' - for some providers it needs to be modified to 'OK ATDT*99***1#'.
If your SIM/USIM card needs PIN in order for you to be able to use your 3G USB dongle, try to disable PIN on your card before using it in 3G USB dongle.
If you can't disable PIN for your SIM/USIM card (for example, as far as I know Tele2 cards must have PIN), you'll probably need to modify 'tether_start' script and to add adequate AT commands and expected responses, before setting APN.
A solid reference of 3G modem AT commands and manufacturer/model specific AT commands can be found these pages:
http://3g-modem.wetpaint.com/page/common+AT-commands
http://3g-modem.wetpaint.com/page/Huawei+AT-commands
http://3g-modem.wetpaint.com/page/ZTE+AT-commands and
http://3g-modem.wetpaint.com/page/Sierra+Wireless+AT-commands
Example /data/tether_start script that sends PIN 1234 and sets "auto 3G/GPRS mode" (for Huawei 3G USB dongles only !!!) looks something like this:
Code:
ABORT 'BUSY'
ABORT 'NO CARRIER'
ABORT 'VOICE'
ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
ABORT 'DELAYED'
REPORT CONNECT
TIMEOUT 6
'' ATQ0
OK-AT-OK ATZ
TIMEOUT 3
OK AT+CPIN=1234
OK-AT-OK ATI
OK ATZ
OK ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK AT\^SYSCFG=14,2,3fffffff,0,1
OK-AT-OK AT+CGDCONT=1,"IP","<your APN configured in tethering wizard>"
OK ATDT*99***1#
TIMEOUT 30
CONNECT ''
There is a plenty of information on the Internet on how to configure Linux ppp chatscripts for particular models of 3G USB dongles and 3G operators, so please SEARCH, READ & TRY before asking, since you'll have to try it anyway at the end .
ISSUES:
First start of tethering after plugging, re-plugging 3G USB dongle or stopping tethering can (and probably will) end in "unable to connect by tethering" message.
This happens since dongle needs to be switched to usb-serial mode, kernel modules must be loaded, and most important 3G dongle must register to 3G data network to be able to connect, and Android framework timeout before connection is established.
Solution is to just start tethering again, and since there is no need to do a usb_modeswitch again, and kernel modules are already loaded, and dongle is registered to 3G network provider, it will connect before timeout.​
When Archos wakes-up after sleep, some dongles (ZTE-MF190 is one of them), wake-up in default mode (non usb-serial mode), so tethering needs to be stopped and started manually.
One possible workaround is to enable "Prevent device from going to sleep" in 'Setup->Wireless & Network->Cellphone Tethering', but with uruk-droid 0.4.1 based on Archos 2.0.x firmware this option didn't work as expected - device still goes to sleep, even if tethering is connected.
With 2.1.x based uruk-droid (0.6 is first) it seems that this option works.​
QUESTIONS & ANSWERS:
Q: Can I use my phone and 3G modem whithout reconfiguring tethering every time I switch them ?
A: Please take a look in this post
FUTURE PLANS:
Integration of real USB-cable tethering with Android based devices that require Archos to tether using usbnet.ko module via "Ethernet-over-USB" type of link. - DONE
Change log:
0.4.1 - Integrated in UrukDroid-0.7 with minor script errors corrected, tutorial updated
0.4 - RNDIS (Ethernet-over-USB) tethering merged with 3G modem, and Archos default USB tethering support this version needs UrukDroid-0.6 at least
changed scripts, in order to acheive auto-detection of tethering type (RNDIS, 3G modem or Archos default Serial-Over-USB)
changed location of saved 3G modem configuration data to /data/local.prop, so the configuration data is avalible upon reboot as Android properties (/data/local.prop file is NOT overwritten by 3Gmodem_detect.sh, so don't worry ;-) )
elimninated need for /etc/uruk.d service, because of previous changes
0.3 - lot of changes in scripts, in order to make 3Gdongle detection and module load configuration simplier.
/system/xbin/3Gmodem_detect.sh introduced for purpose above
tutorial changed to follow 3Gmodem_detect.sh usage
compatible with 3G USB dongles that don't need switching (like Huawei E176)
wokring on uruk-0.6RC2
0.2 - changes to '/system/etc/uruk.d/3Gsupport' script to conform to urukdriod 0.5 standard
'/system/etc/uruk.d/3Gsupport' script now supports (beside start and stop): status, UIstatus and config parameters as well as second parameter force
no other functional changes
working on urukdroid 0.5 and 0.4.1
0.1 - Initial release tested on urukdroid 0.4.1 and 0.5
Here is the list of 3G modems and providers confirmed to work and optional notes if '/data/tether_start' needed to be altered:
1. Huawei E1552 on MTS Serbia (APN: gprsinternet, U: mts, P: 064) and VIP Serbia (APN: vipmobile, U: vipmobile, P: vipmobile)
2. Huawei E1550 on MTS Serbia (APN: gprsinternet, U: mts, P: 064) and VIP Serbia (APN: vipmobile, U: vipmobile, P: vipmobile), and on Starhub (Singapore) (APN as shinternet no U: and no P
3. ZTE MF190 on MTS Serbia (APN: gprsinternet, U: mts, P: 064) and VIP Serbia (APN: vipmobile, U: vipmobile, P: vipmobile)
4. Huawei E173 on MTS Serbia (APN: gprsinternet, U: mts, P: 064) and VIP Serbia (APN: vipmobile, U: vipmobile, P: vipmobile)
5. Huawei E176 on unknown 3G provider/params
6. Huawei E1691 on Wind Mobile in Canada 3G provider and unknown params, but with configuration file change described in this post
7. Huawei E153 on unknow 3G provider/params
Here is the list of phones with RNDIS USB tethering, confirmed to work:
1. HTC Desire (stock 2.29.405.2 with built-in USB Tethering support enabled)
2. US HTC HD2 running a Desire-based NANDroid ROM on T-mobile (APN: epc.tmobile.com, no U: , no P: )
awesome, will have to try this out on my tmobile web and walk III stick later.
Thanks for this very well done explanation ! I'll try on my 70
solune said:
Thanks for this very well done explanation ! I'll try on my 70
Click to expand...
Click to collapse
Note that you'll probably need microUSB-Type A to USB host cable adapter in order to use 3G USB modem dongle.
I really don't know does Archos 70IT automaticaly unload's clinet mode usb driver, and loads host-mode driver when you plug in microUSB host adapter cable (it should do it - that is one of reasons why host cable has one pin more), but if it doesn't you'll have to load musb_hdrc.ko module in manually.
I think that it must be loaded with parameter mode_default set to 1 in order to activate host mode ('insmod /lib/modules/musb_hdrc.ko mode_default=1').
great it is a good news
but no simply
how the merge on UrukDroid
nenadr said:
Note that you'll probably need microUSB-Type A to USB host cable adapter in order to use 3G USB modem dongle.
I really don't know does Archos 70IT automaticaly unload's clinet mode usb driver, and loads host-mode driver when you plug in microUSB host adapter cable (it should do it - that is one of reasons why host cable has one pin more), but if it doesn't you'll have to load musb_hdrc.ko module in manually.
I think that it must be loaded with parameter mode_default set to 1 in order to activate host mode ('insmod /lib/modules/musb_hdrc.ko mode_default=1').
Click to expand...
Click to collapse
Yes I already have microUSB-Type A to USB Host cable adapter, and it works for my USB drive for example. I've already connected my 3G USB modem dongle just for see what's appen, and light blink on it, so I have hope to do something with your very well explained guide
I'll make feed-back here if host-mode driver loads or if I need to mount it manually.
cajl said:
great it is a good news
but no simply
Click to expand...
Click to collapse
I know it is not simple but it is try-error only until your connection is succesfull for a first time (while you fine tune params for your 3G modem, and for your 3G operator). After that is just metter of sticking 3G USB dongle, waiting 5 seconds, and clicking Tethering on Power Widget (twice )
cajl said:
how the merge on UrukDroid
Click to expand...
Click to collapse
I'll hopefully upgrade to uruk 0.5 today, and adapt scripts (mainly uruk-config ones), to 0.5 version of uruk-droid during the weekend, and post those scripts here.
After that my plan is to upgrade to a uruk-0.6RCx and play with USB cable tethering with Android phones that tether via "Ethernet-over-USB" support (usbnet.ko module).
Hopefully, I will know soon enough if that is operational, and after that I'll talk to $aur0n about integration.
solune said:
Yes I already have microUSB-Type A to USB Host cable adapter, and it works for my USB drive for example. ......
Click to expand...
Click to collapse
If it works with USB drive, that should be proof enough that Archos 70IT is switching to USB host mode just by plugging microUSB host adapter. Good news, more devices supported....
solune said:
I'll make feed-back here if host-mode driver loads or if I need to mount it manually.
Click to expand...
Click to collapse
Please do, thank you very much.
i'm up to step 6 . it was pretty clear up to then. a) i dont have a 3Gsupport.conf file in there b) i guess the bit in the [code ] box isnt what you need to do to edit it c) presuming you mean just open the 3Gsupport file and edit that, am i just replacing all instances of vendor and product or also the VendorID /ProductID bits too?
thefunkygibbon said:
i'm up to step 6 . it was pretty clear up to then. a) i dont have a 3Gsupport.conf file in there b) i guess the bit in the [code ] box isnt what you need to do to edit it c) presuming you mean just open the 3Gsupport file and edit that, am i just replacing all instances of vendor and product or also the VendorID /ProductID bits too?
Click to expand...
Click to collapse
Yup I've made a mess in that part of tutorial (wrong path/name of config file, not clear enough explanation):
You have to edit file '/system/etc/uruk.conf/3Gsupport' and it should look something like:
service_enabled=1
enable=on
vendor=12d1
product=1446
port=0
I've corrected that part of initial post. Thanks.
Pictures of this "exploit"
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I've good news for Huawei E176 user, The modem doesn't require to switch mode.
So we just only need to edit ther_usb start and stop .sh
and here is the code for E176
/system/bin/tether_start_usb.sh
Code:
#!/bin/sh
# $1 is the user (not a mandatory argument)
# $2 is the password (not a mandatory argument)
setprop "3Gmod.enable" "on"
setprop "3Gmod.defVendorID" "12d1"
setprop "3Gmod.defProductID" "1003"
setprop "3Gmod.usbPort" "0"
rmmod usbserial
sleep 1
insmod /lib/modules/usbserial.ko vendor=0x12d1 product=0x1003
sleep 1
SUPPORT3G=`getprop "3Gmod.enable"`
VENDOR3G=`getprop "3Gmod.defVendorID"`
PRODUCT3G=`getprop "3Gmod.defProductID"`
PORT3G=`getprop "3Gmod.usbPort"`
if [ ${SUPPORT3G} != on ]; then
insmod /lib/modules/musb_hdrc.ko mode_default=1
insmod /lib/modules/cdc-acm.ko
if [ $# -eq 0 ]
then
/system/bin/pppd /dev/ttyACM0 460800 call tether
else
/system/bin/pppd /dev/ttyACM0 460800 name $1 password $2 debug call tether
fi
else
if [ $# -eq 0 ]; then
/system/bin/pppd /dev/ttyUSB${PORT3G} 921600 call tether
else
/system/bin/pppd /dev/ttyUSB${PORT3G} 921600 name $1 password $2 call tether
fi
fi
/system/bin/tether_stop.sh
Code:
#!/bin/sh
SUPPORT3G=`getprop "3Gmod.enable"`
if [ $1 = "DUN" ]
then
/system/xbin/dund --killall
elif [ $1 = "PAN" ]
then
/system/bin/pand --killall
else
if [ ${SUPPORT3G} != on ]; then
kill -9 $(pidof pppd)
/system/bin/rmmod cdc_acm
/system/bin/rmmod musb_hdrc
else
killall -15 pppd
fi
fi
Meen said:
I've good news for Huawei E176 user, The modem doesn't require to switch mode.
So we just only need to edit ther_usb start and stop .sh
and here is the code for E176
Click to expand...
Click to collapse
Thanks for the info on Huawei E176. I'll make some chaneges in original scripts, for those users that have modems that don't require switching, to be able to use original scripts. It'll be in 0.3 in next day or so.
cajl said:
Pictures of this "exploit"
Click to expand...
Click to collapse
could you please post some bigger pictures? I'm not sure its big enough for people to see.
ok nenadr, I'll try the rest of the process tonight cant wait to try it. have you managed to get an idea of the sort of battery drain using one of these? ie is it much worse than using wifi?
I'm getting the following on step 7 . I am using uruk 0.5 I it makes any difference
/system/xbin/3Gmodem_init.sh 12d1 1003
No 3G USB dongle support detected. Will try to initialize modem.
Found USB 3Gmodem dongle in default mode connected to device. Starting modeswitch.
ERROR: Module option does not exist in /proc/modules
ERROR: Module usbserial does not exist in /proc/modules
ERROR: Module usb_storage does not exist in /proc/modules
Looking for target devices ...
No devices in target mode or class found
Looking for default devices ...
No devices in default mode found. Nothing to do. Bye.
sh: 1003: unknown operand
Found new Product ID: 0002
1003
0001
0a19 for Vendor ID: .
Loading 3G modem kernel driver with adeqate configuration
insmod: error inserting '/lib/modules/usbserial.ko': -1 Invalid parameters
Kernel module load failed. Exiting.
#
thefunkygibbon said:
I'm getting the following on step 7 . I am using uruk 0.5 I it makes any difference
Click to expand...
Click to collapse
Please, take a look couple of posts up, for an alternate solution, because it seems that your vendorID and productID doesn't need mode-switching. I'll fix the scripts, and tutoral for that case tomorrow.
Sent from my A101IT using Tapatalk
lol. oh yeah. sorry. i didnt know mine was a E176 and as such i skimmed over those posts sorry for appearing to be a bit of a idiot. cant wait for the new script.
btw has $auron shown any interest in incorporating this into his rom. would be useful to have all the legwork done automatically and maybe urukconfig could do some of the stuff that isnt able to be done automatically
thefunkygibbon said:
btw has $auron shown any interest in incorporating this into his rom. would be useful to have all the legwork done automatically and maybe urukconfig could do some of the stuff that isnt able to be done automatically
Click to expand...
Click to collapse
yes, his shown interest but this code is stll not mature (and tested on) enough devices to be merged with uruk.... meybe for some later urukdroid, who knows
Sent from my A101IT using Tapatalk

[IMEI] IMEI Generator

Current version: !IMEIme 2.2.0.4
Bug Fix
Fixed bug in use previous patch that could result in variable used before declared error.
Changed processing order when custom patches were to be used
The program will now process custom patches prior to editing framework.jar and build.prop edits. With new kernel patches requiring a new build.prop users would lose build.prop edits if the kernel was included in custom patches, the program will now patch any user modifications, then process IMEI generation and build.prop edits.
Updated to work with ROMs that do not include GSMPhone.smali
Recently, many ROMs are not including GSM phone utilities in framework.jar. I have added testing for missing GSMPhone.smali and patching via TelephonyManager.smali if necessary.
UPDATED FILES UPLOADED
MANY of the support files have been updated to the newer versions (smali, baksmali, adb and components).
I encourage you to delete all files in your existing IMEI Generator folder and use the new !IMEIMe.exe to generate the files necessary.
The devices.dat file if you've used the previous version has several issues that prevents the device model from being correctly patched on many of the devices. This has been fixed here and in the device list thread.
There is a known issue with the GUI when your screen settings are set at 125% in Control Panel - Appearance and Personalization - Display... I will work on fixing that in the next release.
Bug reporting thread for !IMEIme
Device list thread
New features:
Will patch GSMPhone.smali if present in framework... patches TelephonyManager.smali otherwise.
I chose this method since more ROMs are coming out for wifi tablets that do not have GSM phone information included in framework.jar. I was playing with CM10.1 and discovered GSMPhone.smali is not present, thus I was getting unable to patch GSMPhone.smali error, and there was no patching for an IMEI. In all honesty... this should be irrelevent, since IMEI is only utilized in cellular communications on GSM phones... however... some applications MAY (xda free does) require an IMEI to work, even on wifi only devices.
ODEX files still in the works
odex file support... I think this solution will work on odex file systems as long as the patching is done on the ROM prior to flashing to device (anyone using odexed system please let us know) and I am working on in place patching on odexed systems... however, I am not completely comfortable since there is a lot of work done by the device itself during odexing of the modified files... I am very hesitant since any mistake could render a bricked device and I don't have a system to test with prior to release.
Previous Important Changes
The new version of the IMEI Generator will no longer overwrite your existing devices.dat file with the current. To use new devices.dat file, delete the old one prior to running the program, or download the new one and unzip it in the IMEI Generator directory.
Device Communications not necessary in certain situations
If you select to Update ROM, using Serial Number based IMEI and do not select Encrypt IMEI, the program will no longer need to communicate with the device when performing its tasks. The framework.jar patch will not hard patch the IMEI in this situation as before. This is useful for patching a ROM for distribution to multiple people, since they will all maintain unique IMEI's. This is accomplished with the following change in the framework.jar
Code:
/com/android/internal/telephony/gsm/GSMPhone.smali
.method public getDeviceId()Ljava/lang/String;
[b]changed[/b] iget-object v0, p0, Lcom/android/internal/telephony/gsm/GSMPhone;->mImei:Ljava/lang/String;
[b]to[/b] sget-object v1, Landroid/os/Build;->SERIAL:Ljava/lang/String;
prior to patching in code to prepend "0"
.method public getDeviceSvn()Ljava/lang/String;
[b]changed[/b] iget-object v0, p0, Lcom/android/internal/telephony/gsm/GSMPhone;->mImeiSv:Ljava/lang/String;
[b]to[/b] sget-object v1, Landroid/os/Build;->SERIAL:Ljava/lang/String;
prior to patching in code to prepend "0"
To try to explain the above a little...
The above is always changed, no matter what IMEI generation method you select...
If you select Serial Number and New Type IMEI and not Encrypt: no other patching is done for the IMEI... this can be implemented on many devices, since each will have a unique serial number.
If you select Serial Number and do not select New Type: additional code is added to format the IMEI to the old standard ("00-" and "-"s)... this can be implemented on many devices for same reason.
If you select MAC Address or Encrypt (or both): additional code is added that results in the IMEI being hard coded, this makes it very much device specific.
If you select MAC Address or Encrypt (or both) and do not select New Type: additional code is added that results in the IMEI being hard coded as well as code to format the IMEI, this makes it very much device specific.
Use Custom Patch NOTE: This is only used when patching a ROM
This is going to take some major explanation, since I ran into so many possible scenarios...
One thing of note... the only additional lines added to updater-script will be for files in the base directory
The order of processing is:
1. Original ROM updater-script and files
2. Custom Patch zip file
3. Custom Patch folder
The program will utilize folders (from Patch zip file or Patch folder itself) named modboot, modsys, or system (not case sensitive in windows) as well as files in the base folder
Any files in modboot will be moved to the root of the **ROM**-IMEI.zip file and lines added to updater-script as needed
Any files in modsys will be moved to the system directory of the **ROM**-IMEI.zip file
If Custom Patch is checked...
/META-INF/com/google/android/updater-script is extracted from the ROM
the program will ask you to select the Custom Patch Folder
If there is a zip file present in the folder the program will ask if you want to use it
You have 3 options, "Yes", "No" or "Cancel"
Yes = Use the zip file
No = Don't use it, select another
Cancel = Don't use a zip file
If you use a zip file, it will extract the zip file and process the updater-script in it for any additional lines needed
After the above, any non-zip files and modboot, modsys and system directories in the Patch Folder will be processed
I chose this order so you can have a "go to" patch zip file, and test other additions by using the file, folder options prior to including them in the zip.
Example here:
I have my custom patches in folder /CM7/UserMods with these contents:
/META-INF
/modboot
/modsys
patch.zip
The program processes patch.zip first, then overwrites any files with the files in modboot and modsys
It also processes /META-INF/com/google/android/updater-script for any lines extracting files to /boot and adds them to the original ROM updater-script if not already there.
It then adds lines for any files originally in /modboot to updater-script to extract them to /boot
"New IMEI Type" of IMEI which no longer has the "-"s in it, but maintain backward compatibility for those who already have IMEI's generated or prefer the old style. When the new type is selected in the GUI:
NOTE: Per the IMEI standards... Using a single 0 prepended to the IMEI indicates a TEST IMEI for a country with 3 digit international code... while it should have no implications to us since we are not on a cell... it may provide potential country validity issues... I will monitor this and resort to 00 prefix in the new type of IMEI if necessary.
ADDITIONAL NOTE: Per the IMEI standards... For devices without an IMEI, they are to provide a unique serial number to be used... This program modifies framework.jar to allow this.
I am now patching framework.jar in the /com/android/internal/telephony/gsm/GSMPhone.smali file instead of /android/telephony/TelephonyManager.smali (this change is what allows the information to display in the about tablet information)
I am renaming and patching 2 functions... getDeviceID() and getDeviceSvn()
By patching the two functions in this file... the IMEI now shows in Settings... About Tablet... Status... no longer have to use external program or dial *#06# to verify the device is patched.
getDeviceID() shows it in IMEI
getDeviceSvn() shows it in IMEI SVN
You can rename or copy !IMEIme.ini to IMEIme.ini and the program will work.... useful for *nix users and probably mac users... since they have issues with special char actors (!)... While I like to use it in windows to keep the executable and ini file at the top of the file list in windows explorer... anyway...
The program looks for IMEIme.ini first and uses it if present... if it is not... it then looks for !IMEIme.ini (which will be there... because the program installs the generic !IMEIme.ini if it isn't ) This also provides a good way to keep your ini.. and see the new settings in the compiled in ini.
GUI selection and related ini setting
GUI: New IMEI Type
INI Setting:
New_Type =
; If 0 then the old type of "00-XXXXXX-YYYYYY-ZZZ" will be used
; If 1 then the new type of "00XXXXXXYYYYYYZZZ" will be used
BUG FIX
No known or reported bugs to work out.
!IMEIme.ini file default settings and explanation:
Code:
;The setting options are 1 (use the option) or 0 (don't use the option)
;WiFi IP Address can be set to your Nook's IP address here to a default to use
;IMEI can be set to a default here... you can also set the seed you use for generation
;Setting Device_Manufacturer to anything will result in an edit to build.prop setting the entered manufacturer
;IF Device_Manufacturer is NOT blank then:
;Setting Manufacturer_Device to anything will result in an edit to build.prop setting the entered device
;
;NOTE: ONLY Device_Manufacturer is necessary for this edit... there have been no software that appears to
; require a device edit
;
;Setting LCD_Density will result in build.prop edit for this setting regardless of Device_Manufacturer setting
;
;Set all options in [Settings] section at the bottom
[Settings_Explained]
Use_In_Place = 1
; If 0 Disable In Place patching... useful for those who always update AOSP ROM files and never patches on device framework.jar
; If 1 Enables In Place patching if ADB is working
Use_Previous_Patch = 0
; If 0 Ignore IMEI.fix
; If 1 AND IMEI.fix exists... use it for patching
Use_Serial_Number = 1
; If 0 then do not base IMEI off of Device Serial Number
; If 1 then base IMEI off of Device Serial Number
; NOTE: This takes priority over Use_MAC_Address
Use_MAC_Address = 0
; If 0 then do not base IMEI off of Device MAC Address
; If 1 then base IMEI off of of DeOvice MAC Address (last 5 hex words) (2 bytes = 1 hex word)
; 0A is converted to 010, FF is converted to 255 etc.
; NOTE: Use_Serial_Number takes priority
Use_Manual_Input = 1
; If 0 then Manual Input disabled
; If 1 then Manual Input enabled
Encrypt_IMEI = 1
; If 0 then uses actual data for IMEI... i.e. Serial Number (last 15 digits) or MAC Address (last 5 hex words) is actual IMEI
; If 1 then program encrypts data for IMEI generation... hiding actual Device data
New_Type = 1
; If 0 then the old type of "00-XXXXXX-YYYYYY-ZZZ" will be used
; If 1 then the new type of "00XXXXXXYYYYYYZZZ" will be used
Use_ADB = 1
; If 0 then ADB is disabled... this will prevent In-Place updating from working all together
; If 1 then ADB is enabled... In-Place will work... IF adb is working on your device
; NOTE: This takes priority over Use_ADB(usb) and Use_ADB(WiFi)
Use_ADB(usb) = 1
; If 0 then ADB via USB connection is disabled... I use this since some ROM's have Debug Mode issues
; If 1 then ADB via USB is enabled and attempted first
; NOTE: Use_ADB takes priority over Use_ADB(usb) and Use_ADB(WiFi)
Use_ADB(WiFi) = 1
; If 0 then ADB via WiFi connection is disabled
; If 1 then ADB via WiFi is enabled... I use this since some ROM's have Debug Mode issues
; NOTE: Use_ADB takes priority over Use_ADB(usb) and Use_ADB(WiFi)
Clean_Up = 1
; If 0 then the program will leave all support files when cleaning up and exiting
; If 1 then the program will delete all support files when cleaning up and exiting if none of them
; existed at program start
Include_Patch = 0
; If 0 then custom patches is disabled
; If 1 then the program will prompt for custom patches to include
Device_Manufacturer =
; If blank then the program will not edit build.prop
; If anything other than blank the program will edit build.prop to include manufacturer
Manufacturer_Device =
; If blank then the program will not include device in build.prop edit
; IF anything other than blank the program will include device in build.prop edit
; NOTE: No build.prop edit will occur if Device_Manufacturer is blank
Device_Model =
; If blank then the program will not include model in build.prop edit
; IF anything other than blank the program will include model in build.prop edit
; NOTE: No build.prop edit will occur if Device_Manufacturer is blank
Build_Fingerprint =
; If blank then the program will not include Build Fingerprint in build.prop edit
; IF anything other than blank the program will include Build Fingerprint in build.prop edit
; NOTE: This edit will occur even if Device_Manufacturer is blank
LCD_Density =
; If blank then the program will not include LCD Density in build.prop edit
; IF anything other than blank the program will include LCD Density in build.prop edit
; NOTE: This edit will occur even if Device_Manufacturer is blank
WiFi_IP_Address =
; You can enter the default Device IP address here... especially useful if you are only using this on one device...
; or if you keep seperate folders for each device you use (!IMEIme.exe and !IMEIme.ini must be in each folder)...
; i.e. folder for "sister" containing the program and ini file at minimum.
; If blank the program will prompt you for the IP address of the device to establish ADB WiFi connection
IMEI =
; Enter a base 10 (integer) and it will be used as the IMEI (duplicated until 15 digits is reached)
; Enter your "seed" and the program will generate an IMEI based off of it
; NOTE: If you try to generate the old GENERIC IMEI the program will not do it
[Settings]
Use_In_Place = 0
Use_Previous_Patch = 0
Use_Serial_Number = 1
Use_MAC_Address = 0
Use_Manual_Input = 1
Encrypt_IMEI = 0
New_Type = 1
Use_IMEI(15) = 0
Use_ADB = 1
Use_ADB(usb) = 1
Use_ADB(WiFi) = 1
Clean_Up = 1
Include_Patch = 1
Device_Manufacturer =
Manufacturer_Device =
Device_Model =
Build_Fingerprint =
LCD_Density =
WiFi_IP_Address =
IMEI =
Credits:
mthe0ry: Credit for the original IMEI patches released for us Nookers(TM). His original thread is here...
martian21: Took mthe0ry's work and maintained it for releases of CM7, upeating it for each nightly that needed a new one. Martian21's thread.
HacDan on irc.freenodes.net #nookcolor for helping me figure out patching GSMphone.smali instead of TelephonyManager.smali
Thank you's:
paleh0rse: I believe was the first to download and test this program... I think the first bug report too... helped many users with suggestions regarding their apps.
mr_fosi: Continues testing and reporting despite no need to. Tested a few private beta builds to help iron out a significant issue. Also providing information regarding Phone App *#06# IMEI test.
martian21: Set the wheels turning. Provides invaluable feedback and suggestions. He is an invaluable tester and Q&A guy. Thanks for dangling that bait
mellopete: Provided the very first bug report... prompted me to include necessary files in the program itself.
TheMainCat, 12paq and frankusb: Provided bug reports leading me to look at why some Windows versions didn't run the program initially.
Nayla1977: Bug report regarding a mistyped EndIf in my source.
jdexheimer: Bug report that lead me to find a problem with folders with spaces in them.
LinuxParadigm: Bug report regarding missmatching If - EndIf's.
BitingChaos: first public post to get me back on target.
dillweed, garrisj and many others: for PM's indicating the importance of this solution.
lemdaddy for reporting the bug that we tracked down to the java version and reporting back that it was the java version causing issues.
adusumilli for reporting the bug where IMEI was generated as "00-cat: c-an't o-pen"
topcaser for being persistent enough with the bug causing In-Place to fail in certain situations.
HacDan on IRC for leading me in the right direction to impliment the patching of GSMphone.smali.
We are all adults, if we break our toys... we only have ourselves to blame and we may have to buy new ones... (this will NOT break your Nook... I PROMISE you that! but it may break some of your apps... more on that later in post)
BUG REPORTING:
This program was initially ineteded to generate a unique IMEI based on your device S/N and update Dev's install zip files... it has become so much more, and as such there are many functions involved in this process.
Due to the complexity the program has taken on... far beyond what I initially intended... to report bugs please try to use the following as a template:
Function attempting: i.e. Updating ROM... In Place Upgrade... Update framwork saved on computer... etc.
Error Messages: any error message you receive... or the last message you saw prior to the issue.
End result: i.e. GSMphone.smali updated, ROM not... GSMphone.smali updated framework.jar not... etc....
Environment: ROM in same folder as IMEIme.exe... ROM on same drive as IMEIme.exe... ROM on different drive... etc. (same for framework if updating framework instead)
!IMEIme.ini settings: you can put your entire ini file if you'd like.
If you could take notes of EXACTLY what which selection in the GUI you have selected and any buttons you click on which prompt it would be EXTREMELY helpful...
As I said, this program has taken on functions I initially had not imagined including... the more features added, the more complex testing and tracking bugs becomes... I don't want to include a bunch of messages just for the sake of letting you know where in the code you are... would not be beneficial to you... more buttons to click for no reason, etc.
The more detailed you can be, the quicker I can see what is happening... otherwise I have to try to duplicate what I think you are doing when you get the error.
mr_fosi and martian21 have been very tedious in reporting bugs... I greatly appreciate their testing despite not needing to, and the manner in which they document what is going on....
Everyone should click "Thanks" on their bug report posts... they have been instrumental in getting the program where it is so far.
Background:
Some developers require a unique number that is supposed to be provided by hardware manufacturers that is unique to every device. This unique number (IMEI) is extremely important in devices utilizing cellular communications.
Since B&N has not registered IMEI numbers for the Nooks, the AOS's we are using do not acquire it as they do in other Android devices.
The developers that require a unique IMEI have been less than receptive of our devices and past methods to provide functionality to utilize their apps.
I decided to provide what I believe to be a viable solution to this problem.
What this program is:
It is a method to provide a unique IMEI (with reasonable certainty) for our Nooks.
It IS intended to be a supplement until IMEI is addressed in dev's ROM's.
It IS viable for Froyo... CM7... CM9... CM10...Honeycomb... MIUI.... AOKP... and others.
I can't think of any reason it will not work with ANY ROM you choose to utilize... if you run across one... just let me know and I'll see if I can't fix that.
What this program is not and does not do:
This is not a perfect solution to our Nook specific issues. Let me make it PERFECTLY CLEAR there is NO PERFECT SOLUTION We are generating an IMEI from something else... I use TEST IMEI patterns based off of our device serial number, to ensure apk devs wouldn't come down on us.
It is not targeting any specific AOS.
It is not guaranteed to be accepted by any other developers.
It is not intended to be the end all, beat all solution.
It is not intended to dissuade other developers from providing what they feel is a better method.
It will not cause any programs to show in the market. That has to be dealt with via APK developers and/or build.prop Manufacturer strings.
Potential issues:
There is NO legitimate solution to the IMEI issue we Nookers (TM) face... unless a group desires to register a block of them for our use... thus I am generating TEST IMEI's... ideal... no, but the only method available to us.
While I feel, with significant certainty, there will be no negative consequences from apk devs in general, I cannot speak for them, or their logic. This can easily be disabled by them again. That is on them, not me or us. By the same token, they can decide to stop providing their service for cause, I still have no control over that.
Above, I emphasize “with reasonable certainty” due to the fact that, in theory, you can wind up with an IMEI that 9 other Nooks that use this software has. That can only happen if the other 9 owners use this program and have a serial number within the same 10 as yours. This is even less likely with the New IMEI Type since it is using the right most 16 digits of a device serial number (and we know they all start with 2)
If everyone who has the same beginning 15 digits utilizes this program to generate an IMEI, you will all wind up with the same IMEI. Given the number of Nooks out there compared to the number of user's hacking them.... I find it extremely difficult to believe, with a reasonable certainty, that any 2 (much less 10) devices would ever wind up with the same IMEI generated by this program. This is prevented when using the New IMEI Type
What this program does/is capable of:
It allows you to extract framework.jar from a developers update zip file.
It will allow you to pull framework.jar from your Nook or use an existing framework.jar already stored on your computer.
It will generate an IMEI based on your Nook's serial number (or MAC Address) if adb is working on your system. If you have issues running adb via USB (ADB(USB)), it provides the opportunity to utilize adb via WiFi (ADB(WiFi)) for any computer-device communications.
It will provide you a method to manually input your serial number if you cannot connect to the device via adb. You can also input a “seed” (easy to remember word or phrase) and generate an IMEI based on the ASCII codes of the text you enter.
It will edit /com/android/internal/telephony/gsm/GSMPhone.smali to rename any existing getDeviceId() and getDeviceSvn() function to getDeviceId2() getDeviceSvn2() and append the patch to end of that file. NOTE: When the program "smali's" the resulting GSMphone.smali... it relocates the appended function to be before the renamed function.
It will save the patch as IMEI.fix, thus allowing you to utilize it for subsequent runs of the program. A caveat to this is... if you run it from the same folder on a friend's Nook... it will overwrite your original one if it is in the same folder or they will have the same IMEI as you do if you use Previous Run.
It will offer to push the patched framework.jar to your Nook... IF you opted to pull framework.jar from your Nook AND adb successfully worked to do that. This facilates in place upgrading.
It will backup the existing developers zip file appending “-IMEI” to it, distinguishing it is one this program has been used on. It will update this file, not the original developers file.
If there are issues with file names that become duplicate in a case insensitive OS such that windows is, it will warn you of this case and not remove the updated framework.jar to facilitate manual updating of the zip file.
Caveats:
This program is known to work on Java version 1.6.0_23 and known NOT to work on version 1.6.0_17 or earlier. If your system seems to work fine... but the nook does not give you an IMEI number... check your java version by typing this in a DOS window (start-run and type in cmd):
java -version
this will tell you the version of java you are running.
Java must be on your system. It must be in your system's path statement, or this program must be in the java/bin folder. It is possible that you must have java 32 bit version, this is being researched.
It will very likely break your swype, or any other app that utilizes IMEI for validation and you have used previous methods to circumvent their validation process.
It will likely break the same software if/when developers include a fix to the Nook IMEI situation in their AOS. Unless you opt to use this method again on their AOS to ensure you maintain the IMEI you used my program to generate.
Since I have opted to utilize test formed IMEI's to prevent duplicating someone's “real device” IMEI, software developers can easily shut us down again. That is their option. I am trying to provide a solution that is acceptable to both sides of the fence.
Closing statement:
As I desire to make this program as beneficial as possible... PLEASE provide any feedback and/or bug reports... just don't continue to push your ideals once it has been discussed... beating dead horses gets tiresome and just wastes precious time.
112 downloads of 2.2.0.3 with bug when pervious fix was selected
1686 downloads of 2.2.0.2 with no bugs reported
141 downloads of 2.2.0.1 with CM10 in place bug that would cause BBSOB and never boot
197 downloads of 2.2.0.0 (that actually appeared to be 2.1.0.4 in the zip) with a few minor bugs... mostly in custom patching
648 downloads of 2.1.0.3 with known GT for GameLoft issues
1123 downloads of 2.1 with no known bugs
182 downloads of 2.0a with a Generic IMEI bug
1919 downloads of 1.9 with no bug reports
3131 downloads of 1.8 with all bug reports being for non-nook devices
80 downloads of 1.7 with no bug reports
600 downloads of 1.6 with a couple of reports of In-Place update bug
880 downloads of 1.5a with 0 bug reports
148 downloads of 1.5 with a bug that could result in IMEI being generated without being properly formed.
36 downloads of 1.4 with a bug that could result in IMEI of "cat: can't open".
258 downloads of 1.3 with 0 bug reports... time to move on with next feature.
1618 downloads of 1.1 and the only bug noted has been tracked to the user's Java version.
12,758 downloads prior to the current version.
Bug reporting thread for !IMEIme
Device list thread
Looks like I have something new to mess with tomorrow night... thanks for working this, we owe ya!
Been looking forward to this! Thanks for your hard work DizzyDen.
Tested it out however it isn't finding 7zip. I've tried both the 64-bit and the 32-bit version (on 64-bit Windows 7). I'm probably doing something wrong if so please feel free to enlighten me
Martian21
martian21 said:
Been looking forward to this! Thanks for your hard work DizzyDen.
Tested it out however it isn't finding 7zip. I've tried both the 64-bit and the 32-bit version (on 64-bit Windows 7). I'm probably doing something wrong if so please feel free to enlighten me
Martian21
Click to expand...
Click to collapse
It wasn't you... there's something weird with the API to the fileopendialog that changes the working directory... a TEMPORARY work around is to copy the zip file to the folder you are running the program from.
Updating to beta 2 to auto extract support files on run.
Beta 2 is up... OP updated... note the bold text... for now the zip file must be in the same folder as IMEIme.exe
That will be fixed shortly.
Updated to beta 3. OP updated.
Fixed file browse for update file.
Improved cleanup behind itself before exiting...
removes helper files
removes framework.jar
removes classes.dex
removes out folder
removes system folder (the one used to add framework.jar to the zip file)
Still debating ability to allow manual input of the IMEI or a serial number... but those that want to do it will probably figure out how to do it manually... its REALLY not that hard.
Will add random IMEI generation as an option. The only purpose I see for this is for those who don't want to use the generic IMEI and cannot get adb working... even with the included adb in this program.
Feedback and bug reports are welcome and will help improve the program.
Thank you for this
I had to copy my AdbWinApi.dll for it to work. It did not put the new framework.jar in the zip though. It made the files, but didn't update the zip. I moved it to the root of my drive and ran it as administrator, but it still didn't update the zip. I am using Windows 7 x64. I used the IMEI.fix file and updated the zip myself. Thanks again for this nice tool.
mellopete said:
I had to copy my AdbWinApi.dll for it to work. It did not put the new framework.jar in the zip though. It made the files, but didn't update the zip. I moved it to the root of my drive and ran it as administrator, but it still didn't update the zip. I am using Windows 7 x64. I used the IMEI.fix file and updated the zip myself. Thanks again for this nice tool.
Click to expand...
Click to collapse
Did you use something prior to b3 ?
There was an issue I discovered that was preventing appending IMEI.fix to TelephoneProvider.smali that was fixed in b3.
I did my development on windows64 so that shouldn't be an issue.
As for the dll... I hadn't experience issues with that... but I can certainly add it to the program.
Both adb dll's will be included in all releases after b3.
Good job!
Can you explain more about how rom is being affected?and what to check?
Sent from my phiremod for Nook using Tapatalk
DizzyDen said:
Did you use something prior to b3 ?
There was an issue I discovered that was preventing appending IMEI.fix to TelephoneProvider.smali that was fixed in b3.
I did my development on windows64 so that shouldn't be an issue.
As for the dll... I hadn't experience issues with that... but I can certainly add it to the program.
Both adb dll's will be included in all releases after b3.
Click to expand...
Click to collapse
b3 is the first one I tried. I didn't look at the classes.dex before it was deleted. I will check.
RASTAVIPER said:
Good job!
Can you explain more about how rom is being affected?and what to check?
Sent from my phiremod for Nook using Tapatalk
Click to expand...
Click to collapse
Read here http://forum.xda-developers.com/showthread.php?t=1004102
TelephonyManager.smali did not change.
mellopete said:
TelephonyManager.smali did not change.
Click to expand...
Click to collapse
Please make sure b3 is the one you are using. When you originally posted... the thread was showing 0 downloads of that file.... or just wait a few minutes... beta 4 is on its way shortly.
To ensure TelephonyManager.smali is not changed you need to look in two places.... the easiest way is to search for getDeviceID
If it worked correctly you should find 2 instances... the first is the original function and my program renames it to getDeviceID2()... the second should be the one !IMEMe adds to the end of TelephonyManager.smali
Additionally... could you check and see if your run is actually overwriting update zip file.... see if there is a update ".zip.tmp" file left over... if it is there... the zipping is running into an issue overwriting the original file... I thought I had that issue worked out... but may need to add a check for that within my program.
I d/l b4, dropped it in a directory with just the .zip for n87 and ran it (win7 pro 64-bit). It errored out and here's the play-by-play of each of the windows which popped up one immediately after the other:
- I was warned about you being an unverified software publisher, which I OKed.
- "Windows cannot find 'java'. Make sure you typed the name correctly, and then try again." I OKed this one as well.
- window titled "DizzyDen's IMEI Generator" containing: "Return Code is:0 and Error Code is: 1"
- window titled "DizzyDen's IMEI Generator" containing: "Java is required on your system. You can download the current version from http://java.com"
I have JRE6 on my machine, though it is not in the system PATH.
Oh, and there were files for 7za, adb, .dll's and .jar files left behind.
mr_fosi said:
I d/l b4, dropped it in a directory with just the .zip for n87 and ran it (win7 pro 64-bit). It errored out and here's the play-by-play of each of the windows which popped up one immediately after the other:
- I was warned about you being an unverified software publisher, which I OKed.
- "Windows cannot find 'java'. Make sure you typed the name correctly, and then try again." I OKed this one as well.
- window titled "DizzyDen's IMEI Generator" containing: "Return Code is:0 and Error Code is: 1"
- window titled "DizzyDen's IMEI Generator" containing: "Java is required on your system. You can download the current version from http://java.com"
I have JRE6 on my machine, though it is not in the system PATH.
Oh, and there were files for 7za, adb, .dll's and .jar files left behind.
Click to expand...
Click to collapse
java will need to be in your path... I have no way of including all possible locations of where it could be installed... and it is way too big to include with my program.
The left over files is due to the program exiting when it did... I will fix that in next beta... should have waited until java was tested to extract them... or have it perform cleanup before exiting on any errors... sorry bout that.... you can leave them... when you have successful run (or run beta 5 or later) it will clean them up.
For now you may have to run as administrator.... I will try to add code to avoid this in the short future.
BTW. Nowhere does getDeviceID does it say that it must be a well formed IMEI.
nemith said:
BTW. Nowhere does getDeviceID does it say that it must be a well formed IMEI.
Click to expand...
Click to collapse
As much as I admire your work... I am honored that you are even checking this out.
I do understand that as of now it is not required... but I figure if I utilize standards (as much as there are anyway) we may avoid future issues if dev's start checking for well formed IMEI's.
I figure if I'm going to make this... I might as well make it right.
As far as I can determine... if a sw dev implemented IMEI checks, the only thing that could cause them to shut down someone using this would be to check that it is a "TEST" IMEI... but I don't see that happening, because hardware manufacturers do use these in testing.
DizzyDen said:
java will need to be in your path... I have no way of including all possible locations of where it could be installed... and it is way too big to include with my program.
Click to expand...
Click to collapse
Roger that. Should the instructions then note either the required change to PATH or that the file must be run in the user's jre#\bin directory?
DizzyDen said:
The left over files is due to the program exiting when it did... I will fix that in next beta...
Click to expand...
Click to collapse
I figured as much, but thought you should know.
DizzyDen said:
For now you may have to run as administrator...
Click to expand...
Click to collapse
I ran it this way and got the same behavior.
I'll keep a lookout for further versions, test them and report.
Beta 5 is up... OP updated to include Java requirements... thank you mr_fosi for pointing this out.
RASTAVIPER said:
Good job!
Can you explain more about how rom is being affected?and what to check?
Sent from my phiremod for Nook using Tapatalk
Click to expand...
Click to collapse
Did you find the information in the thread linked in response to your questions?
TY mellopete for that.
- Plugged NC into USB port.
- Copied new B5 exe and n87 zip to java\jre6\bin directory.
- Ran exe as admin.
- Prompted for .zip check ("is this correct") and it was, so I OKed it. Not OKing it gave me the option to browse for the file, which I cancelled, resulting in a termination of the prog with a few more dialogs. Any extracted files were cleaned up an prog close, except for adb.exe (which I deal with below).
- Re-ran, exe, chose the detected n87 .zip.
- Displayed correct serial.
- Displayed correct generated 17-digit IMEI.
- Dialog contents "Modifying" gave error "Unable to open file", which I OKed.
- Several more dialogs flew by in rapid succession without error, ending with "Updating ROM" overlaid by "Updated ROM file has been saved as: cm_encore_full-87-IMEI.zip".
- Not all ancillary files were cleaned up. Two files remained: 1) IMEI.fix, a plain txt file containing the correct code to insert the generated IMEI and 2)adb.exe which could not be removed because it was still running the devices server. Running "adb kill-server" in the java\jre6\bin directory allowed me to remove adb.exe.
- A check of the modified smali showed only one instance of "getDeviceId" indicating that the smali had not been modified to add the code to spoof the IMEI.
I would also not have been able to eject my NC, had I tried, until I killed the adb server. Looks like one more line of code to add before cleanup.

[Q] hacking the netd daemon to disable "IPv6 privacy extensions"

Android's netd daemon, by default, enables something known as "IPv6 privacy extensions" (this means that the IPv6 address, instead of being generated from the device's MAC address, will be randomized — but this is irrelevant for my question).
In a nutshell, my problem is this: how can I hack, or communicate with, the netd daemon to force it to disable this feature?
(Android offers no configuration for this. I bug-reported the issue to Google ad android bug #31102 aka http : / / code.google.com/p/android/issues/detail?id=31102 (sorry I'm not allowed to post links) but they, of course, ignored it. Please note that there are lots of pages dealing with the question of how to enable IPv6 privacy extensions, because old versions of Android did not enable them: my question is how to disable them, permanently.)
What the netd daemon actually does is that when a network interface $IFACE is brought up, it opens the file /proc/sys/net/ipv6/conf/$IFACE/use_tempaddr and writes "2" there (this asks the Linux kernel to enable the feature). Up to Android 4.2, what I did was binary patch netd to replace the string "/proc/sys/net/ipv6/conf/%s/use_tempaddr" by "/dev/null\000" so the daemon would simply write that "2" to /dev/null and nothing would happen. But in Android 4.3 that part of the code has been slightly refactored, see InterfaceController.cpp from the netd source code, around line 134 (https : / / android.googlesource.com/platform/system/netd/+/android-4.3.1_r1/InterfaceController.cpp — again I'm not allowed to put links, what a pain), so a binary patch is not so trivial. (I could probably replace "use_tempaddr" by "hfr_grzcnqqe", but it would cause an error message in the logs and I'd like to avoid that.)
(Changing netd's source would be absolutely trivial. But I want to avoid recompiling it, because I'd probably spend many sleepless nights getting the correct native toolchain and convincing the Android makefiles to recompile just this bit: I don't have the resources to do a full Android build. Maybe I'm being pessimistic.)
In principle, it seems that netd reacts to commands that are sent to it (see https : / / android.googlesource.com/platform/system/netd/+/android-4.3.1_r1/CommandListener.cpp starting from around line 434). What I don't know is how to communicate with it to send it such commands, let alone do it precisely when a new interface is brought up. I know that at the other end of the line there is, for example, android.net.wifi.WifiStateMachine (see https : / / android.googlesource.com/platform/frameworks/base/+/android-4.3.1_r1/wifi/java/android/net/wifi/WifiStateMachine.java around line 2104). I'm a Linux dev, not so familiar with the Android IPC mechanisms or daemons, so I was hoping someone more knowledgeable could think of a way to pass a command at the right time.
PS: I'm aware that there's an app called to.doc.android.ipv6config which claims to solve the problem I'm talking about. But, looking at the code (https : / / gitorious.org/android-ipv6config/android-ipv6config/source/58e2060162485b54d4f8c147a558aeed708fa4b4:src/to/doc/android/ipv6config/LinuxIPCommandHelper.java around line 103), it's obvious that it does so in a completely wrong way, namely by talking to the kernel, bypassing netd's role as the network gatekeeper altogether.
PPS: I'm using CyanogenMod (currently 10.1.3, and this issue is preventing me from upgrading to 10.2), but I don't think this is relevant at all (I must admit I didn't check to see if CyanogenMod patched netd and/or android.net.wifi.WifiStateMachine in any way).
Meta-question: Is this the right place to ask? Apparently I have to ask 10 stupid questions before I'm allowed to post anywhere else.
Did you ever find a permanent solution? I've been tackling the issue on my new Galaxy S6 using the steps as outlined in this link:
https://www.reddit.com/r/Android/comments/2z1gyo/fix_lollipop_wifi_issues_and_coincidentally_the/
On the chance that someone has this issue and finds this thread ..
As far as I have seen (< 5.0), communication with the network daemon, netd, is done through unix-domain socket IPC on /dev/socket/netd. The commands are of the form:
Code:
interface setcfg [iface name] [options]
Where 'options' includes 'up' and 'down', among others. I have not verified this, but you may be able to do this from the console -- see 'netcfg'. As far as the specific command to do what you are requesting, I would either pull the netcfg executable into IDA or start by looking at the WifiStateMachine. The state machine set sets this option at line 2092 in the source:
Code:
mNwService.setInterfaceIpv6PrivacyExtensions(mInterfaceName, true);
Additionally, you could just pull in the apk for the WifiStateMachine and modify the smali to send false, rather than true, at the line above and you'll have your permanent disable. For this, see /system/framework/*.apk, or equivalent. The WSM implementation should be there somewhere.
-----------
From the source you posted, I found this too ..
Code:
"Usage: interface ipv6privacyextensions <interface> <enable|disable>"

[Q] About the Radio Interface Layer

Hi everyone,
I am writing this post because I need help for clarifying some aspects of the radio interface layer.
I know that the two main components of the RIL stack are RILD (which interfaces the Java part with the low-level hardware) and vendor-RIL (which interfaces RILD with the modem). Both of them have loops that are used to capture and analyze new commands of events coming from other layers. These loops are the rild event loop, which handles requests from upper and lower layers of Android, and vendor reader loop, which handles the commands from and to the modem. However, I am not 100% sure whether these loops are polling based (i.e., looping all the time even when there are no new data to process) or they are triggered only when a new data or command is received (i.e., interrupt based). At first I thought that it is polling based because of the "loop until 2012 (the end of the world)" in slide number 12 in the presentation "Android RIL - Radio Interface Layer" available here : http://www.slideshare.net/leafjohn/ril-and-android-telephony?related=1 . I also think that the maintenance of the IPC socket of communication between RILD and RILJ (the java part of the RIL stack) to allow RILD and RILJ to exchange communications and data is polling based (it loops even when there is nothing to process).
In summary, I would really like your opinion to clarify the following questions:
1) Is the exchange of data between the baseband processor and the application processor interrupt based or polling based?
In practice, is the application processor polling regularly the port of communication with the baseband to check for the presence of new commands from the baseband, or the application processor is woken up by some sort of interrupt generated by the baseband processor as soon as the baseband has to communicate some new commands?
2) how the vendor reader loop detects the presence of a new unsolicited command? Is the vendor reader loop running even when there are no new commands or it is started only in the presence of a new unsolicited command?
In the case in which the reader loop is started only when a new unsolicited command is detected, what component or process starts this vendor reader loop?
3) is the rild event loop running all the time to check whether some events have been detected by the vendor RIL or it runs only when the vendor RIL adds a new event in the event queue of RILD?
In the case in which the event loop is started only when a new event has been added to the event queue, what component or process starts this event loop?
4) How RILD maintains the communication sockets with the java part of the RIL stack (RILJ)? Are they opened only when there are new data to exchange or they are maintained open all the time?
Thanks I a lot for any information and help you can give me. I really appreciate it.

Need help with raw HID access of Bluetooth device from Android 5.0+

Hi all,
The Scenario
We have a bluetooth hardware device that needs to be accessed from a box (owned by client) running Android 5.1.
Box will run a customized version of Android 5.1.
The device works with vendor specific HID reports.
Changes to ROM to allow device to work are allowable.
Attempt 1:
BluetoothInputDevice + HidService
This is a hidden interface in AOSP that can provide raw hid access to bluetooth hid devices. HidService should throw intents containing received reports, and accepts reports through a "Send report" method.
Unfortunately, it didn't work for me at all. I was unable to receive any HID reports.
Attempt 2:
/dev/hidraw0 + /system/bin/hidrawservice + /system/lib/libhidrawservice.so + external/HidRawAccess/HidRawAccess.java
Here, I thought to create a native executable service hidrawservice called from init.rc with elevated privilege to access /dev/hidraw0
hidrawservice exposes its own interface for /dev/hidraw0 (maybe through a unix socket)
A java + native android service comprising libhidrawservice.so and HidRawAccess.java that exposes direct methods for hidrawservice to android java apps.
The Problems:
for 1, I could never receive any HID reports at all in my app. More details: [I cannot post links here, Sorry. Please search stackoverflow with bluetooth hid host. ]
Specifically, I observe Bluedroid doesn't call any callbacks in jni code of HidService when reports are received.
for 2, I am stuck with SELinux. I can verify that through /dev/hidraw0 the HID reports are accessible. hidrawservice when run from adb shell captures reports. But when I start it from init.rc, Its not able to access /dev/hidraw0
I don't have any prior experience on SELinux policies so if anyone could guide me, would be extremely helpful.
I am seeking community help for either of those. I am also open to any suggestions towards this. I am not seeking to disable SELinux.
If it helps, for now, I am developing with a Nexus 7 2013 tablet, And AOSP is 5.1.1_r14, LMY48G.

Categories

Resources