Hardware interactions on Linux

Thread Solved
Reply

Join Date: Mar 2008
Posts: 45
Reputation: Crushyerbones is an unknown quantity at this point 
Solved Threads: 1
Crushyerbones's Avatar
Crushyerbones Crushyerbones is offline Offline
Light Poster

Hardware interactions on Linux

 
0
  #1
Mar 23rd, 2008
Does anyone here have any tips on using inb and outb for interacting with hardware on a Linux system? iopl(2) and inb(0x61) don't seem to work very nicely... Infact, inb(0x61) gives me a segfault.



PS: My reliance on this forum is starting to become embarrassing
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,160
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1437
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: Hardware interactions on Linux

 
0
  #2
Mar 23rd, 2008
>>Does anyone here have any tips on using inb and outb for interacting with hardware on a Linux system?

Yes -- you can not use them because the os won't let you access the ports directly.

>>Infact, inb(0x61) gives me a segfault.
Yup
Last edited by Ancient Dragon; Mar 23rd, 2008 at 6:22 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 45
Reputation: Crushyerbones is an unknown quantity at this point 
Solved Threads: 1
Crushyerbones's Avatar
Crushyerbones Crushyerbones is offline Offline
Light Poster

Re: Hardware interactions on Linux

 
0
  #3
Mar 24th, 2008
Originally Posted by Ancient Dragon View Post
>>Does anyone here have any tips on using inb and outb for interacting with hardware on a Linux system?

Yes -- you can not use them because the os won't let you access the ports directly.

>>Infact, inb(0x61) gives me a segfault.
Yup
Damn... My XP machine is also running the same program (modified for windows, obviously) kinda funky... And there's no way I'm getting Vista back on my laptop
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,160
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1437
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: Hardware interactions on Linux

 
0
  #4
Mar 24th, 2008
No version of MS-Windows since Win95 nor any version of *nix will allow you to use those inp and outp functions. So putting Vista back won't help you either.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 45
Reputation: Crushyerbones is an unknown quantity at this point 
Solved Threads: 1
Crushyerbones's Avatar
Crushyerbones Crushyerbones is offline Offline
Light Poster

Re: Hardware interactions on Linux

 
0
  #5
Mar 24th, 2008
Originally Posted by Ancient Dragon View Post
No version of MS-Windows since Win95 nor any version of *nix will allow you to use those inp and outp functions. So putting Vista back won't help you either.
I know, that's why I said modified for windows. As in replacing inb and outb with inportb and outportb.
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 2
Reputation: sbesch is an unknown quantity at this point 
Solved Threads: 1
sbesch sbesch is offline Offline
Newbie Poster

Re: Hardware interactions on Linux

 
0
  #6
Aug 11th, 2009
I realize that this thread is old, but it is still useful to correct an erroneous assertion about inb(), outb(), etc., especially given that Google drops people in here when looking for an answer to why these functions segfault, even when all the advice featured elsewhere is followed.

The truth is that these functions do in fact work, even under the most recent versions of the kernel (as of 8/11/09). However, they will not work from a user mode program unless the program is run as root (sudo...). It is also true that they will segfault if iopl(3) is not used. iopl(2) is not good enough. It is also true that the method of using ioperm() fails, apparently no matter how it is used. This may have worked in older kernels, but it now always gives a segfault. The only means of using these function seems to be calling iopl(3) first. (Ubuntu Interpid, 2.6.28-15-generic, x86_64 GNU/Linux)
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 45
Reputation: Crushyerbones is an unknown quantity at this point 
Solved Threads: 1
Crushyerbones's Avatar
Crushyerbones Crushyerbones is offline Offline
Light Poster

Re: Hardware interactions on Linux

 
0
  #7
Aug 17th, 2009
Better late than never. Many thanks, this problem cost me a good grade last year
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC