Read Battery Percentage of iPhone via WLAN - iphone

I found an app that shows the battery percentage of my iPhone in the menu bar (iBetterCharge). The iPhone is not connected via USB or Bluetooth (it is only connected to the same network as my Macbook).
My question is: How can I get this information? The device shows up in IOReg, but only because I connected my phone via Bluetooth once.

This can be done by using the unix application "libimobiledevice". I'm not sure that it works with all versions of iOS.
//install it:
brew install libimobiledevice
//list all device
idevice_id --list // list available device UDIDs. Normally, we have to plug the device at least once to get its UUID.
//get the current syslog of device that we want to check
idevicesyslog -u <device udid>
//do some text search to get the battery info
//or running ideviceinfo (I don't know if it works wirelessly)
//run 'ideviceinfo --help' to see how it works
ideviceinfo -u <device udid> --domain com.apple.mobile.battery
More read at:
https://www.theiphonewiki.com/wiki/MobileDevice_Library

Related

Problems communicating with MOVESENSE using adb

I have tried to follow the instructions from Movesense on how to do Whiteboard communication using ADB. This does not work as expected.
On a sidenote - I'm just trying to set up a handful of sensors to start some heart rate and movement measurement and store data to the logbook. After 30-40 minutes, I want to stop measurements and fetch the data from each device. My first dream was that I could do this using Whiteboard over BLE (from Matlab, Python, LabVIEW, ...) without having to use ADB or similar solutions. But I guess this was a bit too optimistic.
Setup
Installed the adb tools: OK
Enabled USB debugging on an Android phone: OK
Tested that adb can install apps and handle the phone: OK
Installed sampleapp-debug-1.5.1.apk:
Tried to install using adb: OK
Tried to install by copying the file to the phone and installing it there: OK
I got a message saying that the sample app was not compiled for the current version of Android (I'm using a Samsung S10e running One UI version 4.0 and Android version 12, security fix level 01.02.2022).
Im working on an Intel Mac running Big Sur 11.6.5 with plenty of resources.
What I've tried so far
First of all, I start the app and connect to the MOVESENSE device.
When trying the example commands from Movesense, I get:
Switch on LED:
fjp#fMac-19 sensorsw % adb shell am broadcast -a android.intent.action.MOVESENSE --es type put --es path Component/Led --es value '''{\"isOn\":true}'''
Broadcasting: Intent { act=android.intent.action.MOVESENSE flg=0x400000 (has extras) }
Broadcast completed: result=0
Get Info
Get Info does only work if I place curly braces between the quotas. See results below for both variants.
fjp#fMac-19 sensorsw % adb shell am broadcast -a android.intent.action.MOVESENSE --es type get --es path Info --es value ''''''
Exception occurred while executing 'broadcast':
java.lang.IllegalArgumentException: Argument expected after "value"
at com.android.modules.utils.BasicShellCommandHandler.getNextArgRequired(BasicShellCommandHandler.java:295)
at android.content.Intent.parseCommandArgs(Intent.java:8329)
at com.android.server.am.ActivityManagerShellCommand.makeIntent(ActivityManagerShellCommand.java:367)
at com.android.server.am.ActivityManagerShellCommand.runSendBroadcast(ActivityManagerShellCommand.java:788)
at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:214)
at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
at android.os.ShellCommand.exec(ShellCommand.java:38)
at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:10429)
at android.os.Binder.shellCommand(Binder.java:986)
at android.os.Binder.onTransact(Binder.java:860)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:6049)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3034)
at android.os.Binder.execTransactInternal(Binder.java:1220)
at android.os.Binder.execTransact(Binder.java:1179)
fjp#fMac-19 sensorsw % adb shell am broadcast -a android.intent.action.MOVESENSE --es type get --es path Info --es value '''{}'''
Broadcasting: Intent { act=android.intent.action.MOVESENSE flg=0x400000 (has extras) }
Broadcast completed: result=0
The suspects
Is my problems due to an old version of the Android app? I could not find anything newer than 1.5.1.
I tried to poke around a bit in the phone using adb shell dumpsys activity services | grep android.intent.action, and got a load of results, I then started to look for MOVESENSE as well using adb shell dumpsys activity services | grep MOVESENSE, and got no hits. I'm on thin ice here, but could it be that there should be an android.intent.action.MOVESENSE in there someplace?
After a lot of trial and error, I have finally found a solution.
The solution
I found aBitbucket directory with a lot of precompiled Android apps.
The file Showcaseapp-debug_adb-bridge-build.apk is the one you want. Here is what you do:
Download Showcaseapp-debug_adb-bridge-build.apk, and place it in your directory of choice.
On your Android device, uninstall the Showcase app if you have installed it already.
Install the app using ADB on your computer: adb install Showcaseapp-debug_adb-bridge-build.apk.
Start the app on your Android device and connect to the Movesense device.
Try a command like:
Switch LED on: adb shell am broadcast -a android.intent.action.MOVESENSE --es type put --es path Component/Led --es value '''{\"isOn\":true}'''
Switch LED off: adb shell am broadcast -a android.intent.action.MOVESENSE --es type put --es path Component/Led --es value '''{\"isOn\":false}'''
A final note
In a perfect world, Movesense would make wbcmd capable of using theBLE device built into most/all PCs, be it Windows, Linux, or Mac. Or even perfecter (is that a word?), make a variant that used TCP/IP instead of standard in/out.

How to connect ADB to remote windows server

I work on a remote desktop for development but my android device is connected to my local laptop. I wanted to be able to use ADB device in vscode on the remote desktop and connect to the device attached to my laptop.
Can i know how could I do that?
if they both connected to the same wifi, I think you can run your app using your desktop or laptop. use ADB but first enable ### usb debug ### and ### wireless debug ### second connect your physical phone where you want to connect your physical phone to for example you want to run the app using your laptop connect your phone to the laptop using usb connector, follow the command here https://www.guru99.com/adb-connect.html after that you no longer need to connect the usb wire. hope I helped

Huawei E3331 is not detected as modem (to send sms)

$ lsusb
Bus 001 Device 014: ID 12d1:14fe Huawei Technologies Co., Ltd. Modem (Mass Storage Mode)
$ gammu-detect
; Configuration file generated by gammu-detect.
; Please check The Gammu Manual for more information.
[gammu]
device = /dev/ttyS2
name = Phone on serial port 2
connection = at
The modem is detected as mass storage. I want the modem to be detected as Modem/Networkcard
I have searched and tried and finally this worked for me
Solution 1:
- /etc/mode_switch.config and turn on the following flag:
DisableSwitching=1
Go to following folder and create the 12d1:14fe file
$ cd /etc/usb_modeswitch.d/
$ sudo tar -xzvf /usr/share/usb_modeswitch/configPack.tar.gz 12d1:14fe
Edit 12d1:14fe file and add following lines and save it
DefaultVendor=0x12d1
DefaultProduct=0x14fe
TargetVendor=0x12d1
TargetProduct=0x1506
MessageContent="55534243123456780000000000000011062000000100000000000000000000"
If you remove the USB dongle and reconnect it. You have to run following command to bring it back in modem mode
sudo usb_modeswitch -c /etc/usb_modeswitch.d/12d1\:14fe
To auto detect the USB dongle as modem when it is connected then set following rule
sudo touch /etc/udev/rules.d/huawei_e3331.rules
Then create add following rules to file and save it
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="14fe", RUN+="/usr/sbin/usb_modeswitch -v 0x12d1 -p 0x14fe -V 0x12d1 -P 0x1506 -M '55534243123456780000000000000011062000000100000000000000000000'"
$ gammu-detect > .gammurc
$ sudo gammu-detect > .gammurc
$ gammu identify
Device : /dev/ttyUSB0
Manufacturer : Huawei
Model : unknown (E3331)
Firmware : 21.146.07.01.158
IMEI : 869************
SIM IMSI : 412************
$ echo "test" | sudo gammu sendsms TEXT 070*******
you will receive a test message
First of all, make sure that your mobile card has 3G permission, that is, 186 mobile phone number, and other 2G mobile phone numbers can also have 3G permission;
Anyway, it is the Unicom card of Waupaca brand;
Second, isn't there a PC Suite in the software of connecting the mobile phone to the computer? In the middle of the software installation, you will be asked if you want to install the driver, which must be confirmed. After that, if you uninstall the software, you can version it, but you can't uninstall the driver;
Connect the phone cable to the USB port of the computer. There will be an Android adapter in the computer manager, which means the driver is installed;
When the mobile phone is connected to the computer, it can't turn on the U-disk mode;
Run daily up for Android on the computer... Just click Connect right
It takes a lot of traffic

kernel module insertion issue

We are running the latest raspibian on the raspberry pi board and have a kernel driver for a USB peripheral which is added externally (sudo insmod driverx.ko) after boot-up by connecting to the hardware using ssh (its a headless system).
The problem is as follows:
If the device is already connected to the system upon power-up then running sudo insmod driverx.ko leads to the terminal getting stuck (no response, Ctrl+C doesn't work). Running lsmod by starting another ssh session shows that the module is in use even though there is no code running that will use it.
If I plug the USB device after the system boots up then sudo insmod driverx.ko works normally, (the terminal is still active). Running lsmod subsequently shows that that module is loaded but not in use by anyone. I can then run my user code and everything is fine. Upon running my user code lsmod shows the kernel module is in use and the number of users is 1.
In our system the USB device will always be plugged in. The kernel version and the driver version are the same.
I can fill in more details but do not wish to bias or make this query un-readble.
Please advise on what could the problem be.
Thank you for your time and help.
Possibility is that, the device is already attached into some other driver during startup. If it’s the case, the device credential of your specific device has to be removed from the startup driver.
Check the USB device list before to insert your driver.

Wireshark. How to route traffic from iPhone

I'm trying to capture packets from my iPhone app. It does not use HTTP to communicate, but a custom protocol to connect with my server. I can not use Paros to monitor the packets sent.
Is it possible to proxy the date through wireshark just like you can with Paros for http?
You can't proxy the data through Wireshark, per se; the problem is to have Wireshark running somewhere where it can see the traffic passing by. (If you had command line only, you could run tcpdump and capture packets, and then load the dump file into Wireshark somewhere else that had a UI.)
Are you on a Mac? If so, plug your mac into ethernet so that it has an internet connection (or connection to your server, anyway). Then share your Mac's internet connection over its wifi. Connect to this wifi point using your iPhone. Run Wireshark on the Mac (promiscuous mode enabled), then use your iPhone app and watch Wireshark. No need to mess around with servers or forwarding X11 connections! You could do something very similar with a Windows PC too.
The best solution that works:
Connect your device thru USB and type these commands:
rvictl -s UDID (UDID = id of device, 32 chars, you can locate it in iTunes or 'Devices & Simulators' in Xcode)
sudo launchctl list com.apple.rpmuxd
sudo tcpdump -n -t -i rvi0 -q tcp
OR just sudo tcpdump -i rvi0 -n
If rvictl is not working install Xcode (or see -bash : rvictl: command not found, Mac book pro OS X 10.7.5 & Xcode 4.6)
For more info:
Remote Virtual Interface
http://useyourloaf.com/blog/2012/02/07/remote-packet-capture-for-ios-devices.html
Run wireshark on the server - you'll see the traffic there.