LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 04-23-2012, 05:49 PM   #1
linux1001
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);
if(fd>0)
{

rc=read(fd,&BIT_buff, sizeof(BIT_Qfile);
// handle any error
if(ioctl(fd,MEMGETINFO,&meminfo) != 0)
{
close(fd);
printf("Failed at call to ioctl with MEMGETINFO.");
return(rc);
} /* 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 09:30 AM.
 
Old 04-24-2012, 09:31 AM   #2
linux1001
LQ Newbie
 
Registered: Apr 2012
Posts: 2

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


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:30 PM.

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