LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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
 
LinkBack Search this Thread
Old 08-25-2008, 01:36 PM   #1
bapigoo9
Member
 
Registered: Aug 2008
Posts: 107

Rep: Reputation: 16
USB device programming in Linux, how to R/W to USB DB-9 connector


This post is about a USB device that I bought that connects to the USB port and that has a DB-9 "serial" connector on it. I would like to write some Linux software to be able to read and write to the 9 pins or to whatever pins I can R/W to. I know that Linux has a device for USB, namely /dev/usb, though I would like to find out how I can write code to interact with the usb port that I connect the device to.

Anyone who has done this type of pin R/W for a USB port who can tell me how to get started would be helpful. I found a ton of websites on USB and Linux...just not one that gives answers to how to do this in software on Linux.

The device did some with a mini-cd and $$$ drivers. I want to use Linux drivers or Linux utilities to R/W to the USB, and have since tossed the mini-cd into the deep ditch.

Last edited by bapigoo9; 08-25-2008 at 01:53 PM.
 
Old 08-25-2008, 03:21 PM   #2
MS3FGX
Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,850

Rep: Reputation: 350Reputation: 350Reputation: 350Reputation: 350
So then you are dealing with a USB to RS-232 adapter? In that case, you should be able to do anything you can do on a real serial port by just addressing the adapter's device node. The adapter is designed to be transparent to software, so you should really be looking into Linux serial port guides, and ignore the fact it is a USB device.

Unless there is something more advanced you are trying to do?
 
Old 08-25-2008, 04:16 PM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,390
Blog Entries: 2

Rep: Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900
What MS3FGX says is true only if there is a (Linux) driver installed for the adapter. If not, you would have to locate one (from the device vendor, in all likelihood), write one, or use a different such adapter that does have driver support. Writing your own driver would be difficult at best.
--- rod.
 
Old 08-25-2008, 04:42 PM   #4
bapigoo9
Member
 
Registered: Aug 2008
Posts: 107

Original Poster
Rep: Reputation: 16
There is no device driver for the USB device for Linux that I have seen, unless you are aware of one? MS3FGX.

Right now, it does not follow any RS232 communication standard. It is a plain DB-9 pin connector on one end with a USB connector on the other end. So, how can I R/W to the pins on the DB9 from Linux (which would be R/W to the USB if you are understanding the device.)
 
Old 08-25-2008, 07:43 PM   #5
MS3FGX
Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,850

Rep: Reputation: 350Reputation: 350Reputation: 350Reputation: 350
Well, again, if it is a standard USB to RS-232 adapter; then these are very common devices and are supported natively in the kernel by a number of chipset-specific drivers.

But from your description it sounds more like you have a USB male end on one side, and a DB-9 female on the other? In that case, this is some proprietary adapter that must be for a specific device which uses USB pinouts in the DB-9 formfactor. You wouldn't be able to do anything with this device, as USB only makes use of 4 wires (VCC, Ground, D+, D-), and doesn't operate on the same principles as a RS-232 port. There is no concept of bringing one of the wires "high" on USB, since the individual lines are not controlled by software; the power lines are constant and the two data lines work together.
 
Old 08-26-2008, 02:08 AM   #6
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 3,860

Rep: Reputation: 768Reputation: 768Reputation: 768Reputation: 768Reputation: 768Reputation: 768Reputation: 768
There are several things about this thread that make no sense to me.
  • Is there any evidence that there is an RS 232 interface - the D-type connector used on RS 232 is a common connector and just because there is one of those does not mean that there is an RS232 interface?
  • It is unclear what the underlying objective would be; assuming that there is an RS 232 interface, why would you want to write to it? In other words, what do you hope this to achieve? If it is RS 232 normal operation will have various characters being passed back and forth and if you managed to force some line permanently high, for example, you would break normal operation, at least for the duration of the line being held high. In what way would this be an advantage to you?
 
Old 08-26-2008, 02:50 PM   #7
MS3FGX
Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,850

Rep: Reputation: 350Reputation: 350Reputation: 350Reputation: 350
I imagine he might be interfacing a device with the computer via serial port, and rather than have a complicated digital converter decoding the binary data he would rather bring the lines high to directly trigger relays and the like.
 
Old 08-28-2008, 09:57 AM   #8
bapigoo9
Member
 
Registered: Aug 2008
Posts: 107

Original Poster
Rep: Reputation: 16
Quote:
you should be able to do anything you can do on a real serial port by just addressing the adapter's device node. The adapter is designed to be transparent to software, so you should really be looking into Linux serial port guides, and ignore the fact it is a USB device.
Can you give some example code of addressing the device and individual pins of the DB-9? The connectors are a standard USB "male" (same as on a Flash USB stick) and a DB-9 male, or what you called a USB to RS-232 adapter.

What are the standard chipset drivers for this device? There are no Linux vendor supplied drivers for it that shipped with the device.
 
  


Reply

Tags
linux, programming, usb


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
USB drive not working properly, read only device? (USB key storage device) Arodef Linux - Hardware 14 01-01-2010 07:32 AM
How to disable USB Mass Storage device ( usb drive ) in Linux vijaush Linux - Newbie 4 06-25-2008 09:43 AM
Linux USB device driver programming? redarrow Programming 6 02-03-2008 02:54 AM
How to force kernel to use a USB 2.0-compatible device (ehci_hcd) as a USB 1.1 device eze Linux - Hardware 0 05-16-2006 05:24 AM
HP Deskjet (USB) & CUPS & Slackware 9.1: Unable to open USB device "usb:/dev/usb/lp0&qu arnostienen Slackware 2 01-29-2004 03:22 PM


All times are GMT -5. The time now is 03:20 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