Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-30-2009, 09:08 AM   #1
LQ Newbie
Registered: Apr 2009
Location: australia
Posts: 12

Rep: Reputation: 0
Do i need integer to hex conversion, if yes how???

hie all,

void Clear_ControlPort_bit(int a)

int t;



printf("reading controlport\n");
printf("identifier = %d \n",_BV(a));
printf("p = %d \n",p);
a = p|_BV(a);

/* not going to read loop but taking p value*/






void Write_ControlPort(int a)

printf("writing to port\n");

Do i need to convert the value of a to hex before writing to control port??? Because its showing a segmentation fault at "outb"

please help me
Old 04-30-2009, 09:30 AM   #2
LQ Guru
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190
How about a little context of what you are trying to do?

I don't know what weird device you might be trying to control, so I'm a tiny bit short of 100% certain no form of conversion to hex is required before writing to its port. (That answers your explicit question).

Linux is a protected OS, so ordinary code can't ordinarily write to ports. So that is probably the source of the fault.

If you have done something to make writing to that port valid, that should have been part of the context you should have provided for your question.

If you haven't done anything to make writing to that port valid, here is the first link I found just now googling the topic:
It seems to be a good explanation of the basics.

Last edited by johnsfine; 04-30-2009 at 09:35 AM.


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
[bash] ASCII to HEX and hex to ascii ////// Programming 16 05-11-2016 07:29 AM
Hex output of a hex/ascii input string mlewis Programming 35 04-10-2008 12:05 PM
C++ string to integer conversion fatman Programming 6 06-18-2006 08:17 AM
Hex socks Linux - General 4 02-17-2005 12:05 PM
hex? Nox Solaris Linux - Newbie 3 12-07-2002 08:52 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:41 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration