Jump to content

Multitouch possible in theory?


Guest lemmyc

Recommended Posts

Guest BigBearMDC

Hey guys

I'm now updating my distro, hopefully this will fix my problems.

BTW I patched the driver once more, hopefully this will solve the offset problem!

Greetings,

BigBear

Link to comment
Share on other sites

Guest minid33
Hey guys

I'm now updating my distro, hopefully this will fix my problems.

BTW I patched the driver once more, hopefully this will solve the offset problem!

Greetings,

BigBear

I hope that solves your problem; seeing whats posted so far it looks like you're both close to a workable alpha build. I'm really looking forward to getting my hands on what you make. I'd be happy to do any mundane (or not so mundane) testing you want doing, if you would like me to. I'd love to help out with the code but I lack enough knowledge and experience, maybe I could learn by debugging.

Link to comment
Share on other sites

Guest John Hamelink
I hope that solves your problem; seeing whats posted so far it looks like you're both close to a workable alpha build. I'm really looking forward to getting my hands on what you make. I'd be happy to do any mundane (or not so mundane) testing you want doing, if you would like me to. I'd love to help out with the code but I lack enough knowledge and experience, maybe I could learn by debugging.

Same here. I am a web developer, and I know a little C++, so I may be able to help you tweak <_<

Link to comment
Share on other sites

Guest BigBearMDC
Same here. I am a web developer, and I know a little C++, so I may be able to help you tweak <_<

Thank you all!

I already uploaded the driver, if you want to have a look at it :mellow:

Okay, distro is now karmic koala, gcc is 4.4.1, boot.img is screwed up -.-

I now uninstalled gcc-4.3, hopefully it works now.

Otherwise I'll have to install Ubuntu once again :(

Greetings,

BigBear

Link to comment
Share on other sites

Guest BigBearMDC

Haha, guess what - reboot -.-

This is so annoying ... I'd really like to kick my pc out of the window...

@xangma

Could you please tell me exactly what you have installed on your PC?

I'll reinstall the whole environment.

To make things easier, here's my ts_work_func:

static void synaptics_ts_work_func(struct work_struct *work)
{
int i;
int ret;
int bad_data = 0;
struct i2c_msg msg[2];
uint8_t start_reg;
uint8_t buf[15];
uint16_t x, y;
uint8_t z;
int32_t w;
uint8_t finger;
uint8_t gesture;
uint8_t magnitude;
static uint16_t last_x = 0;
static uint16_t last_y = 0;
static bool is_first_point = true;
int x2;
int y2;
int finger2_pressed;
struct synaptics_ts_data *ts = container_of(work, struct synaptics_ts_data, work);

msg[0].addr = ts->client->addr;
msg[0].flags = 0;
msg[0].len = 1;
msg[0].buf = &start_reg;
start_reg = 0x00;
msg[1].addr = ts->client->addr;
msg[1].flags = I2C_M_RD;
msg[1].len = sizeof(buf);
msg[1].buf = buf;
SYNAPITICS_DEBUG("synaptics_ts_work_func\n");
input_set_abs_params(ts->input_dev, ABS_TOOL_WIDTH, 0, 15, 0, 0);

for (i = 0; i < ((ts->use_irq && !bad_data) ? 1 : 10); i++) {
ret = i2c_transfer(ts->client->adapter, msg, 2);
if (ret < 0) {
SYNAPITICS_DEBUG(KERN_ERR "synaptics_ts_work_func: i2c_transfer failed\n");
bad_data = 1;
} else {
bad_data = 0;
x = buf[5]; // | (uint16_t)(buf[4] & 0x1f) << 8; /* x aixs */
y = buf[3]; // | (uint16_t)(buf[2] & 0x1f) << 8; /* y aixs */
z = buf[1]; /* pressure */
w = buf[0] >> 4; /* width */
finger = buf[0] & 7; /* numbers of fingers */
gesture = buf[6]; /* code of gesture */
magnitude = buf[7]; /* enhanced data of gesture */

x2 = buf[3+6] | (uint16_t)(buf[2+6] & 0x1f) << 8; /* x axis touch 2 */
y2 = buf[5+6] | (uint16_t)(buf[4+6] & 0x1f) << 8; /* y axis touch 2 */
finger2_pressed = 1;//finger > 1 && finger != 7;

SYNAPITICS_DEBUG("x = %d y = %d z = %d w = %d finger = %d gesture = %x magnitude = %d\n",
x, y, z, w, finger,gesture,magnitude);

if (z) {

if (!finger2_pressed) {
/* No multitouch -- force width to zero */;
//w = 0;
/* don't force width to zero, that causes weird behaviour of the device */

}
if (finger2_pressed) {
input_set_abs_params(ts->input_dev, ABS_TOOL_WIDTH, 0, 1, 0, 0);
/* Multitouch -- use midpoint between points as x,y */
int32_t dx, dy;

/* (x,y) coords for multitouch are at midpt between fingers */
dx = x - x2;
dy = y - y2;
x = (x + x2) / 2;
y = (y + y2) / 2;

/* We only need absolute distances */
if (dx < 0) dx = -dx;
if (dy < 0) dy = -dy;

/* We have 24 points of mantissa in a float (which
* ABS_TOOL_WIDTH gets converted into in a MotionEvent.size
* field). Use 12 for each of dx and dy. We assume the
* device never gives values larger than its reported
* max_x and max_y values.
*/
dx = ((1 << 12) - 1) * dx / TS_X_MAX; //max_x
dy = ((1 << 12) - 1) * dy / TS_Y_MAX; //max_y
w = (dx << 12) + dy;
//input_report_abs(ts->input_dev, ABS_HAT0X, pos[1][0]);
//input_report_abs(ts->input_dev, ABS_HAT0Y, pos[1][1]);
}

/*
* always report the first point whether slip or click
*/
if (is_first_point) {

input_report_abs(ts->input_dev, ABS_X, x);
input_report_abs(ts->input_dev, ABS_Y, 5880-y);
last_x = x;
last_y = y;
is_first_point = false;
}
else {
/*
* except the first point, also report the following points
* 1) x aixes is 3 larger or smaller than the last reported point
* 2) y aixes is 3 larger or smaller than the last reported point.
*
*/
if ((( x - last_x) >= TS_X_OFFSET)
|| ((last_x - x) >= TS_X_OFFSET)
|| ((y - last_y) >= TS_Y_OFFSET)
|| ((last_y - y) >= TS_Y_OFFSET)) {

input_report_abs(ts->input_dev, ABS_X, x);
input_report_abs(ts->input_dev, ABS_Y, 5880-y);
last_x = x;
last_y = y;

}
}
}
else
/*
* The next point must be first point whether slip or click after
* this up event
*/
is_first_point = true;


input_report_abs(ts->input_dev, ABS_PRESSURE, z);
input_report_abs(ts->input_dev, ABS_TOOL_WIDTH, w);
input_report_key(ts->input_dev, BTN_TOUCH, finger);
input_sync(ts->input_dev);
}

}
if (ts->use_irq) {
enable_irq(ts->client->irq);
SYNAPITICS_DEBUG("enable irq\n");
}
}[/codebox]

Greetings,

BigBear

Edited by BigBearMDC
Link to comment
Share on other sites

Guest BigBearMDC

,

I will do very soon. Problem is my girlfriend has just come back from being away and there's a computer ban on this weekend. How lame =P

Okay, I now made a backup of my data.

Ubuntu 9.10 is on my thumbdrive and I'm ready to setup my enviroment <_<

Greetings,

BigBear

Link to comment
Share on other sites

Guest BigBearMDC

Damn it!

Now I remember why I hate Linux!

This is happening to me the 3rd time!

Ubuntu screwed up my external drive, now all my data is lost <_<

Anyway @xangma:

Could you please tell me what to do to get the enviroment working?

:mellow:

Greetings,

BigBear

Link to comment
Share on other sites

Guest CHN-michael
Damn it!

Now I remember why I hate Linux!

This is happening to me the 3rd time!

Ubuntu screwed up my external drive, now all my data is lost <_<

Anyway @xangma:

Could you please tell me what to do to get the enviroment working?

:mellow:

Greetings,

BigBear

:( :D OMG....UBUNTU 9.10?

I always used Fedora or RHEL...

Link to comment
Share on other sites

Guest BigBearMDC
<_< :mellow: OMG....UBUNTU 9.10?

I always used Fedora or RHEL...

Really? I thought I read somewhere that Ubuntu is the most comfortable OS to compile Android with.

Greetings,

BigBear

Link to comment
Share on other sites

Guest Bakes
<_< :mellow: OMG....UBUNTU 9.10?

I always used Fedora or RHEL...

Ubuntu is the build environment recommended by Android.

What I'd say is that I believe it's Ubuntu 8.04 not 9.10 that is recommended (afaik), so maybe that would be a possible solution.

Link to comment
Share on other sites

Guest BigBearMDC
Ubuntu is the build environment recommended by Android.

What I'd say is that I believe it's Ubuntu 8.04 not 9.10 that is recommended (afaik), so maybe that would be a possible solution.

Hmm okay, I'll wait for xangma's enviroment configuration.

Greetings,

BigBear

Link to comment
Share on other sites

Guest BigBearMDC
Sorry =P Done though.

Wow, thats detailed, thanks <_<

But where did you get your toolchain from ?

I used the arm-eabi-4.4.0 toolchain form the android 1.6 source.

And which distro are you using?

Karmic?

Greetings,

BigBear

Link to comment
Share on other sites

Guest xangma
Wow, thats detailed, thanks <_<

But where did you get your toolchain from ?

I used the arm-eabi-4.4.0 toolchain form the android 1.6 source.

And which distro are you using?

Karmic?

Greetings,

BigBear

I got mine from the 2.0 source I think. It doesn't change though I don't think.

Ubuntu 9.10, is that what you meant by distro?

Link to comment
Share on other sites

Guest BigBearMDC
I got mine from the 2.0 source I think. It doesn't change though I don't think.

Ubuntu 9.10, is that what you meant by distro?

Yap.

Could you maybe upload your toolchain, please?

I'd otherwise have to re-download the 2.0 source on my own.

Greetings,

BigBear

Link to comment
Share on other sites

Guest xangma
Yap.

Could you maybe upload your toolchain, please?

I'd otherwise have to re-download the 2.0 source on my own.

Greetings,

BigBear

It's like 40 or 80mb or something, think you can download it separately with http somewhere.

EDIT: Will do it laters on though =] I think.

Edited by xangma
Link to comment
Share on other sites

Guest BigBearMDC
It's like 40 or 80mb or something, think you can download it separately with http somewhere.

EDIT: Will do it laters on though =] I think.

Okay, thanks!

I'll have alook at it in the meantime <_<

Link to comment
Share on other sites

Guest BigBearMDC
It's like 40 or 80mb or something, think you can download it separately with http somewhere.

EDIT: Will do it laters on though =] I think.

I can't find a toolchain thats working for me <_<

I downloaded one, but it doesn't even have all the necessary files.

Greetings,

BigBear

Link to comment
Share on other sites

Guest BigBearMDC

BTW my phone gets now recognized too <_<

Update:

Ok, I now downloaded the 2.0 source and I'll compile the kernel with its 4.4.0 toolchain.

Stay tuned!

Greetings,

BigBear

Edited by BigBearMDC
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.