LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 06-12-2008, 03:05 AM   #1
galapogos
Member
 
Registered: May 2008
Posts: 227

Rep: Reputation: 30
Talking to an I/O device


Hi,

I'm trying to write an application in C that sends SCSI commands to a USB Mass Storage device in Linux. I know how to do this in Windows using devioctl library function calls, but I've no experience doing this in Linux. From what I've gathered the equivalent function call is ioctl, but I'm not sure how to use it. I've read the man pages and some online help/tutorials but the call seems to be quite different from the way it's used in Windows...or maybe I'm understanding it wrongly.

Are there any tutorials on device communication programming?

TIA.
 
Old 06-12-2008, 07:44 AM   #2
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
ioctl behaves differently for almost every driver, so you'll have to look at the scsi driver source to see the supported ioctls
 
Old 06-12-2008, 01:29 PM   #3
JudyL
LQ Newbie
 
Registered: Aug 2007
Location: Florida, USA
Distribution: Ubuntu
Posts: 29

Rep: Reputation: 15
IMHO, the biggest difference is that windows has separate input and output buffers whereas linux uses a common buffer. At a minumum, you'll need to determine what the equivalent linux IOCTL is for each windows IOCTL and switch to the corresponding common linux data structure. Even that may not be enough - I don't know enough about how the storage stack is implemented on linux to know if issuing the same stream of SCSI commands will do the same as it does on windows. You would think it should (SCSI is SCSI after all), but never assume anything when dealing with kernels.

Judy
 
  


Reply



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
What are they talking about ATLAS? abefroman Linux - Security 1 04-21-2008 06:35 PM
Talking Movies Hitboxx General 1 01-06-2007 07:35 PM
Grandma not talking to me Envision5000 General 5 06-21-2006 08:46 AM
we are talking NewBe here OK? spookn Linux - Newbie 7 03-28-2004 06:08 PM
talking about movies titanium_geek General 2 11-19-2003 07:13 PM

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

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