Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Raspberry Pi / touchpad for raspberry pi from al old laptop? Its possible! (but i need help)

Author
Message
PAGAN_old
18
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 12th Jul 2018 16:36 Edited at: 16th Jul 2018 05:11
Hey guys. Havent been back here for a while (havent coded in years too so i look like chump to people here by now lol ), Good to see there is an RPI section now .
While not related directly to an RPI, i have been getting very frustraded with a thing i am working on for a RPI-based project. A trashy little netbook thing.

As i started building it i ran across this other dudes project similar to mine but less trashy so i followed that.
https://www.hackster.io/BuildItDR/raspberry-pi-and-arduino-laptop-bf50f5

One of the things i have a problem with is something the dude (not sure if the same guy) the guy made a seperate guide for it. A touchpad.

I gutted several old notebooks and to my surprise most of them are pretty common Synaptics or Alps touchpads (didnt find any documectation on the ALPS but i had better luck finding the pinouts to a synaptic pad).

In the process i learned that most older laptops keyboards and touchpads run on PS/2 and Raspberry pi dosent have PS/2

Thats where THIS guide comes in
https://www.hackster.io/BuildItDR/arduino-controlled-usb-trackpad-f443a6

Bought an Arduino to use as a usb microcontroller. The process is pretty much using the arduino to convert the PS/2 data into USB data and its pretty much the only thing i dont understand in depth right now because i played around with this code for weeks but i cannot beat it, The worst part is, the code works, just not the way its supposed to.





Its hard to explain without seeing it but the way this code is making the touchpad behave is not like how a regular touchpad acts. This one looks like its trying to be a touchscreen maybe idk, Basically the cursor seems to be "chasing" the position of where your finger has been. Like if i take a finger and slide it from left to right of the mousepad, a regular laptop would move the cursor from left to right no matter where its position was before that.

How this looks like with the code i pasted above:

I slide my finger from left to right... (For the sake of visualization lets just say the cursor is located in the middle of the screen) As i put my finger on the left side if the touchpad, The cursor moves to where i put my finger before continuing to chase after the fingers movements. This mechanism is pretty awkward as you can imagine, if i slide the cursor to the right, it first moves to the left (the position where my finger touched first). Touchpad cursors are supposed to be copying your fingers movements not chasing after your fingers position like a game of snake. Like i put my finger and hold anywhere on this DIY touchpad's surface, the cursor is moving towards my finger. Its not supposed to be doing it. The cursor should only move when my fingers move.

Yes the code is simple and i understand most of it aside from :

//the part where it convewrts PS2 data to USB data is the only thing i cant wrap my head around.
msval[0] = (((mstat2 & 0x10) << 8) | ((mxy & 0x0F) << 8) | mx );
msval[1] = (((mstat2 & 0x20) << 7) | ((mxy & 0xF0) << 4) | my );

but as i mentioned earlier i havent coded in years and i am probably missing something... Maybe its i dont know how touchpads work in depth or maybe the guy who wrote it didnt bother commenting it. (i had to read commented library code just to figure out whats in here, But no big deal, Good practice to get back into it i guess.

So yeah, if anyone has any insight on how to program a touchpad correctly and what i am doing wrorng or point me in the righjt direction .

I usually dont like asking for help but this got pretty frustrating for me especially when the thing is almost finished no to mention that during this jorney of discovery i started slowly realizing how absolutley AWFUL Rasbberry Pi is. In my opinion Raspberry pi is an overhyped nerd toy worse than literally any single-board computer on the market. I recentley bought a used Orange-Pi for $20 thinking its a more expensive clone of the raspberry pi and but NO! Orange pi is actually a pretty serious piece of hardware with so much more possiblities. (did i mention its backwards compatible with pretty much everything that Rasp has?) But honestly guys, i realize this is a raspberry pi section of the forum and you guys love them (I did too once) There is a whole WORLD significantly better single-board computers. Cubieboard, banana pi, Firefly, odroid, VIA old industrial propriotery motherboards running windows CE or even an old smartphone motherboard, is better ARM project computer than a raspberry pi. Even those tiny cube "friendly ARM" allwinner are better and more flexable in my opinion. (i am surprised myself, i thought they were crap)..... The controller from my old network harddrive case is actually a pretty neat one too. 200mhz, 16 mb of ram but no monitor You can only acess it via SSH but even that is a pretty interesting piece. People managed to install Debian 5 on it lol)

And to finish off venting anger, I would just like to express how much i hate touchscreens (This is why i am so bent on getting this touchpad to work instead of just buying a touchscreen). I have nothing against touchscreens actually but the idea that touchscreens are being jammed into every piece of equipment. Yes sometimes it makes more sence, and sometimes its cheaper and more practical to get a touchscreen but who likes screens covered in fingerprints? Also i cant feel they keyboard buttons with my thumbs that cover the surface area of like 5 buttons and often lead to annoying spelling mistakes? The screen is for the eyes not for the fingers.

Anyway, it would be great if someone here knows something about my touchpad problem. I really want to finish building this piece of crap to use for.... a portable bootserver... lol because thats all a RPI laptop seems to be good for


UPDATE:. I take back my words about touchscreens, I still dont like them but as it turns out that there is a good reason the industry moved away from buttons. Its because physical keys cant unstick immediatley and this caused a lot of pain for developers (Now i know the reason, for the delay command), Infact i remember learning this in school 11 years ago when i first joined this forum!
(I wonder what other things have i wrongly blamed on corporate greed)

OK so after a day of reading material i decided its possible for me to write a touchpad driver eventually by simply doing these really comprehensable programming tutorials arduino community is offerring. So i guess ill do that and share my results here.
Your signature has been erased by a mod
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 18th Jul 2018 02:51
Thank you for the deep insight! I am glad you figured it yourself out! Keep us updated with your progress!

[/url]
PAGAN_old
18
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 19th Jul 2018 07:38 Edited at: 19th Jul 2018 07:43
i FOUND A SOLUTION ! And almost by complete accident too. so let ne just stash this code here



Ill join instructables or hackter and do my own guide there eventually. And i also have some question for the person who wrote/found that goofy code from before that i have been slaving away for MONTHS! trying to figure out and modify into a normal mouse code.

But before i get to this, Let me just say that unbricking microcontrollers should be an plympic sport. First i had to convert my other Arduino onto an AVR programmer after i bricked the Pro-Nano because i didnt have one so,,, had to make due with what i had... Funny how that turned out.
To keep it short, the process of unbricking a Nano is very simple.The firmware loader i made out of the other arduino wasnt even FOR that model. making it kinda half-assed as it dosent support hardware serial. So the best you can do with it is getting the bootloader unstick spiraling the device into a never ending loop of reboots. Then you have to catch the moment while it booted to select the Com port (bootloader and actual firmware have different com ports) Basically it goes by really fast and you have to catch it and quickly select it, before you double tap the reset contacts (nano dosent have a recet button you gotta poke the pins with sokmething which will send it into an 8 second extended bootloader loop (single reset just does a regular quick reboot) . During those 8 seconds, You gotta select all the correct configurations of its original firmware, to prepare to reload it during the next pass. And you gotta time it exactly perfectly just before its done compilng before it starts trying to load whatever firmware it thinks it has. The window is less than a second long and considering you also have to be doing a yoga-headstand in the process, Lets just sayt i got an hour of exercize today.

Not raspberry topic but i can share the links of the guides if anyone is interested. I havent got to the actual reinstallation of the bootloader yet. You can remove it but reflashing the chiop will take more hand work and it has this charecteristic where its almost as if Nano after a while gets clogged up with code and the unbricking/unclogging (The process is actually done from the output pins so it actually looks you are unclogging it from overdoing infputs lol) needs to happen on a regular basis. and by the time you have your code strightened out you proboly wont need the bootloader anymore, the microcontroller can worki without it or you can put some alternative ones.

So my plan for the touchpad was to try get a reading of the raw PS/2 data. The process from what ive been told and read is that PS2 data is collected, converted into USB data and thats how you get a USB touchpad. I was honestly considering just bying a PS2/USB converter and taking the chip out of there but ive read stories that each is different and you might have to deal with even more unorgonized data that you have to eyball hopw and where the certain values change as you move your finger and you will be unable to modify and customize it like you can with a miocrocontroller. But when i tested that first weid code, i couldnt eyeball anything, Too many numbers for me to make a clear system out of. Ive been studying and stripping down that first code for months and coundnt figure out how the PS2 to USB conversion worked and the overall drunken mouse thing made things even more confusing. (i am generall not a math-smart person the best i can pinpoint is that there is a pattern).

So naturally from what i heard i was expecting the raw PS/2 output to be incomprehensable. After playing around with serial/digtal inputs and outputs still had nothing clear. Then i found some example code in PS/2 library which seemed to do what i need to figuring out how to write a driver from the bottom up It just collected and reported PS2 output data. to the user. Exellen,t i thought!. This will at least help me visualize the process. Obviosly the code didnt run out of the box, and i had to strip it down until it cound be run withoutout interrupting the bootloader.

To be honest i was in the dark here and i didnt know what i was doing, i simply took steps for the code to start running, which means getting rid of any dependancies it might have that caused problems,
By the time i could start up the serial plotter and the graphics, i realized that its the opposite of what i thought it was. The raw PS/2 serial data looked organized clearly followed bondaries ald rules. that it followed.

After studying it for a bit i decided to copy a line from my old code. Just a line of mouse.move (mx/2 , my/2) right over the serial outputs it craked out aqnd just like that i saw the cursoutr move as if it was moved on a regular laptop...

Both the older code and this one are based on the same libraries but the one i came here with was... not something that belonged to a mousae or a laptop. (If you have any spare synaptic touchpads, you can try the code and see for yourself.
There was one problem tho. The direction it moved the cursor to was wrong but i fixed ti by swithcing my mouse value to a negatinve. The rest was easy to figure out which got me wondering.

Who wrote that earlier code and WHY? Its not even commented, i had to refrence the PS/2 library files to get a clear picture.

It annoys me to no limits to know that this was around and noone knew about it and i wasted 2 months on it.

BUT IM SO HAPPY I HAVE WORKING CODE YAY sry.. and i even changed my mind about taking apart my Raspberry netbook. All it needs now is a power controller, maybe working sound system and ill make a more in-depth detailed guide on how to make these usb Trackpads because i still have around 3-4 left. *Unfortunatley i fried 2 of them but maybe if i find the covumentation for the ALPS trackpads, i can make more. The click buttons will be hardwired in there, No need to dump that work on the microcontroller.

Sorry for bad spelling, because i was crashing when i found that code and just had to force myself to stay up to get it in shape. ill post links maybe tomorrow if you guys are intertrested.





[edit] Sorry, give me a inute ill resize that to something more... civil
[edit]
Your signature has been erased by a mod
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 11th Aug 2018 23:01 Edited at: 11th Aug 2018 23:02
Hi, i did the same a year ago: AGK Thread
But i just bought a usb to ps2 converter for a few bucks...works great.
I also made a 3D printed case.

Login to post a reply

Server time is: 2024-03-28 14:12:28
Your offset time is: 2024-03-28 14:12:28