How to analyze btsnoop_hci.log (bluetooth/android/wireshark) - android

I am using an android app (Feiyu ON) to controll a camera gimbal (Feiyu MG lite) manualy over bluetooth (virtual joystick for rotate right/left/up/down).
However, I would like to rotate only one step every 10 seconds for example (To do some epic timelapse!).
I thought about getting the commands that are used for rotation and build an Android app by myself.
First try was to setup another bluetooth device with an terminal, name it like the gimbal and log all commands. But the Feiyu ON-app did not like to connect to my device.
Second hope was to log all Bluetooth communications on my phone (SGS7) and analyze the btsnoop_hci.log with wireshark. Thats were you could help. I do not understand all those handshakes and commonication packages, could someone have a quick look and tell me what i am looking for?
Steps i logged:
- connect to device,rotate left with virtual joystick, wait, rotate again
Also, do you have another idea how to realize my dream?
Thanks a lot, even if you only read through all of my bad explanations :)
My btsnoop_hci.log:
https://www.dropbox.com/s/4jzi2i76t6b5m2j/btsnoop_hci.log?dl=0

It uses bluetooth LE. I think it will be better to look into Feiyu ON app first. Fresh versions are obfuscated by LLVM, but it is possible to find an older version on some alternative app stores (it looks like at least version 2.0.6 is not obfuscated).
Upd: oh, it obfuscated also, but only partially and not by such sofisticated tool.

Related

How to make Pepper QiSDK robot full reboot with sensor check?

Greeting QiSDK Pepper robot community !
We know that there is an option to make Pepper QiSDK Android to reboot with full sensor check (long reboot), but we have forgotten how to make that happen and can't find instructions.
Please help :)
The Qi SDK relies on the Android SDK, and the latter does not provide a programmatic way to reboot the device. So the short answer is that you cannot.
But with a bit of creativity and a bunch of know-how, who knows...
Though it is not documented, the API for NAO 2.8 usually works for Pepper 2.9. So you can use libqi to connect, authenticate, and call ALSystem.reboot. Note that you will be able to authenticate only if you know the password of the robot, i.e. if you own the robot.
I had other bad ideas to reboot the tablet, but as discussed in the comments, this is not relevant since you want to reboot the robot and have it do the full check-up. I keep them here for the record:
I found this page about "Device Control" that mentions rebooting a device remotely. But it comes as part of a broader framework that seems deprecated, so I doubt it works.
You could have access to the tablet via WiFi and run adb reboot remotely. But leaving the remote debugging enabled is not a good idea in terms of security.
You can certainly access such system-level methods if you root the tablet. But this is a staggering security hazard.

Android as an UVC Camera

I'm stuck at home with a rather bad webcam. I was considering upgrading, but then it struck me: phones these days have really good cameras embedded in them. So why not use it as a webcam?
However, as I was researching this further I was really disappointed with the available apps for this. As far as I was able to find, we have Android apps that work roughly as follows:
Present phone camera as a network attached camera. Then you can use local software to use that feed as a webcam. See e.g., IP Webcam. This may be sufficient, but it's a complicated setup, and network latency makes this far from ideal.
The Android app sends the camera feed to an custom host application that in turn creates a virtual web camera. See e.g., DroidCam. This mostly solves the latency problem, but it is still rather complicated, and requiring us to install a specific third party application is troublesome in regard to user privacy. Especially since the applications are closed source.
So, I took the engineering approach and tried to see if it was even possible to improve the situation. As far as I was able to find, Android supports being used as a custom USB accessory. And looking over the USB video class documentation, it strikes me that it should be possible to create an Android app that presents the phone as a generic UVC webcam, such that we do not have to resort to tricks such as the ones above.
Ideally, I would have liked Android to add another USB device option ("Use USB connection as webcam") in addition to debug mode, file-transfer, etc. This seems quite unlikely to happen in the short term however.
So, my question is this: Does an application that does the above already exist? My searching thus far haven't yielded any results, but I might be missing something as googling for this turned out a bit harder than I expected.
Alternatively, am I wrong in my assumption above, such that there is some fundamental issue why an Android application cannot be made to work in that way?
There does not seem to be any complete app yet as of 2020-10, but the parts are mostly there:
https://github.com/tejado/android-usb-gadget has code to switch the Android device into gadget mode (but no UVC yet)
https://git.ideasonboard.org/uvc-gadget.git feeds v4l2 into the uvc gadget output
Sources:
http://www.davidhunt.ie/raspberry-pi-zero-with-pi-camera-as-usb-webcam/
https://www.raspberrypi.org/forums/viewtopic.php?t=148361
https://www.reddit.com/r/androiddev/comments/iabc2o/can_i_use_my_android_as_wired_camera_ie_as_a/g1nrijl/
It appears Google has started to take notice on this issue and are currently working on a "DeviceAsWebcam" service, which is exactly the solution to this problem, as seen in the Android review below:
https://android-review.googlesource.com/c/platform/system/sepolicy/+/2410788
Naturally though, this is a Android 14 feature, so it will like take a while before this is usable on a lot of devices. Hopefully, someone is able to backport this feature to older versions of Android.
If android / the version of Android that comes on your target phone provides / permits use of the USB gadget driver, then libguvc,
https://developer.ridgerun.com/wiki/index.php?title=USB_Video_Class_Gadget_Library_-_libguvc
can be used to "make an application appear as a USB webcam".
Potentially relevant to get you started would be https://stackoverflow.com/search?q=Android+USB+gadget (other SO references to the use of the USB gadget driver on Android).

Modify and boot linux kernel on mobile device

During my education I have been developing Android iOS apps and websites for almost 18 months. Now, as my final year project, I am working on Linux source code with the goal to boot it on a mobile device – like Android. I have it successfully as a Debian package following tutorials on the Internet. I am currently using Ubuntu.
I have a strategy but not sure if I am on the right track. It is as follows:
A:
Download Linux source code. Remove extra drivers, compile and
install it on currently running Ubuntu and use it.
Customize the code further and boot it as my own distribution. For
that I'm following LFS.
Specify a particular target mobile, modify the code for it, write
drivers if I need any, not sure which one (that's why I'm here :) ),
and boot the kernel on it.
I do not know whether my strategy is right or not. I'll really appreciate if someone can tell me:
B:
Am I on the right track? If not, what might be the right one?
Do I need to specify a mobile and customize the kernel code for that
one?
Other than drivers, what else do I need to change in the kernel?
Last but not the least when I boot the kernel on a mobile device; am I going to have any
interface or terminal there?
Sorry if my question doesn't make sense. I am a student and still trying to figure things out. I would be very thankful if someone could give me hints on what subjects to search for on the Internet.
Update: What I want is to confirm whether my strategy is correct or not. If not, then please just name the steps I should follow.
It is not unusual that the drivers for the SoC and devices around it are closed source.
As far as I know, the drivers for the Exynos SoC (the stuff Samsung uses in many of their devices) is (partly) closed source.
So generally speaking you have to write drivers for everything and everyone.
Especially the actual radio connection is tricky as there are no devices which need proprietary
firmware blobs (although the rest of the drivers may be open source).
Another problem is the boot loader on many devices, which does not easily let you install
custom kernels (hash sum stored in the boot loader, unwilling to boot if kernel hash does not
match).
So, assuming you are developing for a device that is already supported by android, I personally
would start with the corresponding device tree for your device and start modifying that.
You can a lot of device trees on CyanogenMod's github page.
Benefits:
You can start off with a working state
If something breaks you know it was you
Alternatively, you can peek at other projects like Ubuntu Touch.
They are able to utilize existing android kernels by using Hybris.
If you want to have a distribution based on Debian/Ubuntu I would recommend
trying Ubuntu Touch and modifying that.

How do you develop Android apps with Bluetooth?

How do you effectively develop, debug, and test an android app that is based on Bluetooth.
I have been googling and searing stack overflow for the answer to this question and I am not getting a clear answer.
I understand that the emulators do not support Bluetooth. I also know of various guides explaining the functions, classes, and such, and I know people have mentioned that setting up a Bluetooth emulator is possible with Virtualbox. I even came across some old projects like BT-Sim that seemed like a way to create fake BT signals (though if my android emulator doesn't support BT, it doesn't help too much)
But no solid guide on how to get this going. It just likes a few scattered puzzle peaces that need to be stitched together. It makes me wonder how app developers reliably make BT enabled apps?
Are there any guides that dissect how to do this process? I imagine the steps to accomplish are:
Create a custom emulator on Virtualbox that can simulate Bluetooth?
Get the AVD Manager to talk to this emulator so my compiled Android code will work with it
Run a Bluetooth simulator to send BT signals over a port in your computer
(I don't really know how to do either of those 3 though!)
My overall goal is as follows:
Create an app that will collect data from a Bluetooth transmitter
But first, create a simulator on my computer that can talk to my android emulator as if it were the real thing
I'll be honest, I do find it odd that the Google folks don't allow Bluetooth emulation on their AVD. I understand not allowing real telephone calls, but I don't see how Bluetooth can be abused like that.
Anyway, any help in setting up Bluetooth would be greatly appreciated and hopefully help many others out there!
NOTE: I am using the standard Eclipse + Android SDK setup with AVD to do my Android development. Planning to use API 10. However, if I need to use a different set up, I am fine. As long as it comes with a step by step guide! That would be very nice.
Old question, but it's still unanswered. If you have a physical device, that seems easiest way to go. If, like me, you don't have a device it's still possible to develop with bluetooth and android.
Download an android x86 iso, load it into virtualbox with bridged network setting and install it.
Plug in your bluetooth dongle and select the device from the 'usb' menu, alternatively you can set a device filter in the vm's settings page.
Now just use adb and connect to it, you can find the ip by going to console (alt+f1) and typing netcfg or ifconfig eth0. You may also need to type adbd on the android console - I do, but I don't see many people mention it so seems it's not always needed.
It still works with eclipse, and is much faster than the emulator. Even when I'm not doing bluetooth dev I use the vm rather than the emulator.

Analog video capture to Android phone

I am looking for a way of displaying an analog video stream on an android phone. On a pc/mac/etc you can achieve this using a cheap usb analog-digital converter such as a grabby: http://www.terratec.net/en/products/Grabby_82248.html, and then view on VLC, for example.
Would such a thing work (in theory) on android if the proper drivers were available? (ie. are there any hardware issues which make this impossible?)
Does anyone know if such a device with android drivers is available?
Ultimately I want to make an app which interfaces with the grabby (or similar device) and allows the user to view video on the android and capture and send short clips.
First of all the Android device needs to support USB Host. This limits your userbase significantly.
Then there is the problem with power. Some USB Host devices will be incompatible simply because an Android phone will not be able to push enough power through to port to get it running properly.
I'm not sure about the drivers, but I'm 99% sure it won't work "out of the box".
You should certainly take a look at THIS project. It is pretty similar to what you are trying to do. Maybe you should consider getting in touch with that person.
EDIT:
Based on what it took to get that DVB-T dongle running in the project i mentioned above the chances of creating an app that everyone will be able to simply download and use are EXTREMELY slim. Getting that dongle running required using a modified kernel and special scripts. Of course I could be wrong. You can continue the research yourself or wait for someone with more experience than me to reply.

Categories

Resources