Distribution Linux : LUbuntu 22.04.5 LTS
Téléphone portable : Motorola G34 5G
Appuyer sur l'icône : Paramètres
Sélectionner le menu : Système
Sélectionner le menu : Options développeur Ce menu apparaît uniquement si le smartphone est en mode "développeur".
Activer l'option : Débogage USB Il se trouve dans le section "Débogage".
https://f-droid.org/fr/packages/com.termux/
Ainsi que "Termux:API" :
https://f-droid.org/fr/packages/com.termux.api/
~ $ pkg install python termux-api
~ $ which termux-sensor
~ $ termux-sensor -l
termux-sensor -s gyroscope -n 3
Le câble doit être un câble de donnée et pas uniquement de charge.
Sur le smartphone, une notification apparaît, l'ouvrir.
sudo apt install adb
util01@station40:~$ adb kill-server
cannot connect to daemon at tcp:5037: Connection refused
util01@station40:~$
util01@station40:~$ adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully
util01@station40:~$
util01@station40:~$ adb devices -l
List of devices attached
ZY32KDR97N device usb:2-1.8 product:fogos_gen model:moto_g34_5G device:fogos transport_id:1
util01@station40:~$
util01@station40:~$ adb shell dumpsys package com.termux | grep -E 'versionName|versionCode|installerPackageName'
versionCode=1002 minSdk=24 targetSdk=28
versionName=0.118.3
installerPackageName=com.google.android.packageinstaller
util01@station40:~$
util01@station40:~$ adb shell
fogos:/ $ pm list packages | grep termux
package:com.termux
package:com.termux.api
fogos:/ $
util01@station40:~$ adb shell am start -n com.termux/.app.TermuxActivity
Starting: Intent { cmp=com.termux/.app.TermuxActivity }
L'application s'ouvre automatiquement sur le smartphone.
~ $ whoami
u0_a467
~ $ sshd
util01@station40:~$ adb devices -l
List of devices attached
ZY32KDR97N device usb:2-1.8 product:fogos_gen model:moto_g34_5G device:fogos transport_id:2
192.168.1.21:5555 device product:fogos_gen model:moto_g34_5G device:fogos transport_id:3
util01@station40:~$
util01@station40:~$ adb -s ZY32KDR97N forward tcp:8022 tcp:8022
util01@station40:~$ ssh -p 8022 u0_a467@127.0.0.1
u0_a467@127.0.0.1's password:
Welcome to Termux!
Docs: https://termux.dev/docs
Donate: https://termux.dev/donate
Community: https://termux.dev/community
Working with packages:
- Search: pkg search <query>
- Install: pkg install <package>
- Upgrade: pkg upgrade
Subscribing to additional repositories:
- Root: pkg install root-repo
- X11: pkg install x11-repo
For fixing any repository issues,
try 'termux-change-repo' command.
Report issues at https://termux.dev/issues
~ $
Depuis le smartphone, lancer la commande et faire bouger le smartphone.
~ $ termux-sensor -s gyroscope -n 3
{
"icm4x6xa Gyroscope Wakeup": {
"values": [
-0.14021532237529755,
0.14727269113063812,
0.1724395453929901
]
}
}
{
"icm4x6xa Gyroscope Wakeup": {
"values": [
0.04740423336625099,
-0.3419496417045593,
0.18429060280323029
]
}
}
{
"icm4x6xa Gyroscope Wakeup": {
"values": [
0.1038632020354271,
0.054328445345163345,
0.02330264262855053
]
}
}
~ $
util01@station40:~$ ssh -p 8022 u0_a467@127.0.0.1 "termux-sensor -s gyroscope -n 10"
u0_a467@127.0.0.1's password:
{
"icm4x6xa Gyroscope Wakeup": {
"values": [
0.8174566626548767,
-1.596430778503418,
0.2420811653137207
]
}
}
{
"icm4x6xa Gyroscope Wakeup": {
"values": [
0.05592634156346321,
-0.02450106292963028,
-0.0037284228019416332
]
}
}
{
"icm4x6xa Gyroscope Wakeup": {
"values": [
-0.043276336044073105,
0.1129179447889328,
0.02024000883102417
]
}
}
util01@station40:~$ ssh-keygen -t ed25519 -C "util01@station40"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/util01/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/util01/.ssh/id_ed25519
Your public key has been saved in /home/util01/.ssh/id_ed25519.pub
...
util01@station40:~$ ssh-copy-id -p 8022 u0_a467@127.0.0.1
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/util01/.ssh/id_ed25519.pub"
...
Now try logging into the machine, with: "ssh -p '8022' 'u0_a467@127.0.0.1'"
and check to make sure that only the key(s) you wanted were added.
util01@station40:~$ ssh -p 8022 u0_a467@127.0.0.1
Welcome to Termux!
...
Report issues at https://termux.dev/issues
~ $
https://github.com/HackTechDev/smartphone_gyro_python/blob/master/gyro.py
https://github.com/HackTechDev/smartphone_gyro_python/blob/master/gyro_gui.py
https://github.com/HackTechDev/smartphone_gyro_python/blob/master/gyro_tk_move.py