Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Game Port programming

Posted on 2004-09-24
2
Medium Priority
?
378 Views
Last Modified: 2006-11-17
Does anyone know where I can find some good example code for reading a joystick input through the PC game port?

I have a SideWinder 3D pro, I need to be able read the up/down and left/right movement as well as when the fire button is pressed.  I know how to access the game port using ioperm(), I just would like to look at some example's to get some ideas.

I am writing the application in C, then I will be writing a basic Qt GUI to display the results.
0
Comment
Question by:sabrE7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
davidcausse earned 2000 total points
ID: 12170076
Hi,

Joystick is a character device in Linux so you do not need to use complicated io* stuff. You can just access data sent by joystick by reading the character device /dev/js[0-9] or /dev/input/js[0-9] depends if you use devfs. You can make a simple test by doing "cat /dev/[input/]js0" and move your joystick.
[NOTE: reading a character device is like reading a regular file, except you cannot seek]

However it isn't a good idea to read directly through this device, you'd better implement a game library like SDL for convenient/portable access methods.

Have look here : http://www.libsdl.org/

Good luck.

PS. ioperm is very lowlevel syscall and needs the super-user permissions, I must recommend to not develop as super-user.
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 12185701
Use libsdl, I fixed a few joystick problems in libsdl a few years ago, and I can tell you: You don't want to program the joystick directly :-) So take David's advice and learn about how to use libsdl.
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question