LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-25-2000, 03:32 PM   #1
norsk
LQ Newbie
 
Registered: Oct 2000
Location: Heber City, Utah, USA
Posts: 2

Rep: Reputation: 0

I have a project I am working on, where we use a serial port (/dev/ttyS0) to communicate with our real device. Hence the serial port is simply a "bus driver" for the module. I have it working in user mode using standard open/read/write system calls. Now I am in the process of moving the upper driver into the kernel via a module, but I still need to use the serial driver as a bus driver to access my device.

The question is: How do I "open/read/write" the serial from the module. One of my leads is using filp_open(..), get the file * and use the read/write, etc structure methods from there. Is this the best way? or is there another operation I can use to get to the serial device?

I need to configure it to RAW mode, use hardware handshake if available. Pointers greatly appreciated.

thanks
doug


 
Old 10-28-2000, 11:56 AM   #2
jeremy
root
 
Registered: Jun 2000
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,597

Rep: Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080
I believe the answer is ioctl. More information is available here - http://howto.tucows.com/LDP/LDP/lkmpg/node18.html.
 
Old 10-28-2000, 10:11 PM   #3
norsk
LQ Newbie
 
Registered: Oct 2000
Location: Heber City, Utah, USA
Posts: 2

Original Poster
Rep: Reputation: 0
Red face open serial device from within a MODULE

Thanks jeremy,

but my module will not be a user program where I can open a serial device with the char device name ("/dev/ttyS1"). Rather as a module, I will already in the kernel and cannot use the glibc system call mechanism. It does the user mode to kernel mode transition. My code is already in the kernel, I just don't know the mechansim under linux to "hook" into the "open" path of another device also in the kernel.

Hence, my investigation indicates using the aforemention filp_open call. I need to play with this shortly. I was just wondering if others have tried something like this prior to myself doing it.

again thanks for the post

 
  


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
Error opening/initializing the selected video_out (-vo) device. Kdr Kane SUSE / openSUSE 1 02-25-2005 05:54 PM
gmplayer Error opening/initializing device cythrawll Slackware 3 12-08-2004 07:25 AM
Problem when opening device `any' in pcap barisdemiray Programming 0 10-09-2004 03:39 PM
ogg123 - error opening device oss iTux Linux - Software 1 12-15-2003 11:02 PM
Error opening/initializing the selected video_out(-vo) device zyxxm Linux - Software 1 06-29-2003 12:18 AM

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

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