Sudesh
Sudesh

Reputation: 141

Linux - Device node name ends with '?' What does this mean?

I have a device driver for Zigbee RF4CE that initializes correctly by the kernel. However, when my user space application wants to open the device, I get the error: Error: Opening device failed: No such file or directory

Doing an ls in the /dev folder shows that the device name ends with a question mark '?'

I would like to know why this is the case, when no special characters have been explicitly added to the device name in the script file I am using that creates the node.

Here is the portion of the script:

DEVICE_INPUT_MAJOR=`grep device-input /proc/devices | sed 's/^ *\([0-9]*\) .*$/\1/'`

if [ "$EUID" != "0" ] || [ "$1" == "-t" ] ; then
    if [ "$EUID" != "0" ] ; then
        echo
        echo "You need to be root to create the nodes."
        echo
    fi
    echo "Here is what would be done:"
    ECHO=echo
else
    ECHO=
fi

function create_if()
{
    name=$1
    major=$2
    minor=$3

    #echo $name $major $minor
    if [ "$major" != "" ] ; then

        $ECHO mknod $name c $major $minor

        echo -e $major "\t" $minor "\t" $name

    else
        echo -e "--- \t\t" $name
    fi
}

create_if $BASE_DIR/$MY_DEVICE_DIR/$MY_DEVICE "$DEVICE_INPUT_MAJOR" 0

How do I resolve this issue?

Upvotes: 3

Views: 353

Answers (1)

bogl
bogl

Reputation: 1864

One possible cause are non-printable characters in the script. This often happens when the script is written using (or copied from) Windows, and executed in a Unix/Linux environment.

You could check your script with an editor that displays non-printable characters.

Upvotes: 1

Related Questions