Archives

All posts for the month April, 2012

Falure:

To make the base for the ball of my prototype trackball I went to Homedpot and got 3″ to 1.5″ PVC bushing and a 3mm Teflon rod from McMaster.com (Damn that’s an awesome site) and assembled them like you see in the picture. This was a complete failure. There is some serous resistance when moving the billiard ball. I tried flat and pointed Teflon nubs with the same result. I am not sure what I am going to use in its place but I am thinking a hard smooth metal of some sorts. Its funtional so i am leaving it the way it is for now.

 

 Problem:

It never occurred to me to check the pitch of the ADNS-9500, which is a problem since its 1.78mm  and almost most everything development or prototype related is 2.54 mm.

hmmm…

Share Button

Had an odd issue a few weeks back. A process was not behaving as it should. After doing some digging I found out that the the only way it could behave like it was, was if an environment variable was set incorrectly. The odd part was that /proc/$$/environ was showing that it was set correctly.

After doing some research and playing with gdb a bit (thankfully this was a test environment) I found out that /proc/$$/environ does not give you what you think it gives you!

on to the why.

When a process starts the create_elf_tables function gets called. This function creates and populates a mm_struct data structure. This structure, among other things, contains env_start and env_end, which are the memory address of the begging and end of the environment variable data in the stack.

To get the environment variable information the proc file system reads mm_struct to get he start and end values where the environment variables are located. This is done in the environ_read function.

So why is this not giving me what i want? Well when the process is created in memory there is no buffer in the stack to add more environment variables or to make existing environment variables longer.  So when the process creates a new environment variable or modifies an existing one the environment variables get moved to the heap and the environ symbol is changed to point to the new location. The mm_struct however, is not changed. Which is not necessarily a bad thing but since the proc file system looks at the mm_struct you get the environment at execution time and not the current environment.

this behavior is simple to see.

1
2
3
4
5
6
7
$ echo $FOO

$ cat /proc/$$/environ |tr '\0' '\n' |grep FOO
$ export FOO=BAR
$ echo $FOO
BAR
$ cat /proc/$$/environ |tr '\0' '\n' |grep FOO

For the hell of it I was playing around with ptrace and made an small program that attaches to a process parses the elf structure, finds the environ symbol and then prints out the
current environment variables. The code is crap and the thing barely works(well sometimes it barely works) I was just fooling around. Its allot easier (and safer) to start up GDB and do a “show environ“.

Share Button

It doesn’t actually do anything but I can plug it into a computer and it registers as a USB device. The computer has no idea what to do with it but it at least knows it exists. I know I wired at least two parts worse then correct but better than wrong, since it seems to be working. I need to read up on this a bit more.

As far as the code, I used stock example code for a generic HID from NXP. I literally did not change a single character of code and loaded it with the LPCExpresso IDE in Windows. It actually says “LPC 13XX USB HID” in the lsusb output.

Its not much but i accomplished what i set out to do yesterday, which was simply to see if i could get a computer to see something coherent from this dev board.

Share Button

Shortly after I got my first computer I purchased a Logitech TrackMan Marble FX Trackball and it was glorious.

Logitech TrackMan Marble FX TrackballFor almost 10 years this was the one and only mouse/trackball I ever used. I went through a few of them. I found the sensor cover would eventually fall off the the tracking sensor would get full of gunk and stop working. I even went as far as to stock up on them after I heard they had been discontinued. unfortunately about 5 years ago my last one gave up the ghost.

Since then I have bought and/or tried out quite a few trackballs. None of them have ever come close, there was nothing particularly wrong with most of the them, they where just not the same, they where all missing at least one key feature I could not do without.

So I have decided to take it upon myself to create a trackball that(hopefully) fills in the gaps that the bin of trackballs on my shelf could not. To be honest I may be biting off more than I can chew. We shell see.

Design points I am shooting for.

  • Cleanable:
    It should be relatively simple to fully disassemble in order to completely clean every piece. I would consider myself just as clean as the next guy by I find that all my HID’s eventually get absolutely filthy. Most of them are quite difficult nay impossible to really clean well.
  • Specs:
    The technical specs should be on par with the best high precision mice/trackballs on the market. Not only that but all the physical pieces should be top notch.
  • Big Ball:
    I was actually thinking of a Billiard ball(56mm).
  • Buttons:
    You can never have enough buttons.
  • Open-sourced:
    All code, designs and anything else related to this device should be under an open source license (have not decided which one).

I have already done quite a bit of research and picked out the first two major components. For the motion sensor I am going with the Avago ADNS-9500. This was the best sensor I could find and it seems fairly straight forward to get working. For the MCU I am going with the NXP LPC1343. Since I don’t have any experience with MCU’s this was a fairly difficult decision. In the end I decided on NXP because of the documentation, the user community and the fact that there is open source drivers under the BSD license. I decided against the mbed primarily because a lot of the work is already done for you. The knowledge I gain from this is just as, if not more, important than the result.

My order from Mouser is on its way. I am quite exited I have not had a good project in quite some time.

Share Button

Hi

So I have been meaning to put something together for some time now. There will most likely be nothing hear of interest to anyone. This is mainly for me, but figured I would leave it open in the off change someone finds something useful.

Why don’t I just use Facebook or some other social networking site? Well there are quite a few reasons, and I don’t feel like getting into now.

Share Button