LinuxQuestions.org
Visit Jeremy's Blog.
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 04-01-2009, 08:03 AM   #1
Xenation
LQ Newbie
 
Registered: Jan 2009
Posts: 5

Rep: Reputation: 0
Writing own USB device driver


I got an USB touchscreen. The touchscreen on my device is a PenMount 6000 USB. When running dmesg, this is what I found about it:
<6>[ 4.033918] input: DIALOGUE INC PenMount USB as /class/input/
input6
<7>[ 4.060448] evbug.c: Connected device: "DIALOGUE INC PenMount
USB", usb-0000:00:1d.7-4.1/input0
<6>[ 4.060456] input: USB HID v0.01 Mouse [DIALOGUE INC PenMount
USB] on usb-0000:00:1d.7-4.1
<6>[ 4.066725] usbcore: registered new interface driver usbhid
<6>[ 4.070042] drivers/hid/usbhid/hid-core.c: v2.6:USB HID core
driver

This says it's registered as a USB HID. Information from /proc/bus/input/devices
I: Bus=0003 Vendor=14e1 Product=6000 Version=0001
N: Name="DIALOGUE INC PenMount USB"
P: Phys=usb-0000:00:1d.7-4.1/input0
S: Sysfs=/class/input/input6
U: Uniq=
H: Handlers=mouse0 event6 evbug
B: EV=1b
B: KEY=30000 0 0 0 0 0 0 0 0
B: ABS=3
B: MSC=10

It is registered as /dev/input/event6.

Now I want to write my own driver for this touchscreen. It looks like it's using an other driver. Can I write my own and will it use my driver instead of the standard USB driver?
 
Old 04-01-2009, 10:04 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 23,711

Rep: Reputation: 6943Reputation: 6943Reputation: 6943Reputation: 6943Reputation: 6943Reputation: 6943Reputation: 6943Reputation: 6943Reputation: 6943Reputation: 6943Reputation: 6943
Quote:
Originally Posted by Xenation View Post
I got an USB touchscreen. The touchscreen on my device is a PenMount 6000 USB. When running dmesg, this is what I found about it:
<6>[ 4.033918] input: DIALOGUE INC PenMount USB as /class/input/
input6

It is registered as /dev/input/event6.

Now I want to write my own driver for this touchscreen. It looks like it's using an other driver. Can I write my own and will it use my driver instead of the standard USB driver?
You don't say anything about what version/distro of Linux, but did you Google for this? Or visit the PenMount website?

http://www.penmount.com/down_2_1.php

Lots of ready-to-go Linux drivers for your device......
 
Old 04-02-2009, 03:07 AM   #3
Xenation
LQ Newbie
 
Registered: Jan 2009
Posts: 5

Original Poster
Rep: Reputation: 0
My distro is not mentioned. But the main thing is that it's recognized as USB hid. If I would write my own driver with specific VendorID and productID, will it overload the other 'driver' ?

And how do I know what kernel driver a device uses? What code will be called at the moment when I touch the screen.
 
Old 04-02-2009, 03:22 AM   #4
Drahcir
LQ Newbie
 
Registered: Jan 2004
Posts: 13

Rep: Reputation: 0
All the USB HID driver code is located in /drivers/hid/ from the root kernel directory tree. Thankfully, it's quite easy to understand although you may have to do some Googling first (primary about the HID spec if you don't already know it).
 
Old 04-02-2009, 04:03 AM   #5
Xenation
LQ Newbie
 
Registered: Jan 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Drahcir View Post
All the USB HID driver code is located in /drivers/hid/ from the root kernel directory tree. Thankfully, it's quite easy to understand although you may have to do some Googling first (primary about the HID spec if you don't already know it).
But it looks the USB core now redirects the touchscreen to the usb hid driver. How can I redirect it to my own driver?
 
Old 04-02-2009, 09:19 AM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 23,711

Rep: Reputation: 6943Reputation: 6943Reputation: 6943Reputation: 6943Reputation: 6943Reputation: 6943Reputation: 6943Reputation: 6943Reputation: 6943Reputation: 6943Reputation: 6943
Quote:
Originally Posted by Xenation View Post
My distro is not mentioned. But the main thing is that it's recognized as USB hid. If I would write my own driver with specific VendorID and productID, will it overload the other 'driver' ?

And how do I know what kernel driver a device uses? What code will be called at the moment when I touch the screen.
And you still haven't mentioned it. There's Fedora, SuSE, Slackware and Ubuntu on their site, as well as the source-code driver, ready to compile and use.
 
Old 04-03-2009, 03:35 AM   #7
Xenation
LQ Newbie
 
Registered: Jan 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by TB0ne View Post
And you still haven't mentioned it. There's Fedora, SuSE, Slackware and Ubuntu on their site, as well as the source-code driver, ready to compile and use.
I'm using Android. I need myself a kernel driver. But I'm almost there at the moment. Just need to get the correct X and Y values from the device. I yet don't know what to do with the data I'm getting in from it.
 
Old 04-03-2009, 08:10 AM   #8
TimothyEBaldwin
Member
 
Registered: Mar 2009
Posts: 249

Rep: Reputation: 27
Quote:
Originally Posted by TB0ne View Post
You don't say anything about what version/distro of Linux, but did you Google for this? Or visit the PenMount website?

http://www.penmount.com/down_2_1.php

Lots of ready-to-go Linux drivers for your device......
In the installer for Ubuntu:
Code:
sudo cp -f xorg.conf /etc/X11/xorg.conf
Now are they malicious, or just plain stupid?
 
  


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
Writing PCIe device driver pythonarms Linux - Kernel 0 02-23-2009 01:45 PM
Help in writing device driver ankit_chaudhri Programming 3 11-13-2007 11:50 AM
Device Driver Writing Guide SJD Linux - Hardware 1 04-11-2007 12:01 PM
Writing Device Driver... okeyla Programming 3 05-18-2005 07:41 AM
Need help in writing device driver eshwar_ind Programming 1 02-07-2004 03:46 PM

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

All times are GMT -5. The time now is 06:59 PM.

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