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

x
?
Solved

basic question: programming a device

Posted on 2004-10-22
3
Medium Priority
?
246 Views
Last Modified: 2013-11-15
Hi,

I am programming a platform-independent (Linux/Windows) application using C++ and some graphics libraries.  I will be using a trackball for the user to be able to interact with my application.  Motion of the trackball will manipulate the image onscreen in some way..

So right now I have a mouse with a trackball on it, but will soon be purchasing simply a panel-mount industrial trackball.

What is the first step I need to take in order to program this device?  Do I need to program a driver?  Or if it comes with a drive or is compatible with the driver I have, then how do I detect this device and get output from it? Do these devices normally come with drivers??

Should I be doing X programming or Win32 programming to do this?  Or can I call  a library in C++ which detects IO?

I think my trackball device will be attached to a serial port, and possibly a USB

Thank you!

(Also if you have any suggestions on books/sites taht I should look into - that would be great..)
0
Comment
Question by:lost_bits1110
[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
3 Comments
 
LVL 23

Accepted Solution

by:
brettmjohnson earned 400 total points
ID: 12386039
Most trackballs are supported out-of-the box as a pointing device under Windows and Linux.
If the OS vendor doesn't support that particular brand, the device manufacturer will usually
provide a driver.  From the OS driver perspective, a trackball is simply a mouse.  So you
are unlikely required to write the device driver yourself.

If you want write a platform independent app, don't write directly to Win32 or X window APIs.
Confine you library calls to the ANSI, POSIX, and STL interfaces and use a platform independent
GUI framework such as Qt.

0
 

Author Comment

by:lost_bits1110
ID: 12387374
Thank you,

What do you mean by 'supported out of the box'..

So do you mean that if I used just POSIX calls for instance, then my program would still work under both Linux and Windows..? I will be using FLTK probably as my GUI framework..

Then if I understand correctly, using the GUI framework serves the purpose of continuosly detecting for events, and using either ANSI, STL etc.. is for opening the serial port, detecting that the device is there, and retrieving data from it?  

How does the device driver come into play in all of this

Thank you

0
 
LVL 23

Expert Comment

by:brettmjohnson
ID: 12418442
> What do you mean by 'supported out of the box'..
I mean most major OS's ship with drivers for commonly used pointing devices.

> So do you mean that if I used just POSIX calls for instance, then my program would still work under both Linux and Windows..?
Yes, Microsoft makes Windows NT/2000/XP/2003 POSIX compliant in order to sell to the US government.

> I will be using FLTK probably as my GUI framework..
I've never used it, so I can't comment.

> Then if I understand correctly, using the GUI framework serves the purpose of continuosly detecting for events, ...
Yes

> and using either ANSI, STL etc.. is for opening the serial port, detecting that the device is there, and retrieving data from it?
Yes.  Use fopen() for opening the device, ioctl() or fcntl() to query device type, and fread() et al to read data.

> How does the device driver come into play in all of this?
Device drivers map physical devices (including disk drives, keyboards, mice, etc) into the abstract filesystem
namespace, and abstract the interface to conform to character or block i/o devices .  So you can open/read/write
files, terminals, pipes, shared memory, sockets, etc. using the standard library routines.

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

There are many software programs on offer that will claim to magically speed up your computer. The best advice I can give you is to avoid them like the plague, because they will often cause far more problems than they solve. Try some of these "do it…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.
An overview on how to enroll an hourly employee into the employee database and how to give them access into the clock in terminal.

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