LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-11-2010, 12:51 PM   #1
Daravon
Member
 
Registered: Mar 2006
Posts: 170

Rep: Reputation: 15
How hard is it to write a USB device driver?


I know, I know..."How long is a piece of string"?

I have one of these devices:

http://www.cyberopticssemi.com/PDFs/...ta%20Sheet.pdf

Of course, it's Windows only, and XP only at that. However, the data that needs transferred between the device and the computer should be fairly basic, unless it offloads a lot of processing to the computer. I'm not a programmer, nor do I play one on TV, but I have written some fairly complicated microcontroller programs and some basic Java GUIs. Besides writing the actual code, how hard is it to do whatever needs done to make a Linux device driver, apart from the code to make the device work?
 
Old 10-11-2010, 01:01 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555
How to write a Linux USB device driver.

That article should be a good place to start. It appears to walk you through the entire process.

Since you have some programming experience, you are ahead of the game already. I'm not a kernel module programmer either, but if I were looking for what you're asking for, I'd do what I just did and use Google, with a query of "writing Linux kernel driver".

Also, don't quote me but there may be a downloadable version of "Linux Kernel in a Nutshell" or at least a similar publication, I believe another one is "Linux Kernel Module Programming" - if you can find either of these, you would do well to grab them. But, that article really is thorough, so have a look at that, and if you get a more specific question(s), by all means ask away!

EDIT: P.S. I neglected to mention, a great place also to have a look, is in the source code of an existing kernel driver module, for a similar USB device, if there is a similar one already in the kernel. Perhaps one can be modified to work with your device or at least provide a template from which to work on your own.

Last edited by GrapefruiTgirl; 10-11-2010 at 01:04 PM.
 
Old 10-12-2010, 04:38 AM   #3
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Bookworm (Fluxbox WM)
Posts: 1,391
Blog Entries: 54

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
Quote:
Originally Posted by Daravon View Post
Many measurement devices run a virtual serial link over the USB or bluetooth connection (for example, an SPP profile over bluetooth). The manufacturer might be willing to at least acknowledge this if you were to ask. Try plugging it into the Linux box and see what dmesg reports about the USB.

So you might not even need to write a driver per se; you might just have to write some code to interpret the data stream from the bluetooth link (which is self pairing, so probably transparent).

However, it is quite likely that the basic sensor data has to be processed at the computer end in order to provide useful results. To do this, you will either need a good understanding of how the leveling sensor works, or will need to get more details from the manufacturer. My guess is that it is a 2D accelerometer, so there may be calibration values involved (offset and range), filtering, and conversion to angles.

Some manufacturers of niche products like this may be willing to provide more information, especially if you were to offer to contribute your code back to them; they probably don't have the resources to write drivers for multiple platforms, and they are in the business of selling hardware, not software.

Last edited by neonsignal; 10-12-2010 at 04:44 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to write an USB device driver? boidi Linux - Kernel 9 07-24-2010 01:39 PM
Steps to write a device driver trkecea Programming 12 11-26-2009 11:40 PM
Write a simple driver for a usb device abhinit Linux - Hardware 5 07-17-2009 02:24 AM
how to write a device driver raghu mitra Linux - Software 1 07-22-2004 02:26 PM
how to write a device driver dummyagain Programming 3 10-20-2003 08:36 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration