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-23-2012, 04:49 PM   #1
LQ Newbie
Registered: Apr 2012
Posts: 2

Rep: Reputation: Disabled
'ioctl ()' returns error on IDE access

This is for a single board computer running Linux. There is no physical hard drive in the system but is using onboard flash chips. Earlier we used DiskOnChip which I could access at "/dev/discs/disc0/disc". Recently started using a new board which has a different flash chip and is on IDE bus.
I am trying to port some of the drivers and the 'ioctl()' call is failing.
Here is the original code (irrelevant code lines have been omitted):
********* code -start **********
fd=open(BIT_FILE, O_RDWR);

rc=read(fd,&BIT_buff, sizeof(BIT_Qfile);
// handle any error
if(ioctl(fd,MEMGETINFO,&meminfo) != 0)
printf("Failed at call to ioctl with MEMGETINFO.");
} /* END of if(ioctl(fd,MEMGETINFO,&meminfo) != 0) */
} /* END of if(fd>0) */

****** END of code ******
This all works great on the first board where the BIT_FILE is defined as "/dev/mtd/0".
When I try the same code on the second ( with solid state on-board IDE drive) it fails.
I can see the error message printed on the console which shows that the ioctl call with MEMGETINFO failed.
I modified the definition of BIT_FILE to different things as follows with the same resuults: "/dev/discs/disc0/part1" and tried "/dev/ide/host1/bus0/target0/lun0/disc/part1".
My question is: what should I use for BIT_FILE while 'opening anew file' which is further used for 'ioctl()' operation?
I guess any generic solution that uses a drive on IDE bus should work for my problem. Anyone, any suggestions please?
Thanks in advance.

Last edited by linux1001; 04-24-2012 at 08:30 AM.
Old 04-24-2012, 08:31 AM   #2
LQ Newbie
Registered: Apr 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
Anyone, any thoughts, suggestions please??


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
Usb driver programming, ioctl returns -1 wybourn Programming 2 07-23-2010 06:54 AM
ioctl(SIOCGIFCONF) returns only loopback interface info Braiam Linux - Software 0 03-08-2010 01:42 PM
ioctl call returns error. HarryBoy Programming 6 09-10-2008 10:08 AM
(ioctl(ts->fd, EVIOCGVERSION, &version) returns me -1, why?? webquinty Linux - Newbie 3 07-07-2008 07:54 AM
Samba returns access denied error. wbinfo -t fails. aleida Linux - Networking 2 08-18-2005 09:49 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:42 PM.

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