how to detect that serial gadget is connected

Andre Haupt <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
Hi Guys,

I am using gadget serial on an arm board connected to a windows host pc 
running minicom. Kernel version is 2.6.20.1.

Is there a way to detect if the gadget is connected from the gadget side?

Background is the following:
I open /dev/ttygserial in nonblocking mode on the start of my user 
application. If the board is not connected at this point,
subsequent reads on this file descriptor fail with EAGAIN. If i then 
connect the gadget, the read call still returns EAGAIN.
Re-opening /dev/ttygserial then makes it work.

Do i miss something here?

this is how i open the file:

    fd = open("/dev/ttygserial", O_RDWR | O_NOCTTY | O_NONBLOCK);
    if (fd < 0)
        perror("open");  

and this is how i read:

       int numBytes = read(fd,buff,MAILBOXSIZE);
       if (numBytes > 0) {
           //process data
       else
          perror("read");

Best regards,

Andre


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.