Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

Xbox 360 Controller & NI MyRIO

Has anyone tried to interface a console controller (i.e. a wired Xbox 360 controller) to the MyRIO?

 

As it's got a USB port and is running Linux RT - I imagine it should be possible to get the device installed/recognised by the OS on the MyRIO but I'm not sure what the next step would be in terms of trying to get that data into LabVIEW Real Time?

 

Plugging the controller into the USB port and it shows up as usbdev1.2 under /dev

 

I did some reading around and there is a linux driver for a wide range of Xbox compatible controllers called 'xboxdrv'. It has a dependency on libusb-0.1-dev. I guess it should be possible to compile this driver for the MyRIO and install it using opkg? 

 

Once installed, how would I interface with the device from LabVIEW Real Time?

 

I have a reasonable understanding of linux but in terms of compiling from source etc. I'm a little rusty so if anyone can point me in the right direction I'd really appreciate it!

 

It seems like something that might be pretty cool to have working with the MyRIO as there are lots of applications that you might want to use a controller for!

 

Failing that - any ideas on other controller suggestions? Something I could interface to with Digital Inputs?

 

Update #1: I have just managed to use opkg to install the libusb-0.1-dev library as it is included in the Angstrom repository (after changing the feed address). Unfortunately, xboxdrv isn't so I'm not sure on the next step just yet. 


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 1 of 7
(11,114 Views)

Update #2: The link to the xboxdrv is here: http://pingus.seul.org/~grumbel/xboxdrv/ I tried using the NI version of eclipse for MyRIO to compile it but I had a lot of problems with library dependencies etc. - I think that someone with more experience of using Eclipse might be able to manage it?


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 7
(11,099 Views)

Hi Sam_Sharp,

 

 

As you have already implied, for the library to work it will have to be re-compiled for the RTOS that myRIO runs. As far as I know the xboxdrv is mainly focused on Ubuntu distribution of Linux so I'd be unsure whether it will work with myRIO simply. From what I see, it's very likely that a simple driver would be quicker to write rather than work on adapting the xboxdrv one.


What kind of library dependency issues you had exactly when compiling? From what I found xboxdrv 0.8.5 will require the following libraries and tools: g++ - GNU C++ Compiler, libusb-1.0, pkg-config, libudev, boost, scons, uinput (userspace input kernel module), git (only to download the development version), X11, libdbus, glib

 

You might want to check-out "xpad", which is a default driver for xbox controllers that comes with linux kernel in some linux distributions. It's very basic but might be a good starting point if you decide to approach the driver development yourself: https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/plain/drivers/input/joystick/xp...

 

Please note that since Linux ecosystem is extremely vast we can't provide full support for using 3rd party add-ons and tools. However let me know if you have any more questions and I will try my best to help.

 

______________________________________________________

Mark N
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 3 of 7
(11,071 Views)

Any word on this?  Im looking into giving this a try and I figured I would ask first.

 

Thanks.

0 Kudos
Message 4 of 7
(10,390 Views)

I didn't manage to get any further - I'm not much of a linux user let alone developer so trying to compile the xbox 360 controller drivers for the myRIO was way out of my comfort zone.

 

I think it needs either:

1) Someone with enough knowledge of cross-compilations and library linking to compile the xboxdrv library for the myRIO target

or 

2) Write & compile a new Xbox controller driver (essentially a USB driver) specifically for the myRIO

 

Alas - neither are part of my skillset and I don't have the time to try and battle my way through or learn it now. I think it would be a great feature addition to the myRIO though and I'm pretty confident it would be fairly straightforward for someone who knows how to do this sort of thing!


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 5 of 7
(10,358 Views)

Hey guys,

 

The best resource for myRIO OS customizations like this is the NI Linux Real-Time community here.  There are some Linux gurus that monitor that page and provide recommendations and help out with stuff like this.

 

-Sam K

LabVIEW Hacker

Join / Follow the LabVIEW Hacker Group on google+

0 Kudos
Message 6 of 7
(10,354 Views)

Sam_Sharp,

 

I saw your request over in the real-time section of the forums.  I'll post my suggestions here.

 

The cRIO-9068 ships with a package manger called opkg.  With some modifications to it's configuration files, you can use it to pull down a vast ecosystem of pre-compiled tools.

 

With that being said, I don't think you'll be able to get xboxdrv working on the cRIO-9068 due to its dependance on x11.  If you are lucky the functions that are being used by the driver won't require the initalization of a framebuffer or graphics unit (the cRIO-9068 has neither).  It looks like you have figured this part out and gotten opkg up and running.

 

I personally am against cross compiling if you can get away with it.  The cRIO-9068 has plenty of horsepower for compiling applications.

 

A quick google showed that these folks had some issues getting xboxdrv working as well:

    http://elinux.org/ECE497_Project_GameSystem

 

I believe that the file that NI-MarkN linked to ...

 

    http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/plain/drivers/input/joystick/xpa...

 

... would work just fine.  This, however, is just source code and needs to be compiled down to a Linux driver.  The process of compiling a Linux driver requires the source code (or at least the header files) for the version of the Kernel you are compiling it against.  The source code to the kernel is not shipped with the cRIO-9068 (as it shouldn't be, it's massive).

 

A quick google search did not produce a easy place to download the kerenel source code (which is incredibly unforunite).  You could try and download the kernel source for kernel 3.2.35, and then cross compile using Eclipse.

 

You can pull down the git repo here:

    > git clone https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git

 

Then checkout the 3.2.35 version by using this command:

    > git checkout 3.2.35

 

This gets pretty involved to be honest though ... 

 

Can you do this for me?  Plug in the xbox controller and then do this command:

    > lsusb

 

And then list the modules that are installed:

    >lsmod

 

And then post those outputs here?

 

Another option is to see if you can find a .ko file for the xpad or xboxdrv.ko file that was compiled against the 3.2.35 kernel ...

 

-TD

0 Kudos
Message 7 of 7
(10,312 Views)