seb2007 / linux-track

Automatically exported from code.google.com/p/linux-track
MIT License
0 stars 0 forks source link

Add support for TrackIR 2. #11

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I'll admit - I did read the docs but installed the software anyway hoping it 
would work with my newly acquired TrackIR 2. But it doesn't. :)

Since I see you, the developer, are already working on adding TIR3 support I 
propose you add support for TIR2 as well. I have one sitting around here and I 
am able to supply you with USB traffic captures from Wireshark. 

If you agree to work on this, please tell me what behavior to capture and 
you'll get it!

Cheers,
Jaša Bartelj.

Original issue reported on code.google.com by jasa.bar...@gmail.com on 9 Nov 2011 at 9:10

GoogleCodeExporter commented 8 years ago
Just to note it somewhere, this old model doesn't work with the latest TrackIR 
software. The last version NaturalPoint supplies for TIR2 is 3.13, released in 
December 2004.

The device is has these IDs:
$ lsusb
...
Bus 001 Device 021: ID 131d:0150 Natural Point 

Original comment by jasa.bar...@gmail.com on 9 Nov 2011 at 9:17

GoogleCodeExporter commented 8 years ago
Hello Jasa,
my answer will be pretty much the same as it was concerning TrackIR3 - please 
create few dumps (TrackIR sw running, plug-in the TrackIR, wait for it to 
initialize, run the marker to all extremes - out of view to the left, right, up 
and down, if there are some controls, like exposure of whatever, move it all 
the way up, then all the way down, shut the Track IR sw down)...
I'll take a look at it, and then I can tell you if I'll be able to add support 
for it - it all depends on how much the protocol differs.
Kind regards,

Michal

Original comment by f.jo...@email.cz on 10 Nov 2011 at 8:26

GoogleCodeExporter commented 8 years ago
Thank you for considering my request!

Here are screenshots of the old software used:
http://takra.tk/files/tir313-main.png
http://takra.tk/files/tir313-hotkeys.png
http://takra.tk/files/tir313-motion-custom.png (I used linear mouse emulation 
for the capture, these are the options that can be tweaked)
http://takra.tk/files/tir313-motion-linear.PNG
http://takra.tk/files/tir313-motion-autopanning.PNG
http://takra.tk/files/tir313-tracking.PNG (light source in upper left corner, 
green tracking dot)
http://takra.tk/files/tir313-tracking-low-camera-threshold.PNG (dot grows 
larger if threshold is low but at 50 the camera suddenly detects a lot of noise)
http://takra.tk/files/tir313-profiles.PNG

The capture is in pcapng format. I filtered mouse and keyboard traffic out by 
using display filter "usb.device_address == 7" in Wireshark. You can find 
attached the captured data of this process:

1) plugged in trackIR
2) started capture in Wireshark
3) started software in windows vista VM
4) added TIR2 device to vm
5) driver installation in vm
6) light source & tracking dot in field of view
7) adjusted camera not to see the light source
8)moved tracking dot vertically and horizontally in and out of view of camera
9) moved Tracking > dot tracking filter > preffered object size from 10 to 500 
pixels
10) moved motion > Motion Presets from Linear to Auto Panning
11) stopped TrackIR software

12) started trackir software
13) moved tracking dot vertically and horizontally in and out of view of camera
14) stopped trackir software
15) stopped TrackIR software
16) stopped capture in Wireshark

I imagine this huge capture might be a bit too much to comfortably parse. So if 
you need smaller captures of a specific actions, I will provide them.

Original comment by jasa.bar...@gmail.com on 10 Nov 2011 at 7:01

Attachments:

GoogleCodeExporter commented 8 years ago
Hi,
thanks for the capture; so far it seems, that the part of protocol that 
controls the camera is pretty much the same...
But the payload of packets incoming from camera is not familiar at all; so I'd 
ask you for this:
put marker somewhere near one of the corners, do a quick capture and also a 
screenshot; do this few times, so I can get the idea on how the data are 
encoded...
Thanks,

Michal

Original comment by f.jo...@email.cz on 10 Nov 2011 at 9:19

GoogleCodeExporter commented 8 years ago
Here you go. I've labeled the files where i held the dot. When I held it e.g. 
low and left, the software displayed it in the lower right corner. Mirroring.

Hope this helps!
Jaša

Original comment by jasa.bar...@gmail.com on 10 Nov 2011 at 10:21

Attachments:

GoogleCodeExporter commented 8 years ago
Hi Jasa,
commuting to work I found a pattern in payload and your data confirmed my 
theory.
So implementing the support ought to be pretty easy, I just have to be careful 
not to break anything working already.

I'd need one more dump from you - start capturing, start TrackIR sw, plug-in 
TrackIR,
wiggle the camera threshold (all the way low, all the way high), and finally 
close the TrackIR sw...

Also, are you able to compile the linuxtrack from the SVN?
Kind regards,

Michal

Original comment by f.jo...@email.cz on 11 Nov 2011 at 10:40

GoogleCodeExporter commented 8 years ago
Wow, that's great news!

Please find attached the requested capture and ogg video of the VM.

I am indeed able to compile code from svn, I just completed the NewBuild wiki 
process.

Original comment by jasa.bar...@gmail.com on 11 Nov 2011 at 3:46

Attachments:

GoogleCodeExporter commented 8 years ago
Hi Jasa,
please try to compile linuxtrack from the following branch:
svn checkout http://linux-track.googlecode.com/svn/branches/tir2
Let me know, if it works...
Kind regards,

Michal

Original comment by f.jo...@email.cz on 12 Nov 2011 at 11:44

GoogleCodeExporter commented 8 years ago
You are a superstar!

I checked out revision 488 & after customizing the settings to fit my setup the 
tracking works without a hitch. I attached a short video as evidence. :)

Thank you very much for your work!

Original comment by jasa.bar...@gmail.com on 13 Nov 2011 at 9:22

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you for your kind words, I really appreciate it...
When the work on this branch is done (I've found some bugs and I'm fixing 
them), I'll merge it into the trunk and then I'd ask you for a confirmation 
that the code in trunk still works for you.
Thanks for your help,

Michal

Original comment by f.jo...@email.cz on 13 Nov 2011 at 9:36

GoogleCodeExporter commented 8 years ago
Sure. Please write a comment here whenever you are finished so I receive an 
email and then I will test the latest trunk revision.

Thanks again!

Original comment by jasa.bar...@gmail.com on 13 Nov 2011 at 10:28

GoogleCodeExporter commented 8 years ago
Hello Jasa,
can you try to compile linuxtrack from the trunk and let me know if it still 
work for you?
Thank you,

Michal

Original comment by f.jo...@email.cz on 16 Nov 2011 at 7:23

GoogleCodeExporter commented 8 years ago
I am getting segmentation faults for revision 494.

The ltr_gui starts fine and the tracking window shows the detected dot but 
after a while the program segfaults. I tried deleting ~/.linuxtack/ to really 
start with a clean slate but it doesn't help. I can try running gdb tomorrow.

Original comment by jasa.bar...@gmail.com on 16 Nov 2011 at 10:02

GoogleCodeExporter commented 8 years ago
Hi Jasa,
thank you for the report and I'm sorry for those troubles...

I tried to reproduce the problem, but even valgrind doesn't show anything 
unusual.
Could you please obtain the backtrace and paste it here?

I'm not sure if you are familiar with gdb - so just start the ltr_gui by going 
to the bin directory where you installed it, and type 'gdb ./ltr_gui';
when gdb launches, use 'run' command and when the segfault occurs, use commands 
'set pagination off' and then 'thread apply all backtrace'; then using 'kill' 
command finish the ltr_gui and using 'quit' leave gdb...

Also if you could capture the USB traffic simultaneously, it might help me to 
reproduce the problem...
Thank you,

Michal

Original comment by f.jo...@email.cz on 17 Nov 2011 at 8:04

GoogleCodeExporter commented 8 years ago
Hi, Michal.

I have used gdb a few times over the years but I'm not a regular user so I do 
appreciate your instructions.

You can find the backtrace and capture attached.

Here's the segfault message:

Program received signal SIGSEGV, Segmentation fault.
0x00007fffd91fe210 in DBusMenuExporter::setStatus(QString const&) ()
   from /usr/lib/x86_64-linux-gnu/libdbusmenu-qt.so.2

Original comment by jasa.bar...@gmail.com on 17 Nov 2011 at 3:58

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi Jasa,
I managed to reproduce the problem - it seems to be tied to the unity somehow; 
I'm investigating it right now...
Kind regards,

Michal

Original comment by f.jo...@email.cz on 17 Nov 2011 at 7:17

GoogleCodeExporter commented 8 years ago
Ah, yes, details are always important. Perhaps we should have opened a new bug 
to fix this issue.

Anyway! Yes, I do run Ubuntu amd64 with the Unity interface.

I just discovered a way to segfault ltr_gui with the exact same gdb output.
1) Try running ltr_gui without any devices attached.
2) Press Start in the tracking window.
3) With the tracking window focused, press Alt+F4 on your keyboard.
4) Instant segfault.

Hope it helps. Thank you for your hard work,
Jaša

Original comment by jasa.bar...@gmail.com on 17 Nov 2011 at 7:36

GoogleCodeExporter commented 8 years ago
Hi Jasa,
I have found the cause - it is the pressing of Alt key; if I understand it 
correctly, when you press Alt, the application menu might change and this info 
is passed to DBus for other apps. It seems there is a problem in the qt binding 
to the dbus menu or the dbus menu itself... I also managed to reproduce this 
problem in much older revision.
By the way, googling the message shows that linuxtrack is not the only app 
suffering from this problem.

Anyway, the workarounds might be:
 - using other session - fvwm works without a hitch so far (will check more thoroughly)
 - don't touch the Alt key when ltr_gui is running...

Also note, that unlike NP software, there is no need for ltr_gui to run during 
normal linuxtrack usage; in fact it is better to quit it before using 
headtracking for real (ltr_gui is meant for setup only).

I'm sorry I can't be of more help as this doesn't seem to be a bug in my code...
Kind regards,

Michal

Original comment by f.jo...@email.cz on 17 Nov 2011 at 8:05

GoogleCodeExporter commented 8 years ago
That's fine, thanks for the explanation.

I know I'm "only human" but I definitely can't remember pressing the Alt key 
while I was doing the gdb sessions. I was too busy with my hands holding up the 
tracking dot. Did you press the Alt key when you managed to reproduce the issue 
with my USB capture?

But that is probably irrelevant. Thank you for taking the time to add support 
for TrackIR 2! I hope other TIR2 owners will find this software useful as well.

Good fortune to you,
Jaša.

Original comment by jasa.bar...@gmail.com on 17 Nov 2011 at 8:19

GoogleCodeExporter commented 8 years ago
Hi Jasa,
I feel really stupid now - I did some thinking (what a pain ;) ) and it turned 
out it was partly my fault - the tracking window was a main window type, with 
no menu defined.
When the Alt was pressed, it tried to pass the nonexistent menu and probably 
that caused the segfault.
Anyway I just committed new revision, that should correct this...
Can you check if it works for you?
Thanks,

Michal

Original comment by f.jo...@email.cz on 17 Nov 2011 at 8:50

GoogleCodeExporter commented 8 years ago
Hi,
Everything works rock solid again! I would only like to suggest renaming the 
tracking window from "Form" to "Tracking window". :)

Cheers,
Jaša.

Original comment by jasa.bar...@gmail.com on 17 Nov 2011 at 9:06

GoogleCodeExporter commented 8 years ago
Thank you for the good news!
I'll close this issue then; should you encounter any problems, feel free to 
reopen it, or open another one.

I'd like to thank you also for the time you spent helping me adding TIR2 
support and debugging this problem.
Kind regards,

Michal

Original comment by f.jo...@email.cz on 17 Nov 2011 at 9:19