User:Wuseman/Android

From Gentoo Wiki
Jump to:navigation Jump to:search
This article is a stub. Please help out by expanding it - how to get started.
Note
Device used in this project: SM-G998B and SM-G988B (S21 5G Ultra, S20 5G Ultra, Samsung)

Android on Gentoo Project

This is a personal project aimed at exploring and achieving the integration of Gentoo Linux with Android devices. From intricate bootloader configurations to advanced communication interfaces like UART and AT commands, this project covers a wide range of technical aspects necessary for running Gentoo on Android hardware. The documentation here is carefully compiled through rigorous testing and exploration.

Bootloader

Information and procedures related to the Android bootloader.

Serial Communication

Details about setting up and using serial communication in Android devices.

UART Interface

Guide and technical details on using the UART interface with Android devices.

AT Command Reference (Hayes Command Set)

This section details the structure of AT (Attention) commands used for communication between a PC and a mobile device. Understanding the command structure is crucial for effective device communication.

Warning
All functionality, descriptions, ideas, drawings, features, specifications, and other information provided in this document are for the lowest level of Android devices and may include details specific to bootloaders. Do not copy and paste commands without understanding; improper use might result in a broken device. Some sections lack public documentation and are discovered through testing. If you have found this page through a search engine, be aware that you are responsible for any actions taken and this page is intended for personal use only.
Note
THIS README AND ANY INFORMATION CONTAINED HEREIN ARE PROVIDED ON AN “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EITHER IMPLIED OR EXPRESS.
Table
AT Command Structure
Direction Command Structure
Tx (PC to Phone) AT+[Command Name]=[Attr],[Para1],[Para2],[Para3],[Data]\r\n
Rx (Phone to PC) +[Command Name]:[Attr],[Data]\r\n\r\nOK\r\n
Error Case +CME Error:[Error String]\r\n\r\nOK\r\n (Error String: NA)

Command Structure

AT commands are used for controlling modems. Below is the structure for transmitting (Tx) and receiving (Rx) AT commands:

  • Tx (PC to Phone): This format is used when sending commands from the PC to the phone. The command starts with AT+, followed by the command name, attributes, and parameters. It ends with a carriage return and a newline character (\r\n).
  • Rx (Phone to PC): This is the format for responses from the phone to the PC. The response includes the command name and data, followed by OK, each part separated by a newline character.
  • Error Case: In case of an error, the phone responds with an error message in the format +CME Error:[Error String]\r\n\r\nOK\r\n. The error string provides details about the nature of the error.

Sending AT Commands Effectively

Before diving into specific AT commands, it's important to understand the correct process for sending these commands to your Android device. The following steps should be followed:

  1. Identify the Correct Serial Interface: Use commands like dmesg | grep tty to find the appropriate interface (e.g., /dev/ttyACM0).
  2. Configure Serial Communication Settings: (Optional) Use stty for setting baud rate and other settings. For example, stty -F /dev/ttyACM0 9600.
  3. Sending the Command: Commands are sent via echo, for example, echo 'AT+COMMAND' > /dev/ttyACM0. Add a carriage return with echo -e 'AT+COMMAND\r' > /dev/ttyACM0 if needed.
  4. Reading the Response: Use cat /dev/ttyACM0 to read responses, or tools like app-misc/screen or net-dialup/minicom for an interactive session.
  5. Check Permissions: Ensure you have the required permissions to access the serial interface (gpasswd -a $LOGNAME input)
  6. Start with Basic Commands: Begin with simple commands like AT to ensure connectivity.
  7. Scripting and Automation: For complex tasks, consider using scripting languages like Python with libraries like dev-python/pyserial.

Device Identification

Note
Must type *#0*# on dialer and enter test mode via UUSD code

Check Basic Information

Command Description
AT+DEVCONINFO Retrieves basic device information including firmware version, phone number, IMEI, ICCID, and more.
Note
Full information is accessible only when the device is unlocked. The error code 'Not Allowed TOK' indicates that the device is locked, either by a SIM PIN or a screen lock. Unlock your device to obtain complete output.