Bad File Descriptor error

4 replies [Last post]
Dan Wang
Title: NooBot+
Joined: 02/08/2010
Posts:
BotPoints: 29
User offline. Last seen 3 years 48 weeks ago.

Our create robot program does not run if the "create_connect()" command is included at the beginning of the main method. The LINK compiles the program with no errors, but once it is running the output looks like this:

::read: Bad file descriptor
::read: Bad file descriptor
::read: Bad file descriptor
::read: Bad file descriptor
::read: Bad file descriptor
::read: Bad file descriptor
::read: Bad file descriptor

(etc.)

If we delete the create_connect() method from our program, it compiles and runs, but our robot cannot move since the create doesn't get enabled.

Does anyone know how to solve this problem?

Beta
Beta's picture
Title: The Magnificent
Joined: 02/24/2012
Posts:
BotPoints: 266
User offline. Last seen 3 years 44 weeks ago.

Interesting. This might be a hardware issue. Try running the following program:

  1. int main() {
  2. system("ls /dev");
  3. return 0;
  4. }

Let me know if it lists "ttyS2" in the output. You might need to scroll up.

Also, make sure you are using the latest firmware (1.9.5). You might also want to reach out to KIPR support directly. KIPR's number is (405) 579 4609.

Thanks.

Braden McDorman

Developer of the KIPR Link, KISS IDE, KIPR's 2D Simulator, and CBCJVM.

Reach me at bmcdorman(cat)kipr(dog)org where (cat)=@ and (dog)=. if you need assistance of any kind.

Dan Wang
Title: NooBot+
Joined: 02/08/2010
Posts:
BotPoints: 29
User offline. Last seen 3 years 48 weeks ago.

When I run that program it lists "ttyS2" in the output, and it has version 1.9.5 of the firmware installed. I'll try calling that number; thanks for the help.

Dan Wang
Title: NooBot+
Joined: 02/08/2010
Posts:
BotPoints: 29
User offline. Last seen 3 years 48 weeks ago.

It turns out that we used a open() method in our program. This was the cause of the errors. When we changed it to something else, the errors went away and we were able to run our program. However, the method was not in the Botball documentation, so we had no idea we couldn't use it for our own purpose (to open a claw).

Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
Posts:
BotPoints: 1168
User offline. Last seen 2 years 30 weeks ago.

open() isn't part of the Botball libraries; it's part of Linux. So I wouldn't expect it to be in Botball's documentation.

This sounds like an issue that would be discovered fairly easily by making a reduced test case -- is that how you figured it out? (My paper from 2012, Bug-Hunting 101, discusses this topic.)

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS