Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HUAWEI-HW

Lightweight • Modular • Works everywhere !

Huawei-HW is a C library that makes displaying content (and getting user input) to huawei's series of screen equipped modems much more easier !

Features

  • Color display unlocked on most displays
  • 128x128 resolution supported (Probably 128x64 too, see src/huawei_fb.h :7)
  • Button input handling
  • Draw shapes (rectangles & lines)
  • Text handling (Scale, uppercase/lowercase, symbols)

Contents

Quick start

First of all, access a root telnet shell on your router.

This can be done by simply flashing an unlocked firmware & webui (Simply search on 4pda.to). The credentials are usually root user and admin pass.

If the device you want to develop is an E5577-321s, then you can start developing, otherwise, let's simply verify that the device is compatible with this library.

You'd want to compile & upload the test program. To achieve this, you'll have to install an android NDK.I use android-ndk-r25c avaibable here, just unzip this to a safe directory, and look for a clang toolchain that'll compile to your device's architecture, it will probably be and ARMV7A, and the compiler will be under {NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang.

When the download, extraction and clang identification is finished, we are going to compile the test program:

Clone the repository (git clone https://github.com/FrenchPythonLover/huawei-hw), then edit the src/scripts/compiletest.sh with the correct and ABSOLUTE (must start with /, no ./) path to your clang.

When that's done, we'll launch a terminal into {REPO_FOLDER}/src folder, and run the compilation script (./scripts/compiletest.sh), then transfer & execute the file (make sure to run killall oled before running). If everything works, it means your device is supported !

If it doesn't, start an issue with your device details, and i'll make my best to help you !

Coding with this lib

In this section, I'll give you some basics of this lib.

Setup environment

  1. Create a new folder anywhere on your computer, this will be your project folder.
  2. Inside your project folder, copy the entire huawei-hw files onto your project folder.
  3. Create your own main file (e.g., main.c) in the root of your project folder.

Your project structure should look like this:

your-project/
├── main.c
└── huawei-hw/
    ├── huawei_fb.c
    ├── huawei_fb.h
    ├── huawei_keypad.c
    └── huawei_keypad.h

Importing the library

To use the screen and button modules in your code, simply import them like this at the top of your main.c:

#include "huawei-hw/huawei_fb.h"
#include "huawei-hw/huawei_keypad.h"

Compiling your project

To compile your custom program, you must use the Android NDK compiler (clang) you set up during the Quick Start section.

Run the following command from your project root (make sure to replace {CLANG_PATH} with the absolute path to your NDK compiler):

{CLANG_PATH} -I. main.c huawei-hw/huawei_fb.c huawei-hw/huawei_keypad.c -o my_app

Then, transfer over the file to your router then run it, while making sure to execute once the command killall oled before running your files!

Note: Complete documentation and detailed explanations for every function, macro, and variable can be found directly inside the header files (huawei_fb.h and huawei_keypad.h).

Setup environment

Create a new folder anywhere in your computer, it will be your project folder

Transferring programs to your huawei

There are 2 main ways to transfer a program from the computer to the huawei, using either adb or netcat.

Using netcat

On the router, type in this command busybox nc -l -p 1234 > {path/to/save/file}
And on the computer, type this nc {ROUTER_IP} 1234 < {FILENAME}

Using ADB

Warning: This method may render you router considerably slower. You may reboot and stick with netcat if it become slower
On the router, type the following: setprop service.adb.tcp.port 5555 && adbd &
On the computer side run: adb connect {ROUTERIP}:5555.
You may now transfer files using adb push {SOURCE} {DESTINATION}, but also use adb shell, adb reboot...

Note: the router's IP is usually 192.168.8.1/192.168.1.1

Roadmap

  • OLED Color Support
  • Shapes drawing
  • Text printing
  • Buttons support
  • Easy to use menu system
  • Make it compatible with with 128x64 displays

Contribute

To contribute, please take a look here.

Stats


Made with ❤️ by FrenchPythonLover

About

A C library to manipulate huawei Exxxx modem's OLED display & buttons.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages