View Full Version : idea for a small application... any help?
Dishe
31-07-2007, 11:17 PM
Ok, when I'm in my office I have poor signal issues that drain my battery and miss calls. If I switch to Roaming Only in my phone settings, then everything is just peachy. Problem is, its a lot of menus to click through every single time I come in to my office (Start, settings, phone, services, roaming, get settings, roaming only).
And then when I'm leaving, I want to turn the romaing settings back to automatic, once again its a lot of clicking.
I would imagine it would not be too difficult to write an app that could toggle that setting. Then it could be one click, or someone could even map the app to a hardware button for the ultimate ease of use.
I'm sure there are others who can see how useful such an app would be. Many of us do something like this all the time.
So, what do you think? Anyone willing to help develop this?
gernerpsu
01-08-2007, 12:33 AM
Sounds like a do-able program that would be very useful even for people not in your situation. Of course, I don't know how to, I'm just endorsing this idea.
dsotm82
01-08-2007, 05:31 PM
In for this
Dishe
01-08-2007, 11:15 PM
GREAT!
Now, who can actually help figuring out how to code this? Can that sort of data even be accessed from standard APIs?
Dishe
07-08-2007, 07:39 AM
Ok folks, until I have the time to find out what actually goes on behind the scenes when roaming settings are changed, I think our best bet is to write a script of keypresses/mouseclicks using mortscript.
Mortscript, in case you didn't know, is a simple batch process program, which lets you assign a series of commands to a script, sort of like a macro.
This will essentially be a script to go through the menus and click through options to do what we would do by hand. It will speed things up a bit, but it won't be as simple as a standalone app.
playing with mortscript now, I'll keep you guys posted.
EDIT: Anyone who wants to take a crack at this as well, by all means, mortscript is free! I'm just learning how to use it now, but if anyone has any experience with it, hit me up with suggestions! Or better yet, write a script and show me how it works!
Dishe
07-08-2007, 08:09 PM
Can anyone tell me what registry changes are made when you switch from roaming to automatic?
I can't seem to compare registry backups taken with PHM RegEdit (some propietary format, and no export to text option!)
Dishe
09-08-2007, 09:54 PM
This is still not the most ideal solution, but it works for me.
I wrote two Mortscript scripts that simulate the key taps automatically. The downside to this is that you can't toggle it on/off, you need to run one program to force roam, and another one to put it back to automatic.
USE THESE AT YOUR OWN RISK!
If you have any bugs/questions/comments, let me know.
Requirements
MortScript:
You need to install the mortscript interpreter first.
http://www.sto-helit.de/downloads/mortscript/MortScript-4.0.zip
The zip file attached below contains two .mscr files:
Roam
Roam-NO
Pretty self explanatory what does what. You can rename them if you want, this just works for me.
emunutz
09-08-2007, 10:26 PM
I wrote two Mortscript scripts that simulate the key taps automatically. The downside to this is that you can't toggle it on/off, you need to run one program to force roam, and another one to put it back to automatic.
If you wanted to, you could write a temp file or reg key to check if the setting is on or off. In fact, the file wouldn't even need any data in it, you could just check for it's existence. That way you only need one script. Hope that helps you out.
Vinny75
10-08-2007, 02:25 AM
I havent been able to find (or pull) the ril.dll file from a Mogul Wm6 installation, but once you have that file, you should be able to dump the exports and use the RIL_* functions by ordinal. This has been done on GSM phones.
I haven't had time yet, but I believe someone has dumped the files from the newest update rom.
emunutz
10-08-2007, 11:05 PM
Dishe,
I took your script and applied my suggestion to it. I also wrapped it up in a standalone package, so if anyone else wants to run it, they won't need MortScript installed as the exe is in here. If you already have MortScript installed, you can just run the .mscr file instead of the .exe of the same name.
What it will do is run the prog, then check for the existence of the file "roam" in the script path. If it's not there, it will run your roam function and then create the file. If it already exists (meaning you turned on roaming only), then it run your function to turn off roaming and delete the temp file. Hope it helps you out.
EDIT: If for some reason the key presses do the wrong thing, you can just set your phone back to automatic and delete the "roam" file in the script path if it's there, then you're back in business.
EDIT2: Added a longer wait time (5 secs) for the Comm Manager, should allow it to work with more graphic intensive Comm Managers (like the Kaiser 10-button, tested).
Vinny75
11-08-2007, 04:38 PM
I havent been able to find (or pull) the ril.dll file from a Mogul Wm6 installation, but once you have that file, you should be able to dump the exports and use the RIL_* functions by ordinal. This has been done on GSM phones.
I haven't had time yet, but I believe someone has dumped the files from the newest update rom.
I know, qouting myself, but.. you don't need the ordinal, you can get the function by name from the dll, so far I am able to use RIL_Initialize and RIL_GetRoamingMode to call my pfResultCallback, but the value I am getting in reutrn isn't making sense, so have to figure that out. I am using a modified tstril util. I can post the changes if anyone wants to take a look.
Vinny75
11-08-2007, 05:22 PM
Got the following for RIL_GetRoaming Mode
Mode Value
Sprint Only 0x00000001
Automatic 0x000000FF
Roaming Only 0x000000FE
Now using RIL_SetRoamingMode, I can set the Sprint Only mode, the other two throw a 0x80004005 HRESULT, I can use 0x00000002 and 0x0000003 (constants defined if you search the internet), and they don't throw an error, but they dont actually change any settings...
Vinny75
11-08-2007, 06:19 PM
You can get tstril from here:
http://wiki.xda-developers.com/index.php?pagename=RIL
Expanded ril.h (not sure how accurate):
http://www.xs4all.nl/~itsme/projects/xda/ril/ril.h
Replace the DoRIL function in tstril.cpp with this code to test:
typedef HRESULT (*pfnRIL_Initialize)(DWORD, RILRESULTCALLBACK, RILNOTIFYCALLBACK, DWORD, DWORD, HRIL*);
typedef HRESULT (*pfnRIL_GetRoamingMode)(HRIL);
typedef HRESULT (*pfnRIL_SetRoamingMode)(HRIL, DWORD);
//HRIL g_hRIL;
HINSTANCE g_hDLL;
HRESULT g_hResult;
DWORD
DoRIL(LPVOID lpvoid)
{
HRESULT result;
DWORD dwNotificationClasses = 0xFF0000;
LRESULT lresult;
TCHAR szString[256];
SendMessage(g_hwndEdit, LB_RESETCONTENT, 0, 0);
lresult = SendMessage(g_hwndEdit, LB_GETHORIZONTALEXTENT, 0, 0);
SendMessage(g_hwndEdit, LB_SETHORIZONTALEXTENT, 1000, 0);
//result = RIL_Initialize(1, ResultCallback, NotifyCallback,
// dwNotificationClasses, g_dwParam, &g_hRil);
//wsprintf(szString, L"RIL Handle: %08X, result %08X", g_hRil, result);
//SendMessage(g_hwndEdit, LB_ADDSTRING, 0, (LPARAM) szString);
g_hRil = NULL;
g_hDLL = LoadLibrary(L"ril.dll");
//HRESULT hResult = 0;
if (g_hDLL != NULL)
{
pfnRIL_Initialize lpfnRIL_Initialize = (pfnRIL_Initialize)GetProcAddress(g_hDLL, L"RIL_Initialize");
if (lpfnRIL_Initialize)
{
result = (lpfnRIL_Initialize)(1, ResultCallback, NULL /*NotifyCallback*/, 0 /*dwNotificationClasses*/, 0 /*g_dwParam*/, &g_hRil);
if (result == S_OK)
{
wsprintf(szString, L"Initialize RIL Handle: %08X, result %08X", g_hRil, result);
SendMessage(g_hwndEdit, LB_ADDSTRING, 0, (LPARAM) szString);
pfnRIL_GetRoamingMode lpfnRIL_GetRoamingMode = (pfnRIL_GetRoamingMode)GetProcAddress(g_hDLL, L"RIL_GetRoamingMode");
if (lpfnRIL_GetRoamingMode)
{
g_hResult = (lpfnRIL_GetRoamingMode)(g_hRil);
wsprintf(szString, L"GetRoamingMode RIL Handle: %08X, g_hResult %08X", g_hRil, g_hResult);
SendMessage(g_hwndEdit, LB_ADDSTRING, 0, (LPARAM) szString);
}
//pfnRIL_SetRoamingMode lpfnRIL_SetRoamingMode = (pfnRIL_SetRoamingMode)GetProcAddress(g_hDLL, L"RIL_SetRoamingMode");
//if (lpfnRIL_SetRoamingMode)
//{
// g_hResult = (lpfnRIL_SetRoamingMode)(g_hRil, 254);
// wsprintf(szString, L"SetRoamingMode RIL Handle: %08X, g_hResult %08X", g_hRil, g_hResult);
// SendMessage(g_hwndEdit, LB_ADDSTRING, 0, (LPARAM) szString);
//}
}
}
//FreeLibrary(g_hDLL);
}
// while(1) {
// Sleep(100);
//// wsprintf(szString, L"%s",L"...");
//// SendMessage(g_hwndEdit, LB_ADDSTRING, 0, (LPARAM) szString);
// }
return 0;
}
hpibri
11-09-2007, 08:57 AM
Thanks for the work on those Mort Scripts!
berardi
11-09-2007, 02:59 PM
Thank you!
Dishe
11-09-2007, 05:50 PM
wow, I haven't checked this thread in a while...
Vinny75, I haven't had time to play with this, but it looks like you've been making some progress... how far have you gotten with this?
Vinny75
06-10-2007, 11:14 PM
The following values you should work for the second parameter of the RIL_GetRoamingMode and RIL_SetRoamingMode functions... they appeared to work on my phone
Mode RIL_GetRoamingMode RIL_SetRoamingMode
Sprint Only 0x00000001 0x00000001
Automatic 0x000000FF 0x00000004
Roaming Only 0x000000FE 0x00000005
I found the RIL_SetRoamingMode value in the following Registry Key
[HKEY_LOCAL_MACHINE\SOFTWARE\OEM\PhoneSetting\Netwo rkService]
Dishe
07-10-2007, 01:29 AM
The following values you should work for the second parameter of the RIL_GetRoamingMode and RIL_SetRoamingMode functions... they appeared to work on my phone
Mode RIL_GetRoamingMode RIL_SetRoamingMode
Sprint Only 0x00000001 0x00000001
Automatic 0x000000FF 0x00000004
Roaming Only 0x000000FE 0x00000005
I found the RIL_SetRoamingMode value in the following Registry Key
[HKEY_LOCAL_MACHINE\SOFTWARE\OEM\PhoneSetting\Netwo rkService]
So would editing the registry be sufficient to change the roaming mode of the phone?
Did you compile an app to do this?
dcd1182
07-10-2007, 04:49 PM
slightly off topic, but i think vinny75 might know the answer. id like to modify my alltel-based rom to give sprint only, automatic, roaming only options (alltel gives home only and automatic.) is ril.dll all that is needed from the sprint rom?
Vinny75
07-10-2007, 10:38 PM
So would editing the registry be sufficient to change the roaming mode of the phone?
Did you compile an app to do this?
I just compiled a quick and dirty app to test the values... the source is in my previous posts
Vinny75
18-10-2007, 09:54 PM
Dishe,
Try this application, should switch from Sprint Only/Automatic mode to Roaming Mode and from Roaming Mode to Automatic.
Source code included; Based on tstril source (see previous posts for tstril source)
TheBundo
19-10-2007, 02:13 AM
Can it be set to a hotkey with AEButton Plus, and toggled on/off like Bluetooth, etc?
texasez
21-10-2007, 02:52 PM
Dishe,
Try this application, should switch from Sprint Only/Automatic mode to Roaming Mode and from Roaming Mode to Automatic.
Source code included; Based on tstril source (see previous posts for tstril source)
How do you install on the Mogul?
Larry
Dishe
21-10-2007, 05:43 PM
Larry, copy the files onto your device and click the .exe in file explorer.
Vinny, good work! It seems to do the trick, and its much better than scrolling through those menus (and far more efficient than running a MortScript).
Very cool! Thanks for posting the code as well!
Only thing I'd add to it is a status screen that tells you whether or not you just entered roaming or automatic.
(Switching to automatic does not automatically put you back into home service, it could stay roaming for a bit so you don't know whether the change actually took unless you check the status).
I'll poke around in the code a bit and see if I can add that to it. My VStudio is rusty...
EDIT: It goes into roaming just fine, but it appears that going OUT of roaming (back into sprint only) is a problem!
So far, every time I check in phone settings, it still says roaming only, no matter how many times I run it!
Vinny75
21-10-2007, 07:09 PM
I won't go back to Sprint only, It will only change to Automatic or Roaming. If it is in Sprint Only, it will switch to Roaming then when it switches back it will switch to Automatic.
Could add it to store automatic or sprint only before switching to roaming, just an extra step I didnt think was necessary.
But it should be switching, let me know if it isnt working, Ill take another look.
Dishe, out of curiousity.. .what ROM and Radio versions are you running?
Dishe
21-10-2007, 11:13 PM
I won't go back to Sprint only, It will only change to Automatic or Roaming. If it is in Sprint Only, it will switch to Roaming then when it switches back it will switch to Automatic.
Could add it to store automatic or sprint only before switching to roaming, just an extra step I didnt think was necessary.
But it should be switching, let me know if it isnt working, Ill take another look.
Dishe, out of curiousity.. .what ROM and Radio versions are you running?
Sorry, I meant Automatic, not Sprint Only. But yeah, it seems to not be switching back.
Using stock Radio rom, but a modified (DCD's) clean alltel OS Rom.
Vinny75
22-10-2007, 04:13 PM
Sorry, I meant Automatic, not Sprint Only. But yeah, it seems to not be switching back.
Using stock Radio rom, but a modified (DCD's) clean alltel OS Rom.
I wonder if the RIL.dll for Alltel is different from the Sprint one. What are the values in this key:
HKEY_LOCAL_MACHINE\SOFTWARE\OEM\PhoneSetting\Netwo rkService
Dishe
22-10-2007, 10:53 PM
ItemCount=3
ItemName1=Home Only
ItemName2=Automatic
ItemName3=Roaming Only
ItemValue1=1
ItemValue2=4
ItemValue3=5
Supposedly dcd ripped out the Sprint network settings because Alltel only had options for Home Network or Automatic (no roaming only).
Odd...
texasez
22-10-2007, 11:04 PM
Vinny
I can go to roaming only by clicking on SwitchRoam in file explorer but I also cannot go back to automatic. I am using the stock radio and rom from cingular.
Larry
hanmin
22-10-2007, 11:20 PM
just wondering. What if you have a toggle to have it on flightmode instead? what's the advantage putting it into roaming only?
Vinny75
22-10-2007, 11:59 PM
I think it is a threading issue... when I run it through the debugger on my phone it works fine... not so great without it... I need to work through that.. may need to put up a window to receive the message and tell you when its ok to close it... though im not sure how sprint does it then...
Dishe
23-10-2007, 04:36 AM
just wondering. What if you have a toggle to have it on flightmode instead? what's the advantage putting it into roaming only?
flight mode shuts off your phone radio.
"roaming only" forces your phone to give up on trying to connect to your home service and instead roam on someone else's network.
Sprint has roaming agreements with many big carriers who have far better coverage than they do in some areas (*cough*VERIZON*cough*). In those areas, if you have a very weak Sprint signal and a strong VZ signal, it will keep trying to connect to the weak Sprint signal because not-roaming is preferred to roaming. This means that you may experience dropped calls, missed calls, and your battery will drain faster (negotiating the network connection to the towers each time it re-connects takes more juice than just sitting idle on a network).
Many Sprint users often force their phone into roaming to help with these problems. Problem is that when roaming there is no mobile to mobile, and rarely EVDO. So, its good to switch to it when in a weak area, and back to "Automatic" when you're in a strong Sprint area. That's why we need to develop this app.
EDIT: By the way, you can already toggle it into flight mode by pressing and holding the red END key.
hanmin
23-10-2007, 02:06 PM
Thanks Dishe, now the picture is much clearer. You dont get this problem in the UK.. except probably with the 'three' network here though.
If it were to be a flight-mode thing, there are tons of software around that can do a automatic timed flight-mode toggle. Roaming mode toggle is really.. 'new'. Hence, I've asked.
Dishe
23-10-2007, 08:12 PM
Thanks Dishe, now the picture is much clearer. You dont get this problem in the UK.. except probably with the 'three' network here though.
If it were to be a flight-mode thing, there are tons of software around that can do a automatic timed flight-mode toggle. Roaming mode toggle is really.. 'new'. Hence, I've asked.
Yeah, when I was on T-mobile this wasn't such an issue... its really applicable only to CDMA networks, particularly in the US where many of them have unlimited roaming agreements with each other.
keeepinitgansta
17-11-2007, 02:26 PM
Any updates to this application? Please post. Thanks
tj78492
17-01-2008, 01:03 AM
I just made a post about this exact same thing.... any recent progress?
digiblur
21-03-2008, 04:19 AM
I tried the little app but it doesn't do anything on my Sprint phone with the latest ROM. The Mortscript to toggle it works good though.
Thanks for the link to this thread Dishe.
rfrankli
24-03-2008, 03:39 PM
I tried the little app but it doesn't do anything on my Sprint phone with the latest ROM. The Mortscript to toggle it works good though.
Thanks for the link to this thread Dishe.
Im experiencing the same thing on my Mogul with the stock 3.35.651.2 Sprint Rom using the tstril program. It doesn't appear to do anything. Any chance this gets updated for the new ROM? I tried taking a look at the source myself, but my C++ courses were a long time ago.
mawst95
08-05-2008, 03:19 AM
Bump. Doesn't seem to work on my sprint vogue. Anyone wanna update?
tttttt
09-07-2008, 10:37 PM
Has anyone made any progress here?
I'm really upset by this. I remember this working, but now, for some reason, it doesn't.
After upgrading my rom to the newest Sprint one, I was only able to change the mode from the program"SwitchRoamMode.exe" just once, even after many clicks.
At the very least, I updated the Sprint roaming settings (since they disabled "Roaming Only" as a function). They must have changed the ril.dll in the 3.56.651.0 and 3.42.02(radio) roms.
Anyway, I've included a .cab with the registry changes. It covers both \InitProv\PhoneSetting and \PhoneSetting\NetworkService changes to include Roaming.
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.