[gtkmm] Problem with Glib::signal_io
- From: "Find All" <find_all hotmail com>
- To: gtkmm-list gnome org
- Subject: [gtkmm] Problem with Glib::signal_io
- Date: Fri, 26 Mar 2004 13:16:41 +0000
I'm trying to use a caracter device that uses the parallel port for the
comunication.
I create a driver for this device, which works well (I used it in another
proyect with another graphic library).
Here is the code:
paralelo.hh
***********
#ifndef _PARALELO_HH
#define _PARALELO_HH
#include "config.h"
#include <iostream>
#include <stdio.h>
#include <sys/shm.h>
#include <glib-2.0/glib.h>
#include <unistd.h>
#include <gtkmm.h>
#include <sigc++/signal.h>
#include <sys/ioctl.h>
class paralelo : public SigC::Object
{
public:
paralelo();
virtual ~paralelo();
gchar port[50];
gint fd;
gint start();
bool callback_funcion(Glib::IOCondition);
protected:
private:
SigC::Connection conexion;
};
#endif
paralelo.cc
*************
#include "paralelo.hh"
// Start the listening
gint paralelo::start()
{
this->fd = open(this->port, O_RDWR);
if(this->fd<0)
{
// ERROR
}
this->conexion =
Glib::signal_io().connect(SigC::slot(*this,¶lelo::callback_funcion),
this->fd,
//Glib::IOChannel::create_from_fd(this->fd), // I've also try
this, but the same result
Glib::IO_IN);
return 0;
}
The problem is that when the start function is called, the callback_funcion
is executed all the time, behaving as the device has always something to
read.
The same code with a normal serial port works well (the callback_funcion is
only called when there is something on the port, not all the time).
The driver worked well on a RedHat 7.1 with a kernel 2.4.18-1 and Xforms
graphic library (yes this graphic library is quite old :-) ).
Actually I'm using RedHat 8.0, with a kernel 2.4.18-14, gtkmm-2.0 and
sigc++-1.2.
The driver for the device doesn't implement all the function of a caracter
device (for example the flush option is disabled), and some other don't
behave as a caracter device should do (for example the read function works
diferent).
Could this affect the behaviour of the signal_io function???
_________________________________________________________________
¿Estás pensando en cambiar de coche? Todas los modelos de serie y extras en
MSN Motor. http://motor.msn.es/researchcentre/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]