FORUMS
Remove All Ads from XDA

[FiX] Bluetooth turning off with MortScript

1,011 posts
Thanks Meter: 1,078
 
Post Reply Email Thread
Hey guys,

Quote:

* UPDATE * - I now realize that the first version of this script did not work. Problem should be solved as I've updated it to use VJVolubilis to send the Bluetooth ON command, rather than change the one registry entry.

I write this as a newbie who's just written his, well, 2nd MortScript. I was fed up with the very common problem that everyone is experiencing, which is their Bluetooth being randomly shut off on the X1.

What I did to resolve the problem (temporarily, until SE provides a proper fix), is to write this MortScript that will run resident in memory (uses only about 90kb, a non-issue with our massive X1 RAM) and poll the status of Bluetooth every "X" (user-defined) minutes. It will then send a command to VJVolubilis turning BT on. If it's already on still, then nothing happens. Note that when it 'turns on' Bluetooth, it will put it into the normal status of Connectible, but not Discoverable, or any other state for that matter. It should only really be reset to "On (Connectible)" from Off because if you were currently using your BT (for ActiveSync, A2DP) then it should not turn itself off in the first place. I think this was the safest bet since there are MANY 'states' for BT to be in.

You will need a copy of MortScript installed in order for this script to work. You can get MortScript at the following link:
http://sto-helit.de/index.php?module...am&action=list

Once you've installed MortScript (or if you already had it installed), simply place the "X1FixBluetoothPower.mscr" file in your \Windows\StartUp folder so it will be run upon every boot up, and stay running.

For people who prefer to look at the script contents, then create their own, below is what's contained within my "X1FixBluetoothPower.mscr" file:

Code:
# Xperia X1 Bluetooth Always ON Script
#
# NOTE that you will NEED a copy of VJVolubilis which is a tiny .exe and can be found here by the great Vijay555:

# http://www.vijay555.com/vj/releases/vjvolubilis/vjvolubilis.cab

#Define the interval (in minutes) that BT State will be checked

#Edit "checkmins" number below:
checkmins = 5

#Begin an endless loop that checks vijay555's app every X mins
While( ProcExists( "device.exe") )

Run("\program files\vijay555\vjvolubilis\vjvolubilis.exe"," -blueon")
Sleep(checkmins*60000)
EndWhile
Note that I use a default time of 5 minutes, however on my own device I actually use 1 minute. I have a hard time believing that this will be any sort of 'performance' limiter when it's run, so every 1-2 mins shouldn't be a problem. If you want to edit the minutes, simply open the .mscr file up in Notepad before you dump it on your device (or alternatively, edit it on your X1 with something like Total Commander).

Anyways, this is one of my first scripts written in MortScript, so I hope you guys enjoy it. If anyone else can suggest any optimizations to my 'code', then by all means, please post in this thread.

Below you should find the attachment to the actual .mscr file. Please leave your feedback as to how well the script works for you.

Thanks guys, trying to give back to this amazing community whenever I can!
Attached Files
File Type: zip X1FixBluetoothFinal-MSCR-v2.zip - [Click for QR Code] (529 Bytes, 1668 views)
 
 
21st November 2008, 11:08 AM |#2  
Senior Member
Thanks Meter: 11
 
More
Well done. Mortscript is the future!
21st November 2008, 11:32 AM |#3  
Member
Flag Frankfurt
Thanks Meter: 3
 
More
is it possible to add an entry in your skrip, that a stereoheadset connected in the A2DP mode automaticly?
21st November 2008, 12:06 PM |#4  
Senior Member
Flag Rotterdam
Thanks Meter: 7
 
More
Download A2DP Toggle: http://www.teksoftco.com/index.php?section=freeware
Install and disable the Today-plugin.

Then add a line to the mortscript:
Code:
Run( "\Program Files\Teksoft\A2DPToggle\a2dp.exe", "-a2dp:on" )
22nd November 2008, 01:10 AM |#5  
chongbh's Avatar
Senior Member
Flag Singpapore
Thanks Meter: 14
 
More
Quote:
Originally Posted by scar45

Hey guys,

I write this as a newbie who's just written his, well, 2nd MortScript. I was fed up with the very common problem that everyone is experiencing, which is their Bluetooth being randomly shut off on the X1.

What I did to resolve the problem (temporarily, until SE provides a proper fix), is to write this MortScript that will run resident in memory (uses only about 90kb, a non-issue with our massive X1 RAM) and poll the status of Bluetooth every "X" (user-defined) minutes. If it discovers that BT is off, it will turn it on. If it's already on, then nothing happens. Note that when it 'turns on' Bluetooth, it will put it into the normal status of Connectible, but not Discoverable, or any other state for that matter. It should only really be reset to "On (Connectible)" from Off because if you were currently using your BT (for ActiveSync, A2DP) then it should not turn itself off in the first place. I think this was the safest bet since there are MANY 'states' for BT to be in.

You will need a copy of MortScript installed in order for this script to work. You can get MortScript at the following link:
http://sto-helit.de/index.php?module...am&action=list

Once you've installed MortScript (or if you already had it installed), simply place the "X1FixBluetoothPower.mscr" file in your \Windows\StartUp folder so it will be run upon every boot up, and stay running.

For people who prefer to look at the script contents, then create their own, below is what's contained within my "X1FixBluetoothPower.mscr" file:

Code:
# Xperia X1 Bluetooth Always ON Script
# by George Merlocco of protogenlabs.com

#Define the interval (in minutes) that BT State will be checked
#Edit "checkmins" number below:
checkmins = 5

#Begin an endless loop that queries the BT registry entry every X mins
While( ProcExists( "device.exe") )

#Define variable to check status of Bluetooth via registry
BluetoothStatus = RegRead( "HKLM","System\State\Hardware","Bluetooth" )

#if Bluetooth DWORD = 8, BT is OFF so turn it on (set to 9)
If ( BluetoothStatus = 8 )
  RegWriteDWord( "HKLM","System\State\Hardware","Bluetooth", "9" )
EndIf
Sleep(checkmins*60000)
EndWhile
Note that I use a default time of 5 minutes, however on my own device I actually use 1 minute. I have a hard time believing that this will be any sort of 'performance' limiter when it's run, so every 1-2 mins shouldn't be a problem.

Anyways, this is one of my first scripts written in MortScript, so I hope you guys enjoy it. If anyone else can suggest any optimizations to my 'code', then by all means, please post in this thread.

Below you should find the attachment to the actual .mscr file. Please leave your feedback as to how well the script works for you.

Thanks guys, trying to give back to this amazing community whenever I can!

Brother, I install the script installed in phone but when phone boot up, the bluetooth is not turn on? Anything I missed out?
22nd November 2008, 04:51 AM |#6  
chongbh's Avatar
Senior Member
Flag Singpapore
Thanks Meter: 14
 
More
Hi,

I notice that you have added another VJVolubilis and X1FixBluetoothFinal-MSCR-v2.zip, do we need to uninstall the MortScript we installed earlier?

Do advise us accordingly, thanks.
22nd November 2008, 05:49 AM |#7  
scar45's Avatar
OP Recognized Themer
Flag 127.0.0.1
Thanks Meter: 1,078
 
Donate to Me
More
Quote:
Originally Posted by chongbh

Hi,

I notice that you have added another VJVolubilis and X1FixBluetoothFinal-MSCR-v2.zip, do we need to uninstall the MortScript we installed earlier?

Do advise us accordingly, thanks.

yes chongbh, you can remove the other (v1) script completely by simply deleting the file. Next, grab the .cab installer for Vijay's app, install it to the PHONE memory (only like 15kb), and unzip the X1FixBluetoothFinal-MSCR-v2.zip into your \WINDOWS\STARTUP folder. Simple as that.

Further to this, you can customize how frequently you want the script to run which will in turn run VJVolubilis + the argument to turn BT on.

On a side note, I'm not quite sure why the previous script didn't work. I do have a feeling that it's because SE uses a proprietary Bluetooth stack which ignores that change to the single registry entry. I would love to find out how VJVolubilis and Wisbar Advance Desktop trigger Bluetooth states, because they still do work with the X1.

Anyways, this patchwork shouldn't have to last very long (not too bad still as MortScript.exe uses peak 100kb memory while running), and we see an official CAB update from Sony Ericsson addressing the well-known issue. Hope this helps some of you hold over till then!
22nd November 2008, 07:42 AM |#8  
chongbh's Avatar
Senior Member
Flag Singpapore
Thanks Meter: 14
 
More
Thumbs up
Guess for some newbie might be in the lost as in what are the proper procedures :

1) Download and install the MortScript.cab into PHONE Memory :

http://sto-helit.de/index.php?module...am&action=list

2) Download and install the Vjvolubilis.cab into PHONE Memory :

http://www.vijay555.com/vj/releases/...jvolubilis.cab

3) Download the X1FixBluetoothFinal-MSCR-v2.zip from the 1st post of this thread

4) Unzip the X1FixBluetoothFinal-MSCR-v2.zip into your X1's phone memory location : \WINDOWS\STARTUP folder

5) Reboot your phone and your Bluetooth should stay ON forever

I have tested on my X1 and it works great! Thanks to Scar45 for your effort and guidance.
26th November 2008, 09:29 PM |#9  
Junior Member
Thanks Meter: 0
 
More
Hi,
the \Windows\Startup folder mentioned - is that the same as \Windows\Autostart ? Or should I create a \Windows\Startup, because there is no such folder at the moment in my X1...

Thanks for enlighten me on why my X1 keeps shuting off the Bluetooth all the time...
/Stefan
26th November 2008, 11:06 PM |#10  
Member
Thanks Meter: 0
 
More
Thanks a lot

I contacted Sony Ericsson because my Bluetooth headset was "detecting" the bluetooth dropped and when I looked on the X1i the Bluetooth was turned off.
They told me to buy another BT headset, nice to see I wasn't crazy
26th November 2008, 11:24 PM |#11  
scar45's Avatar
OP Recognized Themer
Flag 127.0.0.1
Thanks Meter: 1,078
 
Donate to Me
More
Quote:
Originally Posted by brago

Hi,
the \Windows\Startup folder mentioned - is that the same as \Windows\Autostart ? Or should I create a \Windows\Startup, because there is no such folder at the moment in my X1...

Thanks for enlighten me on why my X1 keeps shuting off the Bluetooth all the time...
/Stefan

Not a problem Stefan, and yes, you can create the \Windows\StartUp folder if it isn't there already. I would test it by copying ANY shortcut in there and seeing if it runs that program after a soft-reset. If that's all good, put the .mscr script in the \Windows\StartUp folder and you'll be good to go.

Quote:
Originally Posted by lmame

Thanks a lot

I contacted Sony Ericsson because my Bluetooth headset was "detecting" the bluetooth dropped and when I looked on the X1i the Bluetooth was turned off.
They told me to buy another BT headset, nice to see I wasn't crazy

Apparently they are aware of the issue, but I'm sure that knowledge doesn't trickle down to the Customer Service Reps until a proper fix has been released.

Glad this script fix could help a lot of ppl out...thanks again to Vijay and Mirko for the tools needed!!
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes