Many happy owners of Android smartphones do not even suspect that their high-tech devices can be used as full replacement standard USB modem, external Wi-Fi adapter for a computer, as well as a Wi-Fi router. As a rule, smartphone buyers only use 3G or 4G Internet on the phone itself, completely in vain missing out on a great opportunity to enjoy all the benefits of high-speed broadband mobile access to the global web, for example, on a laptop.

In order not to miss the opportunity to use 100% free mobile Internet traffic, which is provided as a gift in most salons cellular communication To all buyers of more or less expensive gadgets, let's look at all the ways to connect an Android smartphone to a computer, both via USB data cable, or without it.

How to connect a smartphone running Android OS as a Wi-Fi router

Perhaps the most interesting use of a smartphone is its portable Wi-Fi hotspot access, which realizes the possibility wireless connection other smartphones, tablets, laptops, as well as desktop computers for sharing mobile Internet. To enable the wireless router mode, you must do the following:

  1. go to the network connections settings, and also turn the Wi-Fi toggle switch to the “on” position;
  2. Find the “Data Usage” item and activate “Mobile Data”. To make everything work, we simply set the icon in the form of a green checkmark in the advice window;
  3. go back one step to select "Other Networks". Then you need to find the line “Modem and mobile access point” and turn the switch icon to the “on” position. You can then configure the SSID, encryption type, and Wi-Fi password.

How to connect a smartphone to a computer as a 3G (4G) modem

As a rule, any smartphone comes with Charger, which represents the charging itself and the data cable. It is this cable that we will need to use this Android smartphone as a USB modem. The use of any non-original USB - micro USB cables made in China is not recommended, as it is possible unstable work. Therefore, we find the original charger, disconnect the data cable from it and connect the USB to the computer, and the micro USB to the smartphone. After the smartphone is detected Windows system, you need to make a rather trivial setup. So, in Android 6, to do this, in the “Wireless Networks” menu, select “Modem Mode” and turn on the “USB modem” function.

How to connect a smartphone as a Wi-Fi adapter

Using a smartphone's Wi-Fi adapter, as well as using the built-in module usb modem, allows the end user to fully appreciate all the wired and wireless communication functions of an Android device. It is especially interesting to use an Android smartphone in Wi-Fi quality-adapter on a desktop computer, as this will allow you to connect the computer not only to the mobile Internet, but to a full Wi-Fi router with ADSL modem. This kind of idea can be implemented extremely simply. We connect the smartphone to the computer with a data cable and configure the phone.

Algorithm for setting up a Wi-Fi adapter (using the example of Samsung Galaxy S4 mini)

  1. Switch the Wi-Fi switch to the on position.
  2. Connect to your Wi-Fi router.
  3. Go to "Data Usage" and turn off "Mobile Data" by unchecking the green checkmark.
  4. Let's go back to the settings.
  5. Select the item “Other networks”.
  6. Find the line “USB modem” and check the box.

In fact, everything is simple. The main thing is that you do not forget to turn off Mobile Data.

Need to connect your computer to the Internet, but don't have a twisted pair cable or modem nearby? Or to connect a laptop, but the password has been entered on the smartphone? Let me show you how to use it Android phone as a WiFi adapter and feed the Internet through it.

This article is suitable for all brands that produce phones on Android 9/8/7/6: Samsung, HTC, Lenovo, LG, Sony, ZTE, Huawei, Meizu, Fly, Alcatel, Xiaomi, Nokia and others. We are not responsible for your actions.

Features of Android phone operation in Wi-Fi adapter mode

Quite often, users are interested in the question of whether it is possible to use a phone running on the Android operating system as a Wi-Fi adapter for a personal computer. This implies that the smartphone must be connected to Wi-Fi networks, and in modem mode the Internet is transmitted via the USB interface to a desktop computer.

At the same time, the personal computer does not have a Wi-Fi adapter, so connect directly to wireless networks no possibility. This connection can be made.

Modem mode has appeared on the Android operating system since the second version. Almost all tablets and phones on this operating system are capable of distributing the Internet to other devices via a USB cable, Bluetooth and Wi-Fi.

Android devices can share not only mobile Internet (4G, 3G, EDGE), but also Wi-Fi. This means that you can turn your smartphone into a real Wi-Fi adapter for a personal computer.

Increase

This function very useful. Situations are quite common when, after installing a router or purchasing a personal computer, there is no way to connect to the computer network cable.

Using this function, it becomes possible to connect it to the Internet. Albeit temporarily, but before acquisition regular adapter Wi-Fi you will have access to global network.

All settings of our instructions were carried out and tested for Samsung smartphone Galaxy J5. On other phones and tablets with a different version of the Android system, the settings may be slightly different. This is not critical in this situation; even novice users will be able to understand the essence of the settings. If you have questions or can’t complete all the settings, you can ask in the comments.

It’s also worth adding that connecting to a Wi-Fi network via a smartphone is very fast and stable. On a computer, the Internet simply flies. On many phones, manufacturers install excellent wireless modules.

Connecting a computer to a Wi-Fi network via an Android device as an adapter

First you need to disable on your smartphone Mobile Internet. Then we simply disable the data transfer function using cellular network. This is done just in case to know for sure that a Wi-Fi connection is being used.

We carry out next steps:

  • Connect your phone to the Wi-Fi network.
  • Increase
  • With help USB cable connect the gadget to the computer. It will not only function as an adapter, but will also be able to charge.

  • Increase
  • On your smartphone, you need to go to “Settings”, where we select “Connections”. Then you need to go to the “Access point and modem” menu. In this menu we activate the “USB modem” function. This is necessary for public access for an established Internet connection on the phone.

  • Increase
  • On personal computer You will immediately be able to access the Internet using your Android smartphone.

Increase

Another one will be displayed in the system network adapter. In our case, this is Ethernet 4. On other computers, the network adapter may be different, but this is not an important point.

Our goal was to connect a Wi-Fi adapter to a smartphone based on Android OS. To achieve it, it is necessary to solve two problems. First, assemble the driver modules for the corresponding Wi-Fi adapter. Secondly, connect the assembled modules to the kernel operating system.

The work was carried out on the following equipment:

  • Personal computer with Ubuntu 14.04 OS
  • Huawei smartphone Ascend Mate 7 Premium with Android 4.4.2 OS (with root rights and installed programs BusyBox and Linux Deploy)
  • Adapter Wi-Fi TP-Link TLWN-7200ND based on Ralink RT3070 chip

1 Preparing for assembly

Before proceeding directly to assembling the modules, it is necessary to properly prepare the system. The PC on which we will assemble the modules runs on a processor with x86 architecture, while the smartphone has an ARM architecture processor. Therefore, to compile modules, you need to install a special set of packages and programs.

$ sudo apt-get install gcc-arm-linux-androideabi binutils ncurses-devel

Next you need to download the source codes of the operating system Android systems installed on Huawei smartphone. this can be done in two ways. Source codes can be downloaded from the official Huawei website. To do this, follow the link and find the appropriate device in the Downloads section. The second way is to download source codes from a repository on github. It is recommended to use the second method, because... source codes posted on the official website may become unavailable after some time.

To download source codes from the github repository, enter the command:

$ git clone https://github.com/gabry3795/android_kernel_huawei_mt7_l09

Once the download is complete, you can find the source codes in the android_kernel_huawei_mt7_109 directory located in the user's home directory.

Before compiling modules, you also need to specify the architecture of the target processor and the path to the compiler files:

$ export ARCH=arm $ export CROSS_COMPILE=/usr/bin/arm-linux-androideabi-

It should be noted that the set variables will be reset after a reboot, so they will need to be set again. In order to check environment variables In the system you need to enter the command:

$export

2 Assembly of modules

Next you need to set the kernel configuration. This can be done manually, but the source codes already have ready-made configurations for various processors. In order to see the entire list of configurations you need to go to the directory with source codes(further all actions will be performed in it) and enter the command

$ make help

The result will display various information about compilation settings and various configurations. An example of such output can be seen in the following figure

The Huawei Ascend Mate 7 Premium smartphone has processor KIRIN 925 (HiSi 3830). This particular processor model is not in the list that appears, but the merge_hisi3630_defconfig configuration is suitable. This configuration is loaded with the command

$ make merge_hisi3630_defconfig

We determine the full name of the OS kernel version installed on the smartphone. For the Huawei Ascend Mate 7 Premium smartphone (Android 4.4.2), kernel version 3.10.30-00001-g57d8d0a-dirty. The kernel being assembled must have the same version, otherwise the modules will not be connected. Let's open the Makefile configuration file in some text editor and we find the following lines there

VERSION = 3 PATCHLEVEL = 10 SUBLEVEL = 30 EXTRAVERSION =

We see that the version of the loaded kernel is the same up to EXTRAVERSION. In order for the versions to completely match, add -00001-g57d8d0a-dirty to this line.

EXTRAVERSION = -00001-g57d8d0a-dirty

You also need to set the CFLAGS_MODULE flag to -fno-pic.

CFLAGS_MODULE = -fno-pic

To select those modules that will be compiled, it is convenient to use graphical interface menuconfig. To do this, enter the command:

$ make menuconfig

The following figure shows the menuconfig program window.

For the TLWN-7200ND adapter on the Ralink RT3070 chip, you must connect the following modules.

Networking Support --> Wireless --> Generic IEEE Networking Stack (mac80211)

The letter M means that the driver will be built as a separate module.

Device Drivers --> Network Device Support --> Wireless LAN

Set the Ralink Drivers Support option to M and then move on

Ralink Drivers Support -->

Set the options as shown in the following figure.

It is recommended to remove flags from modules in menuconfig that do not require drivers to be connected. This will speed up compilation time, because extra modules will not be collected. After the above operations, you can exit the graphical shell before saving the changes. The assembly of modules is started with the command

$ make modules

After some time, if there are no errors, the compilation will complete successfully. Paths to compiled modules:

Net/wireless/mac80211/mac80211.ko drivers/net/wireless/rt2x00/rt2x00lib.ko drivers/net/wireless/rt2x00/rt2x00usb.ko drivers/net/wireless/rt2x00/rt2800lib.ko drivers/net/wireless/rt2x00/ rt2800usb.ko

You can check information about compiled modules with the following command

$ modinfo rt2x00usb.ko

The following image shows the output of this command

You should pay attention to the vermagic line, which shows for which kernel version the module is built. It must completely match the OS kernel version of the smartphone. You should also pay attention to the depends line, which indicates the module dependencies, i.e. other modules that must first be loaded into the kernel for the module to work correctly.

For proper operation This module requires the firmware file rt2870.bin. You can download it from the official Ralink website.

Let's copy the assembled modules to internal memory smartphone. On the Huawei Ascend Mate 7 Premium smartphone, copy the modules to the directory

/system/lib/modules

On other smartphones, such a directory may not exist, so the modules can be copied to another directory or, which is more preferable, create the above directory and transfer the module files to it.

The firmware file rt2870.bin must be copied to the directory with the firmware. On a Huawei smartphone

/system/vendor/firmware

After we have copied the modules and firmware, we launch any terminal emulator application on the smartphone. Commands are entered into the terminal window (explanations for the commands are given in parentheses; you do not need to enter them).

$ su (enter superuser mode) # cd /system/lib/modules (go to the directory with modules) # chmod 644 MODULE_NAME (change rights to a module) # insmod MODULE_NAME (load a module into the OS kernel)

Instead of MODULE_NAME we substitute the name of a specific module. For a Wi-Fi adapter running on the Ralink RT3070 chip, the modules must be loaded in the following order:

1. mac80211.ko 2. rt2x00lib.ko 3. rt2x00usb.ko 4. rt2800lib.ko 5. rt2800usb.ko

An archive of all these modules can be downloaded

You can check the list of modules connected to the kernel with the command

This method of loading modules is not very convenient, because... After rebooting the smartphone, you need to reconnect them to the kernel. To automate this process, you can create an executable script and use standard applications from the app store Google Play. For example, the Universal init.d application allows you to create executable scripts and place them in startup. Another application that can be used for automatic download modules is Tasker. It allows you to execute any commands in response to any event.

Not all smartphones support autoloading scripts from init.d. In particular, Huawei Ascend Mate 7 Premium does not have this feature. When you launch the application, you can run a test to determine whether your smartphone supports this option.

If your smartphone allows loading scripts from init.d, then you can do the following. On a PC we will create a script with the following content

#!/system/bin/sh insmod /system/lib/modules/mac80211.ko insmod /system/lib/modules/rt2x00lib.ko insmod /system/lib/modules/rt2x00usb.ko insmod /system/lib/modules/rt2800lib .ko insmod /system/lib/modules/rt2800usb.ko

Copy the script to the directory

/system/etc/init.d/

After this, we reassign the rights to the file

$ su # chmod 755 /system/etc/init.d/script.sh

where script.sh is the name of the script.

The following figure shows the interface of the init.d program

If your smartphone does not support autoloading scripts from init.d, you can use the Tasker application.

Launch Tasker and create a new task

In our case, we will launch the script automatically when connecting any USB device, which naturally includes a Wi-Fi adapter. Select the menu items “Status” --> “Hardware” --> “Connected via USB.”

Select the Any class

We save the task under some name. Now we need to add an action to the task.

4 Installing Kali Linux on a smartphone

To be able to use Kali Linux on an Android phone, you will need the Linux Deploy program. It can be downloaded from the store Google applications Play. To install Kali Linux, you need to set the following settings in Linux Deploy.

You can also set your own username and password instead of the default values.

After completing the settings, you need to click “install” in top menu and wait for the installation to complete. To start Kali Linux, you need to click the “Start” button on the bottom panel.

To connect to a running OS, you can use VNC (to log into the graphical shell) or SSH (to log into the console) clients. As a VNC client, we recommend using the VNC Viewer program, which can be installed from Google Play. To connect via SSH, we recommend the JuiceSSH program.

You need to create a new connection in VNC Viewer. The IP address of the host must be the IP address indicated in the top panel Linux programs Deploy. During the connection process, you will need to specify the previously specified password.