BlueStacks ADB HELP, please & TY - Android General

Code:
local $results, $h, $PID, $BlueStacks_Path
$BlueStacks_Path = @ProgramFilesDir & "\BlueStacks\"
$BlueStacks_Path = StringReplace($BlueStacks_Path, "\\", "\")
$h = Run($BlueStacks_Path & "hd-Adb connect localhost","","",$STDIO_INHERIT_PARENT)
sleep(1000)
$PID = run($BlueStacks_Path & "HD-Frontend.exe Testing")
WinGetProcess($PID)
sleep(1000)
Do
$result = run($BlueStacks_Path & "HD-Adb shell getprop sys.boot_completed", "", "", BitOR($STDIN_CHILD, $STDERR_MERGED))
ConsoleWrite("$result: " & $result & @CRLF)
sleep(1000)
until $result = 1
Hi ALL, I am really knew at this and I am trying to figure out why I get an infinite loop when I am checking to see if BlueStacks is open.
If I do everything command line based, everything WORKS as above, but when I put it in AutoIT it just LOOPS & LOOPS & LOOPS. When I do the consolewrite, it's like it is giving me a PID# rather than return 1.
What am I doing wrong?

Related

Duke3d ported to PocketPC

Guys,Dukem Nukem 3D is ported to Pocket Pc!!!
Latest version v0.4g
Configuration files for Himalayas,BlueAngel,Universal.
--------------XDA2--------------------
BUTTON: --------------------COMMAND:
Left----------------------------Left
Right--------------------------Right
Up-----------------------------Up
Down--------------------------Down
Pad----------------------------Enter
Contacts----------------------Softkey2
Calendar----------------------Softkey1
Record------------------------Endcall
Volume Up--------------------Volumeup
Volume Down----------------Volumedown
Green Phone button---------Call
TouchScreen-----------------Mousebutton0
Simply download the uploaded .Zip file and extract all in your PocketPc folder or SD! Then use add the .GRP file (you can download Shareware Duke from ftp://ftp.3drealms.com/share/3dduke13.zip ) and run SpvDuke3d.exe!
Universal VGA 0.4f with music support,you need to download Timidity file and extract it to \Storage Card\Timidity
http://www.libsdl.org/projects/SDL_mixer/timidity/timidity.tar.gz
Enjoy!
[Himalayas and BlueAngel file version v0.3b as there are some problems with latest versions.]
[2 Universal versions: QVGA version v0.3b, Landscape VGA v0.4f with music support!]
being for the spv the res is somewhat lower then it would be if it was made for pocketpc i asume
np,the app supports both SmartPhones and PocketPc..
Key codes
unapproachable2kx said:
np,the app supports both SmartPhones and PocketPc..it was rebuilt for that.
But no mapped keys,so I still need know 4 buttons of Xda2.
Click to expand...
Click to collapse
Hi,
Try these:
193 = calendar
194 = contacts
195 = camera
196 = recorder
BR
Doesnt work. :?
I downloaded from that link and it crashes my xda1.
Quiting Duke3d!
I have found a way to quit duke3d! Simply:
change Multi1 = "Call" "" to Multi1 = "" ""
and
change Original_F10 = "" "" to Original_F10 = "Call" ""
(IN Landscape_0)
This should let you close duke3d using the answer button!
Also for better game play choose:
ScreenWidth = 240
ScreenHeight = 180
Rather than:
ScreenWidth = 0
ScreenHeight = 0
There is a big gap at the bottom of the screen but frame rate is greatly improved!
I have not been able to setup the landscape modes but as soon as I do I will post my results!
Below is my .cfg file for the XDAII if it helps anyone.
- XDAII joystick button is crouch and open doors.
- Volume UP/DOWN is strafe left/right.
- Call button quits the game.
- Touching the screen fires
- All remaining buttons is Jump
[Setup]
SetupVersion = "1.3D"
[Engine Setup]
UsingGapi = 1
Platform_Timer_HZ = 100
LandscapeMode = 1
CacheMemory = 2600
ShowFPS = 1
TickRate = 100
TicksPerFrame = 26
ScanCodeMapping = 1
[Scan Code Mapping]
sc_59 = "Escape"
sc_60 = "VolumeUp"
sc_61 = "VolumeDown"
sc_AUX1 = "A"
sc_AUX2 = "Z"
sc_AUX3 = ""
sc_AUX4 = ""
sc_AUX5 = ""
[Screen Setup]
ScreenMode = 1
ScreenWidth = 0
ScreenHeight = 0
Shadows = 0
Password = ""
Detail = 1
Tilt = 0
Messages = 1
Out = 0
ScreenSize = 15
ScreenGamma = 16
[Sound Setup]
FXDevice = 0
MusicDevice = 0
FXVolume = 220
MusicVolume = 200
NumVoices = 4
NumChannels = 2
NumBits = 16
MixRate = 8000
MidiPort = 0x330
BlasterAddress = 0x220
BlasterType = 3
BlasterInterrupt = 5
BlasterDma8 = 1
BlasterDma16 = 5
BlasterEmu = 0x620
ReverseStereo = 0
SoundToggle = 1
VoiceToggle = 1
AmbienceToggle = 1
MusicToggle = 1
[KeyDefinitions]
Move_Forward = "Up" ""
Move_Backward = "Down" ""
Turn_Left = "Left" ""
Turn_Right = "Right" ""
Strafe = "" ""
Fire = "LCtrl" "RCtrl"
Open = "Space" ""
Run = "LShift" "RShift"
AutoRun = "CapLck" ""
Jump = "A" ""
Crouch = "Z" ""
Look_Up = "" ""
Look_Down = "" ""
Look_Left = "Insert" ""
Look_Right = "Delete" ""
Strafe_Left = "4" ""
Strafe_Right = "6" ""
Aim_Up = "2" ""
Aim_Down = "8" ""
Inventory = "Enter" ""
Inventory_Left = "G" ""
Inventory_Right = "M" ""
Holo_Duke = "" ""
Jetpack = "" ""
NightVision = "" ""
MedKit = "" ""
TurnAround = "BakSpc" ""
SendMessage = "" ""
Map = "Tab" ""
Shrink_Screen = "-" "Kpad-"
Enlarge_Screen = "=" "Kpad+"
Center_View = "KPad5" ""
Holster_Weapon = "ScrLck" ""
Show_Opponents_Weapon = "" ""
Map_Follow_Mode = "" ""
See_Coop_View = "" ""
Mouse_Aiming = "" ""
Toggle_Crosshair = "" ""
Steroids = "" ""
Quick_Kick = "`" ""
Next_Weapon = "'" ""
Previous_Weapon = ";" ""
Original_F1 = "" ""
Original_F2 = "" ""
Original_F3 = "" ""
Original_F4 = "" ""
Original_F5 = "" ""
Original_F6 = "" ""
Original_F7 = "" ""
Original_F8 = "" ""
Original_F9 = "" ""
Original_F10 = "" ""
[KeyDefinitions_Landscape0]
Move_Forward = "Up" ""
Move_Backward = "Down" ""
Turn_Left = "Left" ""
Turn_Right = "Right" ""
Strafe = "" ""
Fire = "Enter" ""
Open = "Pound" ""
Run = "LShift" "RShift"
AutoRun = "0" ""
Jump = "VolumeUp" ""
Crouch = "VolumeDown" ""
Look_Up = "" ""
Look_Down = "" ""
Look_Left = "Insert" ""
Look_Right = "Delete" ""
Strafe_Left = "4" ""
Strafe_Right = "6" ""
Aim_Up = "2" ""
Aim_Down = "8" ""
Inventory = "J" ""
Inventory_Left = "G" ""
Inventory_Right = "M" ""
Holo_Duke = "" ""
Jetpack = "" ""
NightVision = "" ""
MedKit = "" ""
TurnAround = "W" ""
SendMessage = "" ""
Map = "Record" ""
Shrink_Screen = "-" "Kpad-"
Enlarge_Screen = "=" "Kpad+"
Center_View = "KPad5" ""
Holster_Weapon = "ScrLck" ""
Show_Opponents_Weapon = "" ""
Map_Follow_Mode = "SoftKey1" ""
See_Coop_View = "" ""
Mouse_Aiming = "" ""
Toggle_Crosshair = "" ""
Steroids = "" ""
Quick_Kick = "`" ""
Next_Weapon = "D" ""
Previous_Weapon = "." ""
Original_F1 = "" ""
Original_F2 = "" ""
Original_F3 = "" ""
Original_F4 = "" ""
Original_F5 = "" ""
Original_F6 = "" ""
Original_F7 = "" ""
Original_F8 = "" ""
Original_F9 = "" ""
Original_F10 = "Call" ""
Multi1 = "" ""
[KeyDefinitions_Landscape1]
Move_Forward = "Left" ""
Move_Backward = "Right" ""
Turn_Left = "Down" ""
Turn_Right = "Up" ""
Strafe = "" ""
Fire = "" ""
Open = "Enter" ""
Run = "LShift" "RShift"
AutoRun = "0" ""
Jump = "A" ""
Crouch = "Enter" ""
Look_Up = "" ""
Look_Down = "" ""
Look_Left = "Insert" ""
Look_Right = "Delete" ""
Strafe_Left = "VolumeDown" ""
Strafe_Right = "VolumeUp" ""
Aim_Up = "2" ""
Aim_Down = "8" ""
Inventory = "J" ""
Inventory_Left = "G" ""
Inventory_Right = "M" ""
Holo_Duke = "" ""
Jetpack = "" ""
NightVision = "" ""
MedKit = "" ""
TurnAround = "W" ""
SendMessage = "" ""
Map = "Record" ""
Shrink_Screen = "-" "Kpad-"
Enlarge_Screen = "=" "Kpad+"
Center_View = "KPad5" ""
Holster_Weapon = "ScrLck" ""
Show_Opponents_Weapon = "" ""
Map_Follow_Mode = "SoftKey1" ""
See_Coop_View = "" ""
Mouse_Aiming = "" ""
Toggle_Crosshair = "" ""
Steroids = "" ""
Quick_Kick = "`" ""
Next_Weapon = "D" ""
Previous_Weapon = "." ""
Original_F1 = "" ""
Original_F2 = "" ""
Original_F3 = "" ""
Original_F4 = "" ""
Original_F5 = "" ""
Original_F6 = "" ""
Original_F7 = "" ""
Original_F8 = "" ""
Original_F9 = "" ""
Original_F10 = "Call" ""
Multi1 = "" ""
[KeyDefinitions_Landscape2]
Move_Forward = "Right" ""
Move_Backward = "Left" ""
Turn_Left = "Up" ""
Turn_Right = "Down" ""
Strafe = "" ""
Fire = "F8" ""
Open = "F9" ""
Run = "LShift" "RShift"
AutoRun = "CapLck" ""
Jump = "A" "/"
Crouch = "Z" ""
Look_Up = "PgUp" "Kpad9"
Look_Down = "PgDn" "Kpad3"
Look_Left = "Insert" "Kpad0"
Look_Right = "Delete" "Kpad."
Strafe_Left = "," ""
Strafe_Right = "." ""
Aim_Up = "Home" "KPad7"
Aim_Down = "End" "Kpad1"
Inventory = "Enter" "KpdEnt"
Inventory_Left = "[" ""
Inventory_Right = "]" ""
Holo_Duke = "H" ""
Jetpack = "J" ""
NightVision = "N" ""
MedKit = "M" ""
TurnAround = "BakSpc" ""
SendMessage = "T" ""
Map = "Tab" ""
Shrink_Screen = "-" "Kpad-"
Enlarge_Screen = "=" "Kpad+"
Center_View = "KPad5" ""
Holster_Weapon = "ScrLck" ""
Show_Opponents_Weapon = "W" ""
Map_Follow_Mode = "F" ""
See_Coop_View = "K" ""
Mouse_Aiming = "U" ""
Toggle_Crosshair = "I" ""
Steroids = "R" ""
Quick_Kick = "`" ""
Next_Weapon = "'" ""
Previous_Weapon = ";" ""
Original_F1 = "" ""
Original_F2 = "" ""
Original_F3 = "" ""
Original_F4 = "" ""
Original_F5 = "" ""
Original_F6 = "" ""
Original_F7 = "" ""
Original_F8 = "" ""
Original_F9 = "" ""
Original_F10 = "" ""
Original_F11 = "" ""
Original_F12 = "" ""
[Controls]
ControllerType = 1
JoystickPort = 0
MouseSensitivity = 32768
ExternalFilename = "EXTERNAL.EXE"
EnableRudder = 0
MouseAiming = 0
MouseButton0 = "Fire"
MouseButtonClicked0 = ""
MouseButton1 = "Strafe"
MouseButtonClicked1 = "Open"
MouseButton2 = "Move_Forward"
MouseButtonClicked2 = ""
JoystickButton0 = "Fire"
JoystickButtonClicked0 = ""
JoystickButton1 = "Strafe"
JoystickButtonClicked1 = "Inventory"
JoystickButton2 = "Run"
JoystickButtonClicked2 = ""
JoystickButton3 = "Open"
JoystickButtonClicked3 = "Crouch"
JoystickButton4 = "Aim_Down"
JoystickButtonClicked4 = ""
JoystickButton5 = "Look_Right"
JoystickButtonClicked5 = ""
JoystickButton6 = "Aim_Up"
JoystickButtonClicked6 = ""
JoystickButton7 = "Look_Left"
JoystickButtonClicked7 = ""
MouseAnalogAxes0 = "analog_turning"
MouseDigitalAxes0_0 = ""
MouseDigitalAxes0_1 = ""
MouseAnalogScale0 = 0
MouseAnalogAxes1 = "analog_moving"
MouseDigitalAxes1_0 = ""
MouseDigitalAxes1_1 = ""
MouseAnalogScale1 = 0
JoystickAnalogAxes0 = "analog_turning"
JoystickDigitalAxes0_0 = ""
JoystickDigitalAxes0_1 = ""
JoystickAnalogScale0 = 0
JoystickAnalogAxes1 = "analog_moving"
JoystickDigitalAxes1_0 = ""
JoystickDigitalAxes1_1 = ""
JoystickAnalogScale1 = 0
JoystickAnalogAxes2 = "analog_strafing"
JoystickDigitalAxes2_0 = ""
JoystickDigitalAxes2_1 = ""
JoystickAnalogScale2 = 0
JoystickAnalogAxes3 = ""
JoystickDigitalAxes3_0 = "Run"
JoystickDigitalAxes3_1 = ""
JoystickAnalogScale3 = 0
GamePadDigitalAxes0_0 = "Turn_Left"
GamePadDigitalAxes0_1 = "Turn_Right"
GamePadDigitalAxes1_0 = "Move_Forward"
GamePadDigitalAxes1_1 = "Move_Backward"
MouseAimingFlipped = 0
GameMouseAiming = 0
AimingFlag = 0
[Comm Setup]
ComPort = 2
IrqNumber = 65535
UartAddress = 0xFFFF
PortSpeed = 9600
ToneDial = 1
SocketNumber = 0xFFFF
NumberPlayers = 2
ModemName = ""
InitString = "ATZ"
HangupString = "ATH0=0"
DialoutString = ""
PlayerName = "DUKE"
RTSName = "DUKE.RTS"
PhoneNumber = ""
ConnectType = 0
CommbatMacro#0 = "An inspiration for birth control."
CommbatMacro#1 = "You're gonna die for that!"
CommbatMacro#2 = "It hurts to be you."
CommbatMacro#3 = "Lucky Son of a *****."
CommbatMacro#4 = "Hmmm....Payback time."
CommbatMacro#5 = "You bottom dwelling scum sucker."
CommbatMacro#6 = "Damn, you're ugly."
CommbatMacro#7 = "Ha ha ha...Wasted!"
CommbatMacro#8 = "You suck!"
CommbatMacro#9 = "AARRRGHHHHH!!!"
PhoneName#0 = ""
PhoneNumber#0 = ""
PhoneName#1 = ""
PhoneNumber#1 = ""
PhoneName#2 = ""
PhoneNumber#2 = ""
PhoneName#3 = ""
PhoneNumber#3 = ""
PhoneName#4 = ""
PhoneNumber#4 = ""
PhoneName#5 = ""
PhoneNumber#5 = ""
PhoneName#6 = ""
PhoneNumber#6 = ""
PhoneName#7 = ""
PhoneNumber#7 = ""
PhoneName#8 = ""
PhoneNumber#8 = ""
PhoneName#9 = ""
PhoneNumber#9 = ""
[Misc]
Executions = 64
RunMode = 1
Crosshairs = 1
WeaponChoice0 = 3
WeaponChoice1 = 4
WeaponChoice2 = 5
WeaponChoice3 = 7
WeaponChoice4 = 8
WeaponChoice5 = 6
WeaponChoice6 = 0
WeaponChoice7 = 2
WeaponChoice8 = 9
WeaponChoice9 = 1
i'm not having much luck with this game
i got the shareware stuff but i cant install it
i get an error no matter which compatility mode i put it in
then when i try just running the duke3d for spv then i get some text black on grey soo fast i cant read what it say
then then i just get a blackscreen untill i softreset
well at one point i could get back without a softreset but the title bars were still black on programs and their close button would not work any more
Rudegar said:
i'm not having much luck with this game
i got the shareware stuff but i cant install it
i get an error no matter which compatility mode i put it in
then when i try just running the duke3d for spv then i get some text black on grey soo fast i cant read what it say
then then i just get a blackscreen untill i softreset
well at one point i could get back without a softreset but the title bars were still black on programs and their close button would not work any more
Click to expand...
Click to collapse
Yup..had you download it on my ftp? it must run well,now all buttons,except Red Phone button are fixed.
(will Upload the new Cfg on a while)
no your site is a bit too italian
i can check the checkbos for the file but pressing any of the 2 buttons one saying aggiorna the other saying scarica dont seem to do anything
also from what i can understand then i need some org gpr file or something but since cant get the shareware game to install on my pc
i cant seem to get hold of that
I have put all Shareware and .exe file into the .RAR so you only have to download and extract to any of your Pocket Pc folder!
Check box and Click to SCARICA,then SALVA.
ok now i somehow got it downloaded i can start it and all but not shoot
from what i can read at pocketgamer this is a known bug
but my problem when i try to close the game i still dont get the titlebar back i tried to run pocket heretic and close it again and i still dont get my title bar back i do seem to get it back if i run the camera but when i close that then my titlebar is lost once more
i'm forced to do a softreset to get my titlebar back
reminds me of pocket tombraider having to softreset to get on with ones life
Rudegar said:
ok now i somehow got it downloaded i can start it and all but not shoot
from what i can read at pocketgamer this is a known bug
but my problem when i try to close the game i still dont get the titlebar back i tried to run pocket heretic and close it again and i still dont get my title bar back i do seem to get it back if i run the camera but when i close that then my titlebar is lost once more
i'm forced to do a softreset to get my titlebar back
reminds me of pocket tombraider having to softreset to get on with ones life
Click to expand...
Click to collapse
You have sumthin' strange.. Have you tryed Fire by tapping the screen?
Also,using Green Phone button,I can exit without problems..had this problem on previous version.. dunno
no havent tried tabing the screen silly me really
i exit the game by using the pickup button
and then when it say y/n i press pickup button once more
maybe it's some of the extre programs i have running
today stuff and vidcomm stack disabled, ms stack disabled, task manager and extPhone
maybe they cause it somehow
when i uninstalled my vidcomm stack because it gave me some trouble
then all of a surden mediaplayer refused to play wma files saying it didint have the right codec
so i tried doing a hardreset and then i wanted to try duke3d on a clean system but it still take my titlebar away when i close the game
maybe it's an qtek 1.66 rom issue
or maybe it dont like being run from the sd card
Just let you know new version is out (0.4b) Rudegar,try it now..I am sure exit bug is fixed!
where is it at ?
i tried getting it from the org place where it's only the basics
and not your bigger version with everything but the one i just gotten the basic one is still only 0.03b
with the latest 0.4 all my problems are solved well duke related problems that is (excluding duke 4ever )

USB DUN: a working wvdial.conf for ATT?

Hello I have a Fuze with the stock ROM and am trying to get USB DUN working on GNU/Linux with wvdial. I have tried the following wvdial.conf and some variations of it all with the same problem. I keep getting error code 16 "The modem has hung up" when dialing. If anyone could post a working wvdial.conf for their ATT phone that would be great. I can post the exact error log or anything else if needed. Thanks.
Edit:
Same problem as in this thread:
http://forum.xda-developers.com/showthread.php?p=2609673
[Dialer Defaults]
Modem = /dev/ttyUSB0
ISDN = off
Modem Type = Analog Modem
Baud = 460800
Init = ATZ
Init2 = ATZ+CGDCONT=1,"IP","ISP.CINGULAR"
Init3 =
Init4 =
Init5 =
Init6 =
Init7 =
Init8 =
Init9 =
Phone = *99#
Phone1 =
Phone2 =
Phone3 =
Phone4 =
Dial Prefix =
Dial Attempts = 1
Dial Command = ATDT
#Ask Password = on
Password = CINGULAR1
Username = [email protected]
Auto Reconnect = off
Abort on Busy = off
Carrier Check = on
Check Def Route = on
Abort on No Dialtone = on
Stupid Mode = on
Idle Seconds = 0
Auto DNS = on
Now this is what I call a bump.

floating point arithmetic? - hack job workaround now included

is there a way to do floating point arithmetic in terminal?...or would bc binary need to be included since busybox does not have it? as of now you get a syntax error if using fp numbers in expression..or 0 when using division and result is a floating point.
Code:
# echo $(( 1 + 1 ))
echo $(( 1 + 1 ))
2
# echo $(( 1.0 + 1.0 ))
echo $(( 1.0 + 1.0 ))
arith: syntax error: " 1.0 + 1.0 "
# echo $(( 1 / 2 ))
echo $(( 1 / 2 ))
0
sh/bash has no native support for floating point math, so your solution must involve a binary executable. You can either use bc, or you can write a very simple C program and compile it for this platform....
i.e.,
Code:
//math.c
#include <stdlib.h>
#include <stdio.h>
int main (int argc, char ** argv){
float a = atof(argv[1]);
char op = argv[2][0];
float b = atof(argv[3]);
if (op == '+') printf("%f\n",a+b);
else if (op == '-') printf("%f\n",a-b);
else if (op == 'x') printf("%f\n",a*b);
else if (op == '/') printf("%f\n",a/b);
return 0;
}
$ ./math 1.5 + 2
3.500000
$ ./math 1.5 x 2
3.000000
$ ./math 1.5 - 2
-0.500000
$ ./math 1.5 / 2
0.750000
Oh and FYI, don't forget you can use variables in there, i.e.
$ A=1.5
$ B=2
$ OP=/
$./math $A $OP $B
0.750000
Is this the appropriate forum?
jdstankosky said:
Is this the appropriate forum?
Click to expand...
Click to collapse
Sorry, are you a moderator? :/
And yes, since this is a development matter, I'd say it falls within the DEVELOMPENT section..
lbcoder said:
sh/bash has no native support for floating point math, so your solution must involve a binary executable. You can either use bc, or you can write a very simple C program and compile it for this platform....
i.e.,
Code:
//math.c
#include <stdlib.h>
#include <stdio.h>
int main (int argc, char ** argv){
float a = atof(argv[1]);
char op = argv[2][0];
float b = atof(argv[3]);
if (op == '+') printf("%f\n",a+b);
else if (op == '-') printf("%f\n",a-b);
else if (op == 'x') printf("%f\n",a*b);
else if (op == '/') printf("%f\n",a/b);
return 0;
}
$ ./math 1.5 + 2
3.500000
$ ./math 1.5 x 2
3.000000
$ ./math 1.5 - 2
-0.500000
$ ./math 1.5 / 2
0.750000
Oh and FYI, don't forget you can use variables in there, i.e.
$ A=1.5
$ B=2
$ OP=/
$./math $A $OP $B
0.750000
Click to expand...
Click to collapse
thanks for the info. very helpful.
script workaround
i have constructed a workaround for doing fp math for determining partition sizes.
it's not pretty, but it gets the job done.
basically, it goes like this:
1. check to see if the number passed to the function is an integer
2. if not, i search the string for a "."
3. if the search turns up a "." (and units in GB) i break the number into two whole numbers (the integer portion..before the decimal, and the fraction portion after the decimal).
4. do the appropriate math on the integer section.
5. do the appropriate math on the fraction section, then divide by 10^#of digits after the decimal place.
6. add the two numbers together and voila! a hack job, floating point calculation.
Code:
ValidateSizeArg() {
# check for zero-length arg to protect expr length
[ -z "$1" ] && ShowError "zero-length argument passed to size-validator"
SIZEMB=
ARGLEN=`expr length $1`
SIZELEN=$(($ARGLEN-1))
SIZEARG=`expr substr $1 1 $SIZELEN`
SIZEUNIT=`expr substr $1 $ARGLEN 1`
# check if SIZEARG is an integer
if [ $SIZEARG -eq $SIZEARG 2> /dev/null ] ; then
# look for G
[ "$SIZEUNIT" == "G" ] && SIZEMB=$(($SIZEARG * 1024))
# look for M
[ "$SIZEUNIT" == "M" ] && SIZEMB=$SIZEARG
# no units on arg
[ -z "$SIZEMB" ] && SIZEMB=$1
# check if SIZEARG is a floating point number, GB only
elif [ `expr index "$SIZEARG" .` != 0 ] && [ "$SIZEUNIT" == "G" ] ; then
INT=`echo "$SIZEARG" | cut -d"." -f1`
FRAC=`echo "$SIZEARG" | cut -d"." -f2`
SIGDIGITS=`expr length $FRAC`
[ -z "$INT" ] && INT=0
INTMB=$(($INT * 1024))
FRACMB=$((($FRAC * 1024) / (10**$SIGDIGITS)))
SIZEMB=$(($INTMB + $FRACMB))
# it's not a valid size
else
ShowError "$1 is not a valid size"
fi
# return valid argument in MB
FUNC_RET=$SIZEMB
}
I was a basic/qbasic/gwbasic programmer in my younger days (like 12-14 yrs old)...
I feel ashamed that I have no idea of what this stuff is anymore. Thank God for guys like you.

[Q] Developing an application that requests root access

I'm developing my first application, and I'm curious if there are any "standard" ways for executing privileged shell commands. I've only been able to find one way to do it, by executing su, and then appending my commands to stdin of the su process.
Code:
Process p = Runtime.getRuntime().exec("su");
DataOutputStream pOut = new DataOutputStream(p.getOutputStream());
DataInputStream pIn = new DataInputStream(p.getInputStream());
String rv = "";
// su must exit before its output can be read
pOut.writeBytes(cmd + "\nexit\n");
pOut.flush();
p.waitFor();
while (pIn.available() > 0)
rv += pIn.readLine() + "\n";
I've read about wrapping privileged (superuser) calls up in JNI: is this possible? If so, how would one go about accomplishing it? Other than that, are there any other ways of calling privileged instructions from Java?
EDIT: Also, why exactly must su exit before I can capture it's output? When I read from the processes stdout before it has closed I get nothing.

[Q]

i buy this chines gps from ebay..its running win ce 6.0 ... i use a modified script to acces all my navcore that i instaled. the problem is i don`t know the command for exit...this script was for mio but it works on my gps but the exit button doesent work...the script look like this:
ICONXPBUTTON
x = -8
y = -16
Command = "\Storage Card\MioAutoRun\Programs\Utils\mspower.exe"
SizeNormal = 80
SizePushed = 70
ScaleAlpha = 100
IconNormal = ..\Icons\ff.ico
ScaleAlpha = 100
IconPushed = ..\Icons\ff_.ico
i change the path...still not working....i need the command to exit from a window
i want to be able to exit my script once i hit the exit button

Categories

Resources