This is extension (or other option) of Gregory Bel's solution (in further text GBS). Please read that document first (it contains much more details than this one). This is are mostly just step-by-step instructions, on how I did it, without "Phone 1" and with VM instead.
- You need to be doing this on Linux (it might also work on Mac (OS X) or any other unix/linux flavour), because we will change Mac address of BT Dongle
- Working BT Dongle (about 75% of them should allow you to change MAC address on them)
- Phone you want to use with your pump, what ever the Android version (in GBS phone 2), in further text phone
- Phone needs to be rooted
- Ruffy needs to be installed
- Developer mode and debug over USB activated
NOTE: While this operations shouldn't do any damage to your phone, please backup it before continuing.
You need to copy/write down Bluetooth MAC of your phone. (Settings/About phone/State/Bluetooth address).
- Download VirtualBox and correct Extensions for it. Add your user to vboxusers group - we will need to see all USB devices from host computer. You will probably need to retart vbox services and machine.
- Download Lineage OS image, you need at least R1 (not RC1, that one doesn't work). You can use this link for Lineage 14.1 R1 or go to Android x86 site and get it from there
- Now create new virtual machine, you can go with defaults (set 2Gb of RAM, everything else by default). Attach the ISO with Lineage and you are ready to go. When first grub menu appears, select Installation. Detailed instructions can be found on youtube see link (You can follow his steps, just use our image and you can ignore the steps with SD Card)
- After install is done, start the VM and wait...wait...wait... First start always takes quite a few minutes (can be up to half hour, depending on speed or your system).
- If you have problem with mouse, disable mouse integration (Input->Mouse integration) and mouse will start working
- You will be shown steps how to connect to your google account, you can skip thoose, unless you want to continue using image later on.
Like I said before, about 75% of Dongles, should allow you to change MAC address (CSR - Cambridge Silicon Radio own 75% of market, so if you have their chipset you are OK, others you will just have to try)
-
Install bluez (if not installed already) and bluez-utils/bluez-tools (if available) (google how to do that for your flavour of OS)
-
Run command bdaddr. If command is found skip to step 4.
-
Download sources for the same version of bluez you have installed (some flavours don't include tools in prepackaged install). Unpack the file and build it. bdaddr will be in tools directory after your build is done (./configure and make)
-
Run hciconfig, it will show you all BT devices you have, the one with highest X (hciX) should be the Dongle.
-
Note your currect MAC address, so that you can change it back later
-
Shutdown your phone (that has the same MAC we are trying to set)
-
Run command to change MAC (use MAC of your phone)
bdaddr -i hci1 AA:BB:CC:DD:EE:FF
You will get message "Address changed - Reset device now" if operation was succesful. Just unplug the BT Dongle and plug it in again. If you run hciconfig again Dongle should have new MAC
-
Leave BT Dongle attached to your computer
-
Start VM with Lineage
-
When system is started, check that your BT is attached (Devices -> USB, should show all USB devices on your system, even integrated ones, if they are not there then either your user is not in vboxusers group or you have some other issue). If you can't get it to work google it, until your BT Dongle is visible you are stuck).
-
Now system is running with BT attached, you can click on Bluetooth in your Android configuration (in VM) it will come up.
-
Download your version of ruffy (you should build from branch combo from Milos Kozak's Repo
- You can either put ruffy.apk somewhere on internet and download it from there (internet in VM should be working Out-of-the-box)
- or you can switch into Terminal mode (Alt+F1 Terminal mode, Alt+F7 GUI Mode) and get it with scp from your host machine.
- when you issue command ifconfig, you will get listing of all your adapters, look at IP of eth0, it should be something like 10.0.2.15. If 10.0.2.15 is your virtual machine, then your host will be 10.0.2.2
- install openssh-server into your host (if you don't have it already), alternativelly you could use any external server (that has ssh installed)
- now just
scp username@10.0.2.2:~/ruffy.apk .
-
Start ruffy and pair your Combo with VM (if you want to have nice name in Pump, configure it in Bluetooth configuration beforehand (Renanme this device))
-
Pairing should be succesful, if not put the pump nearer to BT Dongle (when name is displayed on Pump, don't press button at once, wait about 5 seconds)
-
Now we just have copy the files to somewhere we can use them
a) Switch to Terminal mode (Alt-F1)
b) Copy bluetooth pairing data:
cd /data/misc/bluedroid
scp bt_config.conf username@server:~/some_directory
(username on server, server could be 10.0.2.2 (local one) or some other one, ~/some_directory means this will be put into some_sirectory that resides in home directory of username)
c) Copy ruffy data:
cd /data/data/org.monkey.d.ruffy.ruffy
zip -r ../ruffy_data.zip *
scp ruffy_data.zip username@server:~/some_directory
-
You can shutdown VM (run
halt now
from terminal)
Now we need to get data we gathered to our phone. There are two steps to do:
- add bluetooth pairing data
- copy ruffy configuration data
How to do that is described in Gregory Bel's solution. Look for text "Connect phone 2 to PC" and follow instructions from there.
If you have any questions you can find me arround github or gitter (andyrozman)