Minimum code for a network connection - Windows Mobile Development and Hacking General

Hi guys,
I've made a simple program that uses google to compare hits on different strings. The program works fine on my computer, but compiling it with the Windows Mobile SDK has been a struggle. Eventually it compiles, but it does not work
I know that the problem has to do with how I am using the Connction Manager functions. I've found a few examples, but they are all pretty big and confusing.
The following did not work at all:
Code:
#include <connmgr.h>
CONNMGR_CONNECTIONINFO sInf;
DWORD dwCurrentStatus, dwStatus;
HANDLE hConnection = NULL;
ConnMgrConnectionStatus(hConnection, &dwCurrentStatus);
if (dwCurrentStatus != CONNMGR_STATUS_CONNECTED)
{
ConnMgrEstablishConnectionSync(&sInf, &hConnection,
30000, &dwStatus);
}
if(dwCurrentStatus != CONNMGR_STATUS_CONNECTED ||
dwStatus != CONNMGR_STATUS_CONNECTED)
AfxMessageBox(L"Not Connected to manager");
What is the minimum code to get my app connected, so that I may use functions like InternetOpenURL?
Any tips, links, guides etc. would be great
Bagera

Related

What code language is this?????

I found this code posted on another thread, but was wondering... What language is this? And what software do I need to compile it? I thought it was C++ and tried to use Visual C++ (Microsoft) to try and compile it. I saved the file as a .cpp and tried to compile it from the command prompt (cl /clr filename.cpp). Thanks in advance. I have little experience in this area, but I'm trying to learn.
Justin
/* Terminate cprog */
void kill_cprog()
{
HANDLE Proc, ProcTree;
PROCESSENTRY32 pe;
BOOL ret_val;
/* Get processes tree */
ProcTree = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
pe.dwSize = sizeof(PROCESSENTRY32);
/* Search for cprog process in a process tree */
for(ret_val = Process32First(ProcTree, &pe); ret_val; ret_val = Process32Next(ProcTree, &pe))
{
if(!wcsicmp(TEXT("cprog.exe"),pe.szExeFile))
{
/* Terminate cprog */
Proc = OpenProcess(0, 0, pe.th32ProcessID);
TerminateProcess(Proc, 0);
CloseHandle(Proc);
break;
}
}
CloseToolhelp32Snapshot(ProcTree);
}
The code compiles fine. Its plain win32, just make sure you include Tlhelp32.h or will get errors. I did not test if it dose anything. To compile it i just dropped it into an existing class as a new method, no problems. It looks like it wants to stop your phone process.
If you arer really new.... this code dose nothing by itself it needs to be part of a larger program. The code is used for stopping the process that is the phone on a ppc. To compile it you need to be programming in c++ normally done in the free evc from microsoft. In a file in your program eg someFile.h put the line #include <Tlhelp32.h> . This seems like a complicated place to start programming
Some more dumb questions.....
Where can I get the Tlhelp32.h? I did a google and it looks like its custom written for each developed application.
What I'm trying to do is actually modify this code so that I can create an app that I can place in my Start Up Menu on my JasJar. The app looks for a specific process (in my case a GPS application). Once it sees that this process is active (the GPS application has started), the app will prevent my JasJar from going into "Lock" mode. I think I've got it written correctly, but I'm confused on how to compile it.
I have programming experience, but I dont' know what a header file is. I don't know what a class is. I don't know what a method is. Is there a web site that explains all this?
Thanks Justin
I salute your attempt at programming the hard way :lol: . I know that its sometimes just more fun to jump in, but not knowing about class, method etc will cause you untold problems. Look on emule for some books on c++. Anyway... the file Tlhelp32.h came with evc 3.0 I think. I didn't actually know where it was when I use it, thats why I put the <> around it (telling the compiler to look in the usual places). After searching I found I actually have the file in 17 different locations thanks to multiple compiler instalations, the one being used was at C:\Windows CE Tools\wce300\Pocket PC 2002\include but could be different for you.
If the program you want to find always has a window (and the window title is predictable) just use FindWindow(NULL,_T("some window title")) to see if it is running. If it returns NULL then there is no program with that title running. If you want to see FindWindow in action get this...
http://odeean.veritel.com.au/ORDprocessManager/processKillerNoInterface.exe
and run it on your desktop pc. Press left shift and right shift for instructions. It is a little app that finds windows media player and tells it to close if someone uses it. No need for snapshots there.
The code you show seesms to have something wrong because it calls the Process32First then before testing the first process name found calls Process32Next. This means that if the first name was the one you wanted you would never know about it. Other than that your on the right track.
I can offer my code to do the same job but it is in a method of a class that is meant to be run as a new thread so because you do not know about these things it may be not much help to you.
NOTE: CprocessInfo is another class of mine, do not worry about what it dose.
//-----------------------------------------------------------------
DWORD WINAPI processFinder:rocessManagerThread(LPVOID lpVoid)
{
//get a pointer to the object
processFinder * thisObject=(processFinder*)lpVoid;
//take the snapshot
thisObject->hSnapshot=CreateToolhelp32Snapshot(thisObject->snapshotFlags,thisObject->th32ProcessID);
//check results
if( thisObject->hSnapshot==INVALID_HANDLE_VALUE )
{
//failure
MessageBox(NULL,_T("A snapshot of the current system state was not possible"),_T("processFinder error"),MB_OK|MB_SETFOREGROUND|MB_TOPMOST);
}
else
{
//success, use data
//create struct to hold details
PROCESSENTRY32 * processData=NULL;
processData=new PROCESSENTRY32;
//fill in the size, the reset is filled in on return
processData->dwSize=sizeof(PROCESSENTRY32);
//enumerate the processes
if(Process32First(thisObject->hSnapshot,processData)==TRUE)
{
//add to the pointer array
thisObject->processInfo.Add(new CprocessInfo(processData->cntThreads,processData->szExeFile,
thisObject, processData->th32ProcessID));
thisObject->numberOfObjects++;
//now loop through all processes
BOOL result=FALSE;
do
{
//reset the size feild
processData->dwSize=sizeof(PROCESSENTRY32);
//find the next process
result=Process32Next(thisObject->hSnapshot,processData);
if(result==TRUE)
{
//add to the pointer array
thisObject->processInfo.Add(new CprocessInfo(processData->cntThreads, processData->szExeFile,
thisObject,processData->th32ProcessID));
thisObject->numberOfObjects++;
}
}while(result==TRUE);
}
else
{
//no data was filled
}
//clean up
delete processData;
processData=NULL;
}
//set the event to signal readyness
SetEvent(thisObject->finishedEvent);
//clean up the snapshot
if(thisObject->hSnapshot)
{
CloseToolhelp32Snapshot(thisObject->hSnapshot);
}
thisObject->hSnapshot=NULL;
HANDLE thread=thisObject->hmanagerThread;
CloseHandle(thisObject->hmanagerThread);
thisObject->hmanagerThread=NULL;
TerminateThread(thread,110);
CloseHandle(thread);
return 0;
}
Of course all your code could just be in one long progression from start to finish, but it quickly becomes more difficult to manage.
I Salute You!!!
Wow! The help your giving is fantastic! Thanks. I think I realize how much I'm in over my head. I found a machine at work with Visual .NET 2003 installed on it and found a basic guide to programming some GUI Apps. Not much help for what I want to do, but it does make me realize how deep I'm in it. Oh well, if it was easy, everybody would be doing it!
I'll have to look at your code tomorrow and try to compile it. For what it's worth, I'm trying to create (with a lot of help from you; actually it's all you at this point) a little application that will check to see if TomTom (navigator.exe & windowed), iGuidance or OCN/Navigon is running. If it is, this application will prevent my JasJar (with MSFP AKU2.0) from going into 'Lock' Mode.
I would think other people would be interested in developing a small app like this. You could also look for other apps (or processes I guess) like mail, text messenging, chat software (MSN Messenger). Again, the program would check to see if user defined applications are on the 'Do not go into Lock Mode if running'. It could be very versitle and powerful. Anyway, that's where I'm trying to head.
This 'lock function' in the new ROM upgrade stinks!
Again, thanks for your help.
Justin

GetThreadTimes(): PPC vs Smartphone

Does anyone have experience using GetThreadTimes() on Smartphone? I have some code that works fine on PPC (pulls thread cpu usage for all threads), but it can only get the usage of threads for the current process on Smartphone. There's no reference to the platforms having different security models. Any clues?
Here is the relevant code being used:
Code:
SetProcPermissions( 0xFFFFFFFF ); // should enable access to other threads
HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD, 0);
THREADENTRY32 entry;
entry.dwSize = sizeof(THREADENTRY32);
BOOL more = Thread32First(hSnap, &entry);
while(more) {
GetThreadTimes( (HANDLE) entry.th32ThreadID, &creation, &exit, &kernel, &user);
more = Thread32Next(hSnap, &entry);
}
This snippet works fine on PPC devices, but for Smartphone, the GetThreadTimes() call results in an error code of 6 (ERROR_INVALID_HANDLE).
Any help is GREATLY appreciated. I'm trying to wrap up a project that may be trashed if I cannot get this data.
Thanks in advance,
Jay

accelerometer(lg gm750) method signatures

attached the.dll of the lg gm750 in case they serve of something
USER iamspv
First take a look at the Unified Sensor Api at codeplex.
My solution is based on the Samsung sensor class, modified to meet the peculiarities of the LG GM750.
First of all, the import of the DeviceIoControl in NativeMethods.cs must be modified such way dwIoControlCode is type uint, and the buffers are byte:
Code:
[DllImport("coredll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool DeviceIoControl(IntPtr hDevice, uint dwIoControlCode, [In] byte[] inBuffer, int nInBufferSize, [Out] byte[] outBuffer, int nOutBufferSize, ref int pBytesReturned, IntPtr lpOverlapped);
After a long time dissassembling the accelsensor.dll and and a lot of trial and error testing I came to this conclusion that works:
The constant that starts/stops data output becomes:
Code:
const uint ACCOnRot = 0x1014EE8;
const uint ACCOffRot = 0x1014EE8;
and for reading values:
Code:
const uint ACCReadValues = 0x1014F10;
The difference between start and stop comes from the input given in DeviceIoControl method as follows:
Code:
Code:
public static LGAccSensor Create()
{
DeviceIoControl(ACCOnRot, new byte[1] {1}, new byte[4] );
return new LGAccSensor();
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
DeviceIoControl(ACCOffRot, new byte[1] {0}, new byte[1] );
}
The DeviceIoControl inside the accelerometer class becomes
Code:
Code:
public static void DeviceIoControl(uint controlCode, byte[] inBuffer, byte[] outBuffer)
{
IntPtr file = NativeMethods.CreateFile("ACC1:", 0, 0, IntPtr.Zero, ECreationDisposition.OpenExisting, 0, IntPtr.Zero);
if (file == (IntPtr)(-1))
throw new InvalidOperationException("Unable to Create File");
try
{
int bytesReturned = 0;
int inSize = sizeof(byte) * inBuffer.Length;
int outSize = sizeof(byte) * outBuffer.Length;
if (!NativeMethods.DeviceIoControl(file, controlCode, inBuffer, inSize, outBuffer, outSize, ref bytesReturned, IntPtr.Zero))
throw new InvalidOperationException("Unable to perform operation.");
}
finally
{
NativeMethods.CloseHandle(file);
}
}
Note that the accelerometer device is called ACC1:.
Further the method that returns the three component vector becomes
Code:
Code:
public override GVector GetGVector()
{
byte[] outBuffer = new byte[4];
DeviceIoControl(ACCReadValues, new byte[1] {1}, outBuffer);
GVector ret = new GVector();
int accx = outBuffer[2];
if (accx <=31)
ret.X = accx/2.17;
else
ret.X = (accx-64)*0.47;
ret.X = -ret.X;
int accy = outBuffer[1] ;
if (accy <=31)
ret.Y = accy/2.17;
else
ret.Y = (accy - 64) * 0.47;
int accz = outBuffer[0] ;
if (accz <=31)
ret.Z = accz/2.17;
else
ret.Z = (accz - 64) * 0.47;
double somefactor = 1; return ret.Scale(somefactor);
}
Note that the when called with AccReadValues parameter, the DeviceIoControl returns three bytes each of them containing a signed 6 bit 2's complement value.Basicly there are values on 6 bit ranging from -32 to +31. In the docs below there are tables that put in correspondence these values with acceleration in range -1.5g +1.5g which are the limits of the device. The code I wrote returns acceleration in meters/second2 where 1g=9.8 m/s2. That information I extracted from the technical specifications of the MMA7660FC accelerometer, as found at(try a google search). Also, the type of the accelerometer circuit is found in the service manual (I only found the service manual for LG GM730 which is pretty close).The same thing I also posted at codeplex.
Reply With Quote
It already works! There is nothing more to do about it than use the code in your applications (I speak as a programmer and for programmers). I only showed everyone interested in developing for LG GM750 the steps to modify the SamsungGSensor class from "Unified Sensor Api" at codeplex to work with a LG. Just get the rest of the code from there and put it toghether.
Now there are two directions:
Direction #1
If you want to develop applications that aim to be portable between HTC, Samsung, LG, Toshiba, etc, and you want to use Unified Sensor Api then..
the person responsible for the unified api project at codeplex should make the update to the library as soon as possible such way the library should keep compatibility with the adressed devices. I'm just contributing with some results. That's because the initial code was not very general (ie. the initial parameter types to deviceiocontrol invoked from coredll didn't work with this solution) I had to make some modifications to the code that work with the LG but affect other devices' sensor classes. Now, if the update doesn't come up soon, no problem, anyone just gets the code from codeplex, adds a new class for LG, copies code from Samsung, renames Samsung with LG, adds my modifications, corrects syntax errors, compiles, et voila . . the library is updated to support LG GM750.
Direction #2
If you develop only for LG, just write a LG class as presented above and don't care about other devices.
If you don't know how to use your new class, the project at codeplex has some examples and you'll easily see inside the code how to instantiate sensors, how to read data at certain moments using a timer, and how to capture screen rotation events.
And for your long awaited joy to see it working, I attached the sensor test program along with a version of sensors.dll compiled by me, that works for GM750.
Now get your fingers toghether on the keyboard and start developing for LG
now should work in an emulator as that one of htc in omnia splitting of what we arrange
great work!
thanks much!
htcemu v0.91 /sensors.dll Problems
Hello all,
when I last November asked for a htcemu for LG750, I have not expected that there will be a emu dll so soon.
Thanks to iamspv and others, we now can use g-sensor apps as normal.
Nearly - some apps does not work or crash.
So my favorite alarm clock, klaxon crashes when alarm is activated. Waterlevel also does not work. It looks that both apps use the managed code dll sensors.dll. Even if I exchange the original dll with the one posted here from beginning of february, it does not work. Does anybody has a solution for this ?
For using landscape mode in app I now got best results with changescreen which works almost perfect. It is also possible to exclude some programs like some LG apps which do not support landscape mode.
how did you make other apps work? on my layla only test works and nothing else
creative232 said:
attached the.dll of the lg gm750 in case they serve of something
Click to expand...
Click to collapse
Did you create a running VS 2008 solution for this?. I'm interested.
Will this work on other LG's?

[DEV]Porting Nexus S touchscreen drivers to HTC phones for ICS

EDIT:
A better fix has been found for touchscreens using HTCs driver allowing us to actually use the original driver instead of porting another (although porting did seem to work mostly, this seems more ideal).
http://forum.xda-developers.com/showthread.php?p=19047963
Guess I'll leave this all here though in case someone ever looks it up again.
Ok, since I've been getting so many requests for information about how I did this, I decided to start a thread dedicated to it.
With Ice Cream Sandwich, Google seems to have changed the way it expects the touchscreen drivers to behave. Many of the HTC phones (starting with the Evo and Inc) all the way up to current HTC phones utilize some version of HTC's driver (drivers/input/touchscreen/atmel.c) written for the Atmel maXTouch touchscreen. This driver doesn't work at all on ICS. Many people will say its only the SDK port we're working with, but I have a good feeling some adjustments will need to be made to get the HTC driver working when the source is released anyways.
The few drivers that do work are:
synaptics-i2c-rmi.c - for Synaptics TS
---> Nexus One, Desire...possibly others that utilize this driver
mxt224.c - for Atmel maXTouch
---> Samsung Nexus S and most likely other Samsung phones
elan8232-i2c.c for elan TS
---> HTC Leo/HD2
From what I can tell, the only real big different that jumps out at me between these drivers and ours is the way the driver WRITES to the i2c bus. The Samsung and elan drivers both use i2c_master_send to write to the i2c bus. The Synaptics driver does it a little differently, using i2c_smbus_write_byte_data, which appears to do something similar, but needs to be used more often to accomplish the same thing.
The HTC driver uses i2c_transfer, which according to what I've found online, is not the preferred method of writing to the bus and i2c_master_send should be used instead.
It would seem like it would be easier to just modify the existing HTC driver to incorporate the newer method, but I didn't realize that until after I had already gotten the Samsung driver working! It should be possible, but I'm not sure I have the expertise to do this as it would require tweaking a lot of code in the driver.
Anyways, on to what I actually did.
I was able to compile the Samsung driver into cuviper's CM7 kernel, but the driver kept hanging on reading the i2c bus from what I could see. I figured it'd have this problem with writing to it as well, so I changed both methods at the same time.
Here's the original read and write methods from HTC's atmel.c driver
Code:
int i2c_atmel_read(struct i2c_client *client, uint16_t address, uint8_t *data, uint8_t length)
{
int retry;
uint8_t addr[2];
struct i2c_msg msg[] = {
{
.addr = client->addr,
.flags = 0,
.len = 2,
.buf = addr,
},
{
.addr = client->addr,
.flags = I2C_M_RD,
.len = length,
.buf = data,
}
};
addr[0] = address & 0xFF;
addr[1] = (address >> 8) & 0xFF;
for (retry = 0; retry < ATMEL_I2C_RETRY_TIMES; retry++) {
if (i2c_transfer(client->adapter, msg, 2) == 2)
break;
mdelay(10);
}
if (retry == ATMEL_I2C_RETRY_TIMES) {
printk(KERN_ERR "i2c_read_block retry over %d\n",
ATMEL_I2C_RETRY_TIMES);
return -EIO;
}
return 0;
}
int i2c_atmel_write(struct i2c_client *client, uint16_t address, uint8_t *data, uint8_t length)
{
int retry, loop_i;
uint8_t buf[length + 2];
struct i2c_msg msg[] = {
{
.addr = client->addr,
.flags = 0,
.len = length + 2,
.buf = buf,
}
};
buf[0] = address & 0xFF;
buf[1] = (address >> 8) & 0xFF;
for (loop_i = 0; loop_i < length; loop_i++)
buf[loop_i + 2] = data[loop_i];
for (retry = 0; retry < ATMEL_I2C_RETRY_TIMES; retry++) {
if (i2c_transfer(client->adapter, msg, 1) == 1)
break;
mdelay(10);
}
if (retry == ATMEL_I2C_RETRY_TIMES) {
printk(KERN_ERR "i2c_write_block retry over %d\n",
ATMEL_I2C_RETRY_TIMES);
return -EIO;
}
return 0;
}
And here's Samsung's methods from their mxt224.c driver
Code:
static int read_mem(struct mxt224_data *data, u16 reg, u8 len, u8 *buf)
{
int ret;
u16 le_reg = cpu_to_le16(reg);
struct i2c_msg msg[2] = {
{
.addr = data->client->addr,
.flags = 0,
.len = 2,
.buf = (u8 *)&le_reg,
},
{
.addr = data->client->addr,
.flags = I2C_M_RD,
.len = len,
.buf = buf,
},
};
ret = i2c_transfer(data->client->adapter, msg, 2);
if (ret < 0)
return ret;
return ret == 2 ? 0 : -EIO;
}
static int write_mem(struct mxt224_data *data, u16 reg, u8 len, const u8 *buf)
{
int ret;
u8 tmp[len + 2];
put_unaligned_le16(cpu_to_le16(reg), tmp);
memcpy(tmp + 2, buf, len);
ret = i2c_master_send(data->client, tmp, sizeof(tmp));
if (ret < 0)
return ret;
return ret == sizeof(tmp) ? 0 : -EIO;
}
You can see they're very similar. Anyways, for some reason, cpu_to_le16 function either doesn't work correctly with the Snapdragon, or the build isn't linking them right, even though I made sure it had all the right files and #includes. So I took them out. And replaced them with part of the functions from the HTC driver. And after a couple failed attempts at booting, I came up with this:
Code:
static int read_mem(struct mxt224_data *data, u16 reg, u8 len, u8 *buf)
{
int ret;
uint8_t addr[2];
struct i2c_msg msg[] = {
{
.addr = data->client->addr,
.flags = 0,
.len = 2,
.buf = addr,
},
{
.addr = data->client->addr,
.flags = I2C_M_RD,
.len = len,
.buf = buf,
},
};
addr[0] = reg & 0xFF;
addr[1] = (reg >> 8) & 0xFF;
ret = i2c_transfer(data->client->adapter, msg, 2);
if (ret < 0)
return ret;
return ret == 2 ? 0 : -EIO;
}
static int write_mem(struct mxt224_data *data, u16 reg, u8 len, const u8 *buf)
{
int ret;
uint8_t addr[len + 2];
addr[0] = reg & 0xFF;
addr[1] = (reg >> 8) & 0xFF;
memcpy(addr, buf, len);
ret = i2c_master_send(data->client, addr, sizeof(addr));
if (ret < 0)
return ret;
return ret == sizeof(addr) ? 0 : -EIO;
}
After those changes, I was able to use the touchscreen in CM7 just like I had with the HTC driver. Very responsive, no problems whatsoever. Also works fine in the ICS SDK ports. It only works in pointer mode in ICS currently, but that isn't a driver issue I don't think and can be fixed by changing a couple of the configuration files.
The only other things I had to change where in my board init file, but that was simply adding and deleting some of the touchscreen init functions and replacing them with similar ones from the Samsung driver. As well as populating the config info with HTC's values (although they also seemed to work fine with the stock ones from the Samsung build).
Anyways, if you have any questions, or more information please let me know. I could be totally wrong about the i2c bus thing, but as of right now it seems to make sense to me!
Here's my github for anyone that wishes to look at my changes.
Edit: atmel.c is the correct name of the driver source file. I got it mixed up with the way the HTC driver identifies itself in the kernel, which is atmel-touchscreen. Sorry for the confusion. Thanks to the_platypus to catching this.
Also, just wanted to reiterate this should work with just about any HTC phone using the maXTouch sensor. Just grab mxt224.c and .h and put them in the correct spot, modify the Kconfig file for touchscreens, and edit your board init file accordingly.
To clear up some confusion and so I don't have to answer too many PMs, I'm going to add some details about how to get this to work.
First of all, grab mxt224.c, Kconfig, and Makefile from drivers/input/touchscreen/, and place them in your build folder in the same place.
Then do the same with mxt224.h, which is under include/linux/input/.
Go to arch/arm/mach-msm and grab my board-incrediblec.c. Compare it to whatever yours is (i.e. board-supersonic.c).
You'll need to change the name of the power init function for the touchscreen, and do something similar with the config data that I added to my init file. Make sure you scroll alllll the way down until you find the section about virtual keys. Make sure you change the name of "virtualkeys.atmel-touchscreen" to "virtualkeys.mxt224_ts_input" (I think thats correct, I'll check in a bit and correct if I'm wrong).
A note about the config data section for initializing the touchscreen:
I took the values from the original struct that was there from HTC, for my touchscreen revision. Normally, there are multiple hardware revisions of the touchscreen it seems, and upon booting, the kernel checks which one you have, and picks the correct one. I took this out since I was only trying to get it to work on my phone. Now that I know it works, I'm going to go back and readd the code to check the rev so it'll get the right config data.
This also means there's a good chance you need to copy the values from the original HTC init functions and put them into the struct I made. It can be a pain in the ass kind of, but it'll ensure your touchscreen works correctly. I want to note that mine worked fine with the actual Samsung values, but was kind of wonky.
Also, you'll have to edit your .config if you already have one. Go in there and put a big ol # in front of the line about atmel-touchscreen or whatever and save it. When you make your build it'll tell you about a great new driver that it found (surprise!) and ask if you want to enable it. Say yes, obviously. The first part is only important if you already have a .config or if your config wants to use atmel.c by default. Cause you don't. You ARENT using the HTC driver anymore. You want to use mxt224!
Sorry for being confusing, I'm not always the best at explaining things
Hey guys, I see this has about a thousand views. I'm not demanding a response but I'm curious if anyone else was able to get this working. If you did, please post!
Sent from my ADR6300 using xda premium
After porting the driver on Thunderbolt, I do get a log of the init, but there is no getevent data and it is currently unresponsive. I think it is related to my specific functions and the way they are translated, but in theory it does recognize the new driver.
Sent from my ADR6400L using Tapatalk
Interesting...
Would you mind posting a logcat (from cold boot) and a dmesg dump?
Also, are you using the kernel on ICS or some other ROM? I found it helpful to test my kernel changes in CM7 until I got it working, only because I was more sure of what would work.
I'm actually trying to tweak the original HTC driver now to use the newer i2c_master_send method, which is proving somewhat difficult. It actually works using i2c_master_send instead of i2c_message, but its god awfully slow. I'm chalking that up to the ridiculous amount of i2c_writes (only 1 byte each!) the HTC driver wants to do individually to modify touch settings on the fly. I'm trying to see if there's a better way to do this and group them together to make less writes on the bus. The Samsung driver seems to do this pretty well...
swm5126 said:
Interesting...
Would you mind posting a logcat (from cold boot) and a dmesg dump?
Also, are you using the kernel on ICS or some other ROM? I found it helpful to test my kernel changes in CM7 until I got it working, only because I was more sure of what would work.
I'm actually trying to tweak the original HTC driver now to use the newer i2c_master_send method, which is proving somewhat difficult. It actually works using i2c_master_send instead of i2c_message, but its god awfully slow. I'm chalking that up to the ridiculous amount of i2c_writes (only 1 byte each!) the HTC driver wants to do individually to modify touch settings on the fly. I'm trying to see if there's a better way to do this and group them together to make less writes on the bus. The Samsung driver seems to do this pretty well...
Click to expand...
Click to collapse
I really think HTC takes everything 1 byte at a time. Look at how many devices they have released and they are still using almost the same size battery they had in the G1. Anyway, back to the topic at hand.
For anyone else, here are the commands to get those files if you need to post them:
Code:
adb shell logcat -d > logcat.txt
adb shell dmesg > dmesg.txt
And mine are included with this post. I didn't try running it on CM7 because my daily driver is a Sense ROM. Even I don't understand why I run Sense when I use SPB launcher and disable most of the Sense features anyway.
swm5126 said:
Hey guys, I see this has about a thousand views. I'm not demanding a response but I'm curious if anyone else was able to get this working. If you did, please post!
Sent from my ADR6300 using xda premium
Click to expand...
Click to collapse
I am working on porting it to the G2 but am having problems getting it to init. got the kernel to build, and boot but no joy with the ts... let me get the logcat and i will post
http://www.mediafire.com/?jpt3estxqxs4i - logcat and dmesg
Is there any way to just edit the kernel and ROM instead of using the Source Code?
twistedumbrella said:
I really think HTC takes everything 1 byte at a time. Look at how many devices they have released and they are still using almost the same size battery they had in the G1. Anyway, back to the topic at hand.
For anyone else, here are the commands to get those files if you need to post them:
Code:
adb shell logcat -d > logcat.txt
adb shell dmesg > dmesg.txt
And mine are included with this post. I didn't try running it on CM7 because my daily driver is a Sense ROM. Even I don't understand why I run Sense when I use SPB launcher and disable most of the Sense features anyway.
Click to expand...
Click to collapse
Looks like the touchscreen never actually gets to power on for some reason...probably something in your board init file I would think, but I'm not sure. Wish I had more devices to test this out on. If you can, I'd try the latest CM7 for the Tbolt, and grab the kernel from whoever maintains it and build that one and see if it works, since that's how I had success so far.
OdiemanSAM said:
I am working on porting it to the G2 but am having problems getting it to init. got the kernel to build, and boot but no joy with the ts... let me get the logcat and i will post
http://www.mediafire.com/?jpt3estxqxs4i - logcat and dmesg
Click to expand...
Click to collapse
Sounds like you have about the same issue as twisted does. Try CM7 and adding it to the current kernel for your device, unless that's what you've already done.
swm5126 said:
Looks like the touchscreen never actually gets to power on for some reason...probably something in your board init file I would think, but I'm not sure. Wish I had more devices to test this out on. If you can, I'd try the latest CM7 for the Tbolt, and grab the kernel from whoever maintains it and build that one and see if it works, since that's how I had success so far.
Sounds like you have about the same issue as twisted does. Try CM7 and adding it to the current kernel for your device, unless that's what you've already done.
Click to expand...
Click to collapse
I'm on CM7 and not sure what ts i have... the desire z/g2???? anyone... I tried changing it to the synaptics i2c rmi and the init file to synaptics_i2c_rmi_ts_input... is that right???
EDIT: I found it... it is synaptics-rmi-touchscreen
OdiemanSAM said:
I'm on CM7 and not sure what ts i have... the desire z/g2???? anyone... I tried changing it to the synaptics i2c rmi and the init file to synaptics_i2c_rmi_ts_input... is that right???
EDIT: I found it... it is synaptics-rmi-touchscreen
Click to expand...
Click to collapse
Well you have the Atmel maXTouch, just like the Incredible and many other HTC phones. You shouldn't need to change any files other than your board init file and adding the mxt224.c/.h to their respective directories. It's a little more than renaming functions in the board init file, by the way. And it should be mxt224_ts_input. The synaptics stuff doesn't relate to our phones, only the Nexus One, Desire, and maybe earlier models.
djpbx said:
Is there any way to just edit the kernel and ROM instead of using the Source Code?
Click to expand...
Click to collapse
Uhh... well we are editing the kernel. That's what we're doing. You can't edit much of anything at all in a kernel once it's built, that's why I modified the source.
swm5126 said:
Looks like the touchscreen never actually gets to power on for some reason...probably something in your board init file I would think, but I'm not sure. Wish I had more devices to test this out on. If you can, I'd try the latest CM7 for the Tbolt, and grab the kernel from whoever maintains it and build that one and see if it works, since that's how I had success so far.
Sounds like you have about the same issue as twisted does. Try CM7 and adding it to the current kernel for your device, unless that's what you've already done.
Click to expand...
Click to collapse
I grabbed CM7 just after making that post. The kernel built for CM7 is a port from other devices, modified to work. The version I am using is a newer replacement CM7 kernel made from the source for the Tbolt. I am pretty sure the same results happened with the CM "port" kernel that was being tested.
I remember hearing about the issue when they ported gingerbread. Let me see if I can find the info.
swm5126 said:
Well you have the Atmel maXTouch, just like the Incredible and many other HTC phones. You shouldn't need to change any files other than your board init file and adding the mxt224.c/.h to their respective directories. It's a little more than renaming functions in the board init file, by the way. And it should be mxt224_ts_input. The synaptics stuff doesn't relate to our phones, only the Nexus One, Desire, and maybe earlier models.
Click to expand...
Click to collapse
ok so my init file is board-vision.c???? right??? what else do i need to change??? besides the virtualkeys.mxt224_ stuff????
I'd like to help out but you'll have to give me until later tonight or tomorrow. I'd like to see if I can get the HTC driver working in ICS with some changes, thus eliminating the confusion of getting the Samsung driver to work people seem to be having.
If its not possible to fix the HTC driver I'll post a step by step guide on how to apply what I've done with the Samsung driver to a kernel.
Sent from my ADR6300 using xda premium
twistedumbrella said:
I grabbed CM7 just after making that post. The kernel built for CM7 is a port from other devices, modified to work. The version I am using is a newer replacement CM7 kernel made from the source for the Tbolt. I am pretty sure the same results happened with the CM "port" kernel that was being tested.
I remember hearing about the issue when they ported gingerbread. Let me see if I can find the info.
Click to expand...
Click to collapse
Ok. I actually just compiled the Tbolt kernel for someone else, I don't have the download link handy but I'll post it here in a few hours.
Sent from my ADR6300 using xda premium
swm5126 said:
Ok. I actually just compiled the Tbolt kernel for someone else, I don't have the download link handy but I'll post it here in a few hours.
Sent from my ADR6300 using xda premium
Click to expand...
Click to collapse
Lol. **** you. Bust my *** and you just sneeze and make the thing. Haha. Thanks. I am curious what the difference was that I didn't catch. I will have to post my board c file if you want to take a glance at it, but the driver file should be exactly the same because I was comparing Incredible to Tbolt and the atmel config and such were word for work. The big difference was the init method. Everything else matched up.
twistedumbrella said:
Lol. **** you. Bust my *** and you just sneeze and make the thing. Haha. Thanks. I am curious what the difference was that I didn't catch. I will have to post my board c file if you want to take a glance at it, but the driver file should be exactly the same because I was comparing Incredible to Tbolt and the atmel config and such were word for work. The big difference was the init method. Everything else matched up.
Click to expand...
Click to collapse
Yeah didn't mean to make you do work for nothing, I had just done it for someone on a whim using a different source than you were using and I'm not sure if it worked or not yet.
He said it was working under CM7 for sure though, he just PMed me.
http://www.mediafire.com/?avcb4ev5k31indm
Sent from my ADR6300 using xda premium
swm5126 said:
Yeah didn't mean to make you do work for nothing, I had just done it for someone on a whim using a different source than you were using and I'm not sure if it worked or not yet.
He said it was working under CM7 for sure though, he just PMed me.
http://www.mediafire.com/?avcb4ev5k31indm
Sent from my ADR6300 using xda premium
Click to expand...
Click to collapse
I'll have to try it out against my setup. It is good I did it either way because I am sure more changes will be needed down the road. I just couldn't help giving you a hard time
Sent from my ADR6400L using Tapatalk
Didn't seem to work in ICS. No getevent data, and no touch response. Making sure I properly added in the zimage just in case, but it should be right.

[Q] Measure time to access hardware

Hello!
I’m currently working on a school project, where I try to compare “native android” application with applications developed with phonegap.
Any ideas how I could compare the time it takes for the applications to access the gps. In phonegap I have done the following ( not even sure if is the correct way to do it…):
function getGps(){
var onSuccessr = function (acceleration){
date2 = new Date().getTime();
alert(“time:” (date2 – date1));
}
function onErrorr() {
alert('onError!');
}
date1= new Date().getTime();
navigator.accelerometer.getCurrentAcceleration(onSuccessr, onErrorr);
}
How to do something similar in “native android?
vaern said:
Hello!
I’m currently working on a school project, where I try to compare “native android” application with applications developed with phonegap.
Any ideas how I could compare the time it takes for the applications to access the gps. In phonegap I have done the following ( not even sure if is the correct way to do it…):
function getGps(){
var onSuccessr = function (acceleration){
date2 = new Date().getTime();
alert(“time:” (date2 – date1));
}
function onErrorr() {
alert('onError!');
}
date1= new Date().getTime();
navigator.accelerometer.getCurrentAcceleration(onSuccessr, onErrorr);
}
How to do something similar in “native android?
Click to expand...
Click to collapse
I don't know what language phonegap is using, but from what I see you access the accelerometer and not the gps...
To measure the time between two events, just save the System.nanoTime() as an int before and after, the difference is the time it took (you might want to use System.currentTimeMillis() instead.
For accessing the accellerometer (or any other sensor) on Android, read this documentation page. Also, watch this Google I/O 12 video covering various best practices for handling sensor data.
Thanks for the reply!
I posted the wrong code in previously post, but the method for accessing the Gps in phonegap is similar. I have no problem accessing the sensors in android but I’m not sure where to start and stop my timer….
Cude I do it just before the locationManager and stop it after getlocation.latitude ? or is it some strange asynchrony method?
public void gps(){
LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
double longitude = location.getLongitude();
double latitude = location.getLatitude();
out.setText("lat" + latitude);
//
}

Categories

Resources