LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
LinkBack Search this Thread
Old 10-12-2007, 03:37 PM   #1
jvogel
LQ Newbie
 
Registered: Oct 2007
Location: Cincinnati, OH
Distribution: Ubuntu
Posts: 3

Rep: Reputation: 0
Question User Space Device Driver


I am new to Linux. I have been programming for over 15 years, mostly C/C++ and assembly.

I have been assigned the task of writing a User Space Device Driver for a USB device. The device is a barcode scanner which the system sees as a Keyboard.

I am trying to figure out how to know when a new device is plugged into the computer so that the device driver can be started and receive information from the scanner.

I am trying to use usbfs and libusb in writing this driver.

If I am wrong or you can point me in the correct path I would be very appreciative.

John V.
 
Old 10-12-2007, 09:13 PM   #2
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,049

Rep: Reputation: 953Reputation: 953Reputation: 953Reputation: 953Reputation: 953Reputation: 953Reputation: 953Reputation: 953
An interesting question. It doesn't seem to me that a "device driver" in the usual (kernel) sense will be needed. This will be an interface library to be used by the application-program ... it seems of little use to me to try to treat this device as "a separate device-type" nor to mount it globally to the system. For that reason, it seems irrelevant to "detect when the device is plugged-in."

The interface-library might poll the various USB devices and see which one identifies itself as a scanner... "/proc" or "/sys" or "/dev" and so-forth can tell you that (see lsusb and its man-page). Then open that device and make it very easy for the application to do what it needs to do with the device.

But it's just a user library, and I'll daresay that a suitable one probably already exists. . .
 
Old 10-13-2007, 09:56 PM   #3
kennithwang
Member
 
Registered: Aug 2007
Location: shanghai
Distribution: LDD
Posts: 32

Rep: Reputation: 15
You opinions is right. The usb driver libraries have been wrote, you can download them, in china I have tried to do this, and we have a relerant paper for this problem now, but it is in Chinese, sorry,
Then maybe you can find another documentation about your opinions now,

I think it is very useful, but it is not efficent, ........of cource you can port your usb drivers to other OS, provided you have completed your projetcts,,,,,

Good luck!
 
Old 10-15-2007, 07:06 AM   #4
jvogel
LQ Newbie
 
Registered: Oct 2007
Location: Cincinnati, OH
Distribution: Ubuntu
Posts: 3

Original Poster
Rep: Reputation: 0
I want to thank you for your help.

The barcode scanner software that I am working on is for an embedded system and there may be more than one connected to the system at any one time. I thought of polling and placed that before the management but they said that it was unexceptable. The barcode scanner currently shows up as a keyboard usb device.

Once again, I thank you for your help and suggestions.

John V.
 
Old 10-16-2007, 05:46 PM   #5
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,049

Rep: Reputation: 953Reputation: 953Reputation: 953Reputation: 953Reputation: 953Reputation: 953Reputation: 953Reputation: 953
As you'll see, an application-library can scan the USB devices to find out just what kind of device they are, e.g. as lsusb does. So, when asked to open a scanner, it can look to find one that isn't already in-use. And so on.
 
  


Reply

Tags
device, driver, keyboard, space, user


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get data from a terminal driver from user space? Any ioctl for this? Sreeram B S Linux - Kernel 0 02-24-2007 12:51 AM
Custom PCI driver problems (acess from user-space) - Ubuntu 6.06 / Linux 2.6 kalen Linux - Kernel 0 11-09-2006 06:11 AM
user-space notification of USB device attached/detached rhardy Linux - Newbie 1 10-25-2006 08:31 AM
user-space notification of USB device attached/detached rhardy Linux - Software 1 10-24-2006 03:17 PM
Retrieve write protect state of USB device in user space GeertPh Linux - Software 0 10-03-2006 01:25 AM


All times are GMT -5. The time now is 08:52 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration