Hi Brian, Edward, and Sven,

Checking out /proc/bus/usb/devices seems to work, so thanks for your help.  I 
fear it
isn't a complete enough solution, but it will have to do in the meantime.  If 
anyone
else knows a way to possibly trace the connection back through the joystick 
port it
is registered under, that would be appreciated.

Regarding the large, fast, heavy robots...treaded yes, but still waiting on the
cannon ;)

Cheers,
Tim

"Brian T. Brunner" wrote:

> As said, system() allows you to grep relatively directly from within a C 
> program.
> Also you can fopen("/proc/bus/usb/devices","r"); (or any other part of /proc)
> and look at the contents yourself.
>
> Also suggested: this is a job for the driver, which could raise a signal
> to a process requesting one from the driver.
> Do you have driver source available? (I'm guessing you're writing the 
> bastage).
>
> Large fast heavy robots..... with treads and a 125mm cannon?
>
> Brian Brunner
> [EMAIL PROTECTED]
> (610)796-5838
>
> >>> Tim Arney <[EMAIL PROTECTED]> 11/18/04 08:57AM >>>
> Hi Edward,
>
> So can I execute grep from within a C program?
>
> Is there no way you know of using the usb library directly?
>
> Cheers,
> Tim
>
> Quoting Edward <[EMAIL PROTECTED]>:
>
> > Hello Tim,
> >
> > My best bet would be to grep the /proc/bus/usb/devices file for your
> > joystick device.
> >
> > HTH
> > Edward
> >
> > ----- Original Message -----
> > From: "Tim Arney" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, November 18, 2004 13:51
> > Subject: [Linux-usb-users] Detecting unplugged device
> >
> >
> > > Hi all,
> > >
> > > I've written a C/C++ program for controlling a robot with a USB joystick
> > > under linux.  For this I'm using the joydev module.  Some of our robots
> > > are quite large and fast, and a safety concern is with the joystick
> > > being unplugged, then the robot should stop.  As it stands, when the
> > > joystick is disconnected the "read" call blocks as though there is no
> > > new data.  I could open the joystick port as non-blocking, but then
> > > "read" just returns like there's no new data.  What I really need to be
> > > able to do is determine whether the joystick is still attached, and I
> > > figure somewhere along the chain (kernel->usb->input->joystick) someone
> > > knows whether it's there, and my best guess would be the linux usb
> > > driver.  So anyway, I'm essentially looking for a point in the right
> > > direction as to how I might test to see if the joystick is connected
> > > from my C/C++ program?
> > >
> > > If it helps I'm using Debian Sarge with Linux kernel 2.4.26 on an i686
> > > system.
> > >
> > > Thanks a lot,
> > > Tim
> > >
> > >
> > > --
> > > UTS CRICOS Provider Code:  00099F
> > > DISCLAIMER: This email message and any accompanying attachments may
> > contain
> > > confidential information.  If you are not the intended recipient, do not
> > > read, use, disseminate, distribute or copy this message or attachments.
> > If
> > > you have received this message in error, please notify the sender
> > > immediately and delete this message. Any views expressed in this message
> > > are those of the individual sender, except where the sender expressly, and
> > > with authority, states them to be the views the University of Technology,
> > > Sydney. Before opening any attachments, please check them for viruses and
> > > defects.
> > >
> > >
> > > -------------------------------------------------------
> > > This SF.Net email is sponsored by: InterSystems CACHE
> > > FREE OODBMS DOWNLOAD - A multidimensional database that combines
> > > robust object and relational technologies, making it a perfect match
> > > for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
> > > _______________________________________________
> > > [EMAIL PROTECTED]
> > > To unsubscribe, use the last form field at:
> > > https://lists.sourceforge.net/lists/listinfo/linux-usb-users
> > >
> >
>
> --
> UTS CRICOS Provider Code:  00099F
> DISCLAIMER: This email message and any accompanying attachments may contain
> confidential information.  If you are not the intended recipient, do not
> read, use, disseminate, distribute or copy this message or attachments.  If
> you have received this message in error, please notify the sender
> immediately and delete this message. Any views expressed in this message
> are those of the individual sender, except where the sender expressly, and
> with authority, states them to be the views the University of Technology,
> Sydney. Before opening any attachments, please check them for viruses and
> defects.
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: InterSystems CACHE
> FREE OODBMS DOWNLOAD - A multidimensional database that combines
> robust object and relational technologies, making it a perfect match
> for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
> _______________________________________________
> [EMAIL PROTECTED]
> To unsubscribe, use the last form field at:
> https://lists.sourceforge.net/lists/listinfo/linux-usb-users
> *******************************************************************
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> This footnote also confirms that this email message has been swept
> for the presence of computer viruses.
>
> www.hubbell.com - Hubbell Incorporated




-- 
UTS CRICOS Provider Code:  00099F
DISCLAIMER: This email message and any accompanying attachments may contain
confidential information.  If you are not the intended recipient, do not
read, use, disseminate, distribute or copy this message or attachments.  If
you have received this message in error, please notify the sender 
immediately and delete this message. Any views expressed in this message 
are those of the individual sender, except where the sender expressly, and 
with authority, states them to be the views the University of Technology, 
Sydney. Before opening any attachments, please check them for viruses and 
defects.


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

Reply via email to