Teensy 2.0, CentOS and X-plane

Status
Not open for further replies.

Dozo

Member
Greetings,

I'm using a Teensy 2.0 with CentOS 6.4 64 bit and X-plane 9.70. Before this quadcore desktop I was using the Teensy on my MacBook Pro, which was working like a charm. I really love the Teensy, especially in relation to the cockpit building hobby :)

Now, my girlfriend has claimed the MacBook :p and I am trying to get the above mentioned combo to work.

What works:
If I use the 'Blink' example in teensyduino, that works. The builtin led will flash.

What doesn't work:
If I use the BlinkTransponder example, the Teensy builtin led remains unlit. There's no communication in the 'show communication' panel under the Teensycontrols plugin in X-plane.

The /var/log/messages file gives:
Code:
Sep 10 20:59:39 vpshost kernel: usb 2-3: new full speed USB device number 18 using ohci_hcd
Sep 10 20:59:39 vpshost kernel: usb 2-3: New USB device found, idVendor=16c0, idProduct=0488
Sep 10 20:59:39 vpshost kernel: usb 2-3: New USB device strings: Mfr=0, Product=1, SerialNumber=0
Sep 10 20:59:39 vpshost kernel: usb 2-3: Product: Teensy Flight Sim Controls
Sep 10 20:59:39 vpshost kernel: usb 2-3: configuration #1 chosen from 1 choice
Sep 10 20:59:39 vpshost kernel: generic-usb 0003:16C0:0488.001F: hiddev96,hidraw0: USB HID v1.11 Device [Teensy Flight Sim Controls] on usb-0000:00:0b.0-3/input0
Sep 10 20:59:39 vpshost kernel: generic-usb 0003:16C0:0488.0020: hidraw1: USB HID v1.11 Device [Teensy Flight Sim Controls] on usb-0000:00:0b.0-3/input1

When X-plane is running, and I flash the Teensy the following lines are added:

Code:
Sep 10 20:59:39 vpshost kernel: ioctl32(X-Plane-i686:7620): Unknown cmd fd(17) cmd(80084803){t:'H';sz:8} arg(ffb7db8c) on /dev/hidraw1
Sep 10 20:59:39 vpshost kernel: ioctl32(X-Plane-i686:7620): Unknown cmd fd(17) cmd(80084803){t:'H';sz:8} arg(ffb7db8c) on /dev/hidraw0

What I tried:
I already removed libmm-plugin-generic.so from /usr/lib64/ModemManager, but this didn't fix anything.
I also tried to install the plugin again, also no improvement.

I don't really know how to move on from here, I'm happy for any insight others could provide.

Paul, thanks for putting effort in the Teensy boards and the X-plane plugin.
 
My best guess is you're running an older kernel? Or more specifically, a kernel with an older version of the hidraw driver?

Or for whatever reason, at least one of these 3 ioctls does not work on your system?

HIDIOCGRAWINFO
HIDIOCGRDESCSIZE
HIDIOCGRDESC

These are pretty much baseline functionality in the hidraw driver. Here's the documentation.

https://www.kernel.org/doc/Documentation/hid/hidraw.txt

However, that error "ioctl32(X-Plane-i686:7620): Unknown cmd fd(17) cmd(80084803){t:'H';sz:8} arg(ffb7db8c) on /dev/hidraw1" seems to suggest your kernel's hidraw driver doesn't support one of these 3 ioctl calls the plugin needs. Or for whatever strange reason, the ioctl call isn't working. If any of those 3 fail, the plugin will ignore the device.

The plugin was only ever tested on Ubuntu 12. Usually things work on the other distros (except Gentoo and Arch, which seem to have a lot of compatibility issues). But when they don't, unfortunately I can't do much to support the other distros. Any chance you could try on Ubuntu 12?
 
Those ioctl calls are done after an open() call succeeds, so this isn't a simple permissions problem (eg, missing udev rules) or just a missing driver. The hidraw driver is definitely there and permissions are allowing the device file to be opened. But then the first thing the plugin needs to do is those ioctls to learn more about the device.

Very mysterious...
 
Paul, thanks for your reply. I'm up-to-date kernel wise if I'm not mistaking, but I will check it as soon as I get home. The Teensy is working perfectly with my MacBook, so it's definitely a Linux issue.
 
Maybe there's something like AppArmor interfering with the ioctl call?
I'm not using anything like that I'm afraid. My kernel is 2.6.32-358.18.1.el6.x86_64, which is the up to date kernel for the CentOS distribution. Haven't been able to investigate any further, Ubuntu 12 is an option, which I'll explore later in the weekend I guess. I definitely want to get this working, maybe I'll try my work laptop as well, which also has a CentOS 6.4 64 bit install. I'll keep you posted. Thanks for the help so far!
 
My Ubuntu 12 system has kernel "3.2.0-52".

This is definitely the difficult challenge of supporting Linux, that the many distros vary so much.

I can tell you I've personally found and reported 3 bugs in the hidraw driver over the last few years. Jiri, the kernel developer who maintains that driver, responded each time with a fix in a matter of hours. Usually Linus merged them to the mainline kernel within a month. But then it takes about 1 year for those fixes to filter downstream to all the major distros. I haven't kept track of the bugs, not to mention which kernel versions fix which ones.

2.6.32 doesn't seem that old, but maybe it is? I can tell you with certainty that older versions do have bugs in this driver that affect Teensy-based applications.
 
Tonight I'm going to install the mainline kernel from the elrepo repository, maybe that one contains the updated drivers. Otherwise, I might go with Ubuntu. I'll keep you posted anyway!
 
Tonight I'm going to install the mainline kernel from the elrepo repository, maybe that one contains the updated drivers. Otherwise, I might go with Ubuntu. I'll keep you posted anyway!

Well, this didn't quite turn out like I wanted to. I can boot the 3.x kernel from the elrepo kernel repo, but graphics are messed up performance wise. A re-installation of fglrx didn't fix it. Tomorrow I'll pick up some ssd's I already bought and go with Ubuntu 12.04. With the 'new' ssd's I can leave my old system untouched, but it makes sense to move to Ubutu since you also test everything on Ubuntu.

To be continued...
 
Paul, just (finally) got round to installing Ubuntu 12.04 LTS, X-plane and TeensyControls.

Everything is working like a charm now (tested with the transponder example), thanks for your help! I'll stick with Ubuntu I guess. Still have a problem with X-plane crashing when the x737 plugin is the default plane, but that's somehting else.

Must have been the hidraw driver indeed.

Thanks again!
 
These enterprise distributions are meant to maintain stable minor versions of the kernel and core packages (glibc, gcc, etc.) in order to provide a stable platform throughout the supported lifecycle of the distribution.

you can get newer kernels from ElRepo but once you do this you're on your own so to speak. You will be outside of the normal EL support channels and may not be able to get security and bug fixes etc.

http://elrepo.org/tiki/tiki-index.php

Although I would just stick with ubuntu. It doesn't sound like you are in an enterprise situation.
 
Status
Not open for further replies.
Back
Top