Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

bad ioctl - what's the error?
Hi,

This is probably a really dumb question, but it's late at night & I'm
posting here because I found this posting <http://tinyurl.com/6rmlj>
really helpful when I started trying to dig into this earlier this
evening.

I'm trying to get a Conexant PCI ADSL modem running under Linux 2.6.11
- the firmware doesn't seem to be uploading to the card, and so I'm
trying to work out what's going on. A previous version of the driver
works perfectly under a 2.6.9 kernel, but I gather the driver has been
updated to accommodate some API changes > 2.6.10. Apparently this
driver works fine for a few others who have used it, but I seem to be
doing everything by the instructions, so I don't see what else to do
apart from digging into the code to work out what's happening.

The firmware loader fails with the error message "bad ioctl 400c2502,
Status=c00000b5", which I find is printed by the following code:

Status = ioctl( SocketID, CommandID, &Socketioc );
if ( Status < 0 )
{
printf( " bad ioctl %x, Status=%x\n", CommandID, Status );
return STATUS_FAILURE;
}

So the "Status=c00000b" refers directly to the return value of the
`ioctl` call, right? I'm new to this side of things, but as I
understand it `ioctl` allows the programmer to interface with &
generally talk to the hardware device. So what does c00000b mean in
this case, please? (I have a feeling it's going to mean the kernel
module is b0rked, but I'm prepared to wait & see on that).

`man ioctl` tells me that:

RETURN VALUE
Usually, on success zero is returned.  A  few  ioctls  use  the
return
value as an output parameter and return a nonnegative value on
success.
On error, -1 is returned, and errno is set appropriately.
ERRORS
EBADF  d is not a valid descriptor.
EFAULT argp references an inaccessible memory area.
..

So my understanding is that "c00000b" isn't a valid return value for
`ioctl`. I thought initially that "c00000b" must be hex for the errno,
but grepping errno.h has not been enlightening.

I've tried editing the code so it returns a decimal integer, i.e.:
printf( " bad ioctl %x, Status=%x, %d\n", CommandID, Status, Status
);
however the error message displayed becomes:
bad ioctl 400c2502, Status=c00000b5, -1073741643
which doesn't make any more sense to me.

If someone could help me understand this, I would be extremely
grateful,

Stroller.


Report this thread to moderator Post Follow-up to this message
Old Post
Stroller
04-10-05 08:57 AM


Re: bad ioctl - what's the error?
Hello,

> I'm trying to get a Conexant PCI ADSL modem running under Linux
2.6.11
> - the firmware doesn't seem to be uploading to the card, and so I'm
> trying to work out what's going on.

[snip]

> The firmware loader fails with the error message "bad ioctl 400c2502,
> Status=c00000b5", which I find is printed by the following code:
>
> 	Status = ioctl( SocketID, CommandID, &Socketioc );
> 	if ( Status < 0 )
> 	{
> 		printf( " bad ioctl %x, Status=%x\n", CommandID, Status );
> 		return STATUS_FAILURE;
> 	}
>
> So the "Status=c00000b" refers directly to the return value of the
> `ioctl` call, right? I'm new to this side of things, but as I
> understand it `ioctl` allows the programmer to interface with &
> generally talk to the hardware device. So what does c00000b mean in
> this case, please? (I have a feeling it's going to mean the kernel
> module is b0rked, but I'm prepared to wait & see on that).

ioctl() is meant to be a general interface for every possible device
drivers. As a result , the CommandID parameter, the Socketioc
parameters, and the value returned by ioctl() rely direly on the driver
itself.

With other words, if you get status c00000b5 for command 400c2502, you
have to read the spec of the modem driver (or alternatively, the
source) to know what it really means.


> `man ioctl` tells me that:
>
>   RETURN VALUE
>        Usually, on success zero is returned.  A  few  ioctls  use
the
> return
>        value as an output parameter and return a nonnegative value on
> success.
>        On error, -1 is returned, and errno is set appropriately.
>   ERRORS
>        EBADF  d is not a valid descriptor.
>        EFAULT argp references an inaccessible memory area.
>        ...
>
> So my understanding is that "c00000b" isn't a valid return value for
> `ioctl`. I thought initially that "c00000b" must be hex for the
errno,
> but grepping errno.h has not been enlightening.

This is not quite correct. ioctl() and the resulting error codes are
only standardized for STREAMS devices.  For non STREAMS devices, like
your modem, this call is unspecified. Which mean basically that it
might return whatever the driver/programmer feels like.


Hope this help,
Loic.


Report this thread to moderator Post Follow-up to this message
Old Post
loic-dev@gmx.net
04-11-05 09:00 PM


Re: bad ioctl - what's the error?
# The firmware loader fails with the error message "bad ioctl 400c2502,
# Status=c00000b5", which I find is printed by the following code:

On a 32-bit machine (int)0xc00000b5 is negative integer, Status<0. If the on
ly
error response is -1, you have to test for that specificly, Status==-1. We d
on't
know if your device can return an unsigned value that looks like a negative
integer without being -1 or an error.

The error number will be assigned to errno. You can print that, perror(),
and/or strerror(errno).

--
SM Ryan http://www.rawbw.com/~wyrmwif/
No pleasure, no rapture, no exquiste sin greater than central air.

Report this thread to moderator Post Follow-up to this message
Old Post
SM Ryan
04-11-05 09:00 PM


Re: bad ioctl - what's the error?
SM Ryan wrote:
> # The firmware loader fails with the error message "bad ioctl
400c2502,
> # Status=c00000b5", which I find is printed by the following code:
>
> The error number will be assigned to errno. You can print that,
perror(),
> and/or strerror(errno).

Thanks very much to both of you. Unless I'm doing something wrong, I'm
losing more & more hope each day in getting this driver working   ;)

Status = ioctl( SocketID, CommandID, &Socketioc );
Error = errno ;
if ( Status < 0 )
{
printf ( "Error is: " ); printf ( strerror(Error) );
printf ( "\n" );
printf( " bad ioctl %x, Status=%x, %d\n", CommandID,
Status, Status );
return STATUS_FAILURE;
}

Gives:

# /etc/Conexant/cnxadslload /etc/Conexant/
Error is: Success
bad ioctl 400c2502, Status=c00000b5, -1073741643
Last record not found - load terminating
download ARM micro code (downLoadMicroCode) failed,
NTStatus=c0000001

I posted about this error to my distro's -user list before I ended up
here, and someone there has brought another brand of modem
<http://www.sangoma.com/s518.htm> to my attention - I have to say that
their Linux support looks VERY tempting.

Stroller.


Report this thread to moderator Post Follow-up to this message
Old Post
Stroller
04-12-05 08:58 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Unix Programming archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:09 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.