Re: Question about GTK+ and timers

2011-04-10 Thread Igor Korot
Hi, guys, On Sat, Apr 9, 2011 at 4:04 AM, Chris Vine ch...@cvine.freeserve.co.uk wrote: On Sat, 9 Apr 2011 00:14:45 -0700 Igor Korot ikoro...@gmail.com wrote: [snip] Is there any way to find out if the device is little- or big-endian? Which device are you referring to?  You appear to be

Re: Question about GTK+ and timers

2011-04-09 Thread Robert Pearce
Hi Igor, On Fri, 8 Apr 2011 18:08:30 -0700 you wrote: So, what is the best course of action? I just tested the program on the device and on x86. On x86 it produced correct results, whereas on the ARM device it didn't. So it looks like I will have to switch the endianess when running on the

Re: Question about GTK+ and timers

2011-04-09 Thread Igor Korot
Robert, On Fri, Apr 8, 2011 at 11:53 PM, Robert Pearce r...@bdt-home.demon.co.uk wrote: Hi Igor, On Fri, 8 Apr 2011 18:08:30 -0700 you wrote: So, what is the best course of action? I just tested the program on the device and on x86. On x86 it produced correct results, whereas on the ARM

Re: Question about GTK+ and timers

2011-04-09 Thread Robert Pearce
Hi Igor, On Sat, 9 Apr 2011 00:14:45 -0700 you wrote:   MyWordVal = buf[2] + ( buf[3] * 256 );  /* data stream is little endian */ This is portable and clear to any future maintainer. The efficiency loss is negligible. Is there any way to find out if the device is little- or

Re: Question about GTK+ and timers

2011-04-09 Thread Chris Vine
On Sat, 9 Apr 2011 00:14:45 -0700 Igor Korot ikoro...@gmail.com wrote: [snip] Is there any way to find out if the device is little- or big-endian? Which device are you referring to? You appear to be writing some code for a machine receiving data sent over a wire, and that machine's endianness

Re: Question about GTK+ and timers

2011-04-08 Thread Igor Korot
Hi, ALL, Apologies for possibly screwing up the threadding. I accidentally killed the messages in my INBOX. My (hopefully last) question here in this thread is: g_io_add_watch() should take a callback (i.e. static function) or just a regular function? Thank you.

Re: Question about GTK+ and timers

2011-04-08 Thread Robert Pearce
On Fri, 8 Apr 2011, Igor Korot ikoro...@gmail.com wrote : My (hopefully last) question here in this thread is: g_io_add_watch() should take a callback (i.e. static function) or just a regular function? Are you writing in C or C++? I assume you're using the straight Gtk for C as the function

Re: Question about GTK+ and timers

2011-04-08 Thread Igor Korot
Robert, On Fri, Apr 8, 2011 at 1:03 PM, Robert Pearce r...@bdt-home.demon.co.uk wrote: On Fri, 8 Apr 2011, Igor Korot ikoro...@gmail.com wrote : My (hopefully last) question here in this thread is: g_io_add_watch() should take a callback (i.e. static function) or just a regular function?

Re: Question about GTK+ and timers

2011-04-08 Thread Igor Korot
. Is it possible to use m_data with GIOChannel? Thank you. -Original Message- From: gtk-list-boun...@gnome.org [mailto:gtk-list-boun...@gnome.org] On Behalf Of Igor Korot Sent: Friday, April 08, 2011 3:54 PM To: gtk-list@gnome.org Subject: Re: Question about GTK+ and timers ... I decided

Re: Question about GTK+ and timers

2011-04-08 Thread Paul Davis
On Fri, Apr 8, 2011 at 6:14 PM, Igor Korot ikoro...@gmail.com wrote: Mikhail, On Fri, Apr 8, 2011 at 2:33 PM, Mikhail Titov m...@gmx.us wrote: As far as I understand it is possible to use it with NULL for encoding. It should just read bytes with no interpretation.

Re: Question about GTK+ and timers

2011-04-08 Thread Igor Korot
Paul, On Fri, Apr 8, 2011 at 3:28 PM, Paul Davis p...@linuxaudiosystems.com wrote: On Fri, Apr 8, 2011 at 6:14 PM, Igor Korot ikoro...@gmail.com wrote: Mikhail, On Fri, Apr 8, 2011 at 2:33 PM, Mikhail Titov m...@gmx.us wrote: As far as I understand it is possible to use it with NULL for

Re: Question about GTK+ and timers

2011-04-08 Thread Chris Vine
On Fri, 8 Apr 2011 21:03:47 +0100 Robert Pearce r...@bdt-home.demon.co.uk wrote: On Fri, 8 Apr 2011, Igor Korot ikoro...@gmail.com wrote : My (hopefully last) question here in this thread is: g_io_add_watch() should take a callback (i.e. static function) or just a regular function? Are

Re: Question about GTK+ and timers

2011-04-08 Thread Chris Vine
On Fri, 8 Apr 2011 15:43:17 -0700 Igor Korot ikoro...@gmail.com wrote: Paul, On Fri, Apr 8, 2011 at 3:28 PM, Paul Davis p...@linuxaudiosystems.com wrote: On Fri, Apr 8, 2011 at 6:14 PM, Igor Korot ikoro...@gmail.com wrote: Mikhail, On Fri, Apr 8, 2011 at 2:33 PM, Mikhail Titov

RE: Question about GTK+ and timers

2011-04-08 Thread Mikhail Titov
have to swap data within let's say m_voltageMask . Mikhail -Original Message- From: gtk-list-boun...@gnome.org [mailto:gtk-list-boun...@gnome.org] On Behalf Of Igor Korot Sent: Friday, April 08, 2011 5:43 PM To: gtk-list@gnome.org Subject: Re: Question about GTK+ and timers

Re: Question about GTK+ and timers

2011-04-08 Thread Igor Korot
: Question about GTK+ and timers Is it possible to use m_data with GIOChannel? of course. but you'd better hope that the compiler packs that data structure in the same way the device is sending it. you'd be far better off not using a struct for this, but just reading (in your case) 10

Re: Question about GTK+ and timers

2011-04-08 Thread Chris Vine
On Fri, 8 Apr 2011 18:36:41 -0500 Mikhail Titov m...@gmx.us wrote: Just use something like __attribute__ ((__packed__)) for your structure and you can always cast back and forth from the pointer to your structure to an array of bytes (char*). Just make sure that both systems have same ending

Re: Question about GTK+ and timers

2011-04-08 Thread Chris Vine
On Fri, 8 Apr 2011 16:45:03 -0700 Igor Korot ikoro...@gmail.com wrote: Mikhail, On Fri, Apr 8, 2011 at 4:36 PM, Mikhail Titov m...@gmx.us wrote: Just use something like __attribute__ ((__packed__)) for your structure and you can always cast back and forth from the pointer to your

RE: Question about GTK+ and timers

2011-04-08 Thread Mikhail Titov
: Chris Vine [mailto:ch...@cvine.freeserve.co.uk] Sent: Friday, April 08, 2011 7:02 PM To: Mikhail Titov Cc: 'Igor Korot'; gtk-list@gnome.org Subject: Re: Question about GTK+ and timers On Fri, 8 Apr 2011 18:36:41 -0500 Mikhail Titov m...@gmx.us wrote: Just use something like __attribute__

Re: Question about GTK+ and timers

2011-04-08 Thread Igor Korot
endian by default. Thank you. Mikhail -Original Message- From: Chris Vine [mailto:ch...@cvine.freeserve.co.uk] Sent: Friday, April 08, 2011 7:02 PM To: Mikhail Titov Cc: 'Igor Korot'; gtk-list@gnome.org Subject: Re: Question about GTK+ and timers On Fri, 8 Apr 2011 18:36:41 -0500

Re: Question about GTK+ and timers

2011-04-08 Thread Igor Korot
Chris, On Fri, Apr 8, 2011 at 5:02 PM, Chris Vine ch...@cvine.freeserve.co.uk wrote: On Fri, 8 Apr 2011 18:36:41 -0500 Mikhail Titov m...@gmx.us wrote: Just use something like __attribute__ ((__packed__)) for your structure and you can always cast back and forth from the pointer to your

Re: Question about GTK+ and timers

2011-04-07 Thread Robert Pearce
Hi Igor, On Wed, 6 Apr 2011 22:38:43 -0700 you wrote: Just one question: AFAIU this pair is polling the port for data and when they become available I need to drop them in the GUI. It's going to be something like MT, right? MT? It's not a threaded approach, if that's what you mean. Open

Re: Question about GTK+ and timers

2011-04-07 Thread Igor Korot
Hi, Robert, On Thu, Apr 7, 2011 at 12:59 AM, Robert Pearce r...@bdt-home.demon.co.uk wrote: Hi Igor, On Wed, 6 Apr 2011 22:38:43 -0700 you wrote: Just one question: AFAIU this pair is polling the port for data and when they become available I need to drop them in the GUI. It's going to

Re: Question about GTK+ and timers

2011-04-07 Thread Paul Davis
On Thu, Apr 7, 2011 at 2:07 PM, Igor Korot ikoro...@gmail.com wrote: Now you can hook up a call-back:    RxEventSrc = g_io_add_watch ( hFile, G_IO_IN, HandleAsyncRx, (gpointer)Instance ); But isn't it the same as registering the timer? not at all. And this is done the same way as the

Re: Question about GTK+ and timers

2011-04-07 Thread Igor Korot
Hi, On Thu, Apr 7, 2011 at 11:15 AM, Paul Davis p...@linuxaudiosystems.com wrote: On Thu, Apr 7, 2011 at 2:07 PM, Igor Korot ikoro...@gmail.com wrote: Now you can hook up a call-back:    RxEventSrc = g_io_add_watch ( hFile, G_IO_IN, HandleAsyncRx, (gpointer)Instance ); But isn't it the

Re: Question about GTK+ and timers

2011-04-07 Thread Paul Davis
On Thu, Apr 7, 2011 at 2:24 PM, Igor Korot ikoro...@gmail.com wrote: So is there one thread or two? ;-) one thread. this has the same problem that anything using a (G)UI event loop for I/O does - the callback may be delayed by other event handling. in the real world, this is rarely a problem,

Re: Question about GTK+ and timers

2011-04-07 Thread Igor Korot
OK, thanx. On Thu, Apr 7, 2011 at 11:47 AM, Paul Davis p...@linuxaudiosystems.com wrote: On Thu, Apr 7, 2011 at 2:24 PM, Igor Korot ikoro...@gmail.com wrote: So is there one thread or two? ;-) one thread. this has the same problem that anything using a (G)UI event loop for I/O does - the

Question about GTK+ and timers

2011-04-06 Thread Igor Korot
Hi, ALL, I read that the timer event processing is differ between x86 and ARM. On x86 it fires at 1/1000 interval, on ARM it fires at 10/1000 interval. If I use g_timeout_add_seconds( 1, ...) am I guaranteed that the timer events will fire with 1 sec interval independently of the arch? Thank

Re: Question about GTK+ and timers

2011-04-06 Thread Paul Davis
On Wed, Apr 6, 2011 at 2:49 PM, Igor Korot ikoro...@gmail.com wrote: Hi, ALL, I read that the timer event processing is differ between x86 and ARM. On x86 it fires at 1/1000 interval, on ARM it fires at 10/1000 interval. If I use g_timeout_add_seconds( 1, ...) am I guaranteed that the timer

Re: Question about GTK+ and timers

2011-04-06 Thread Igor Korot
Hi, Paul, My task is to read the external device thru the serial port with the 1 sec interval. And then update the GUI with the new data. At least the documentation of this device says that it will write with 1 sec. I am testing on x86, then cross-compiling for ARM and run the program on ARM.

Re: Question about GTK+ and timers

2011-04-06 Thread Robert Pearce
Hi Igor, On Wed, 6 Apr 2011 12:12:56 -0700 you wrote: My task is to read the external device thru the serial port with the 1 sec interval. And then update the GUI with the new data. At least the documentation of this device says that it will write with 1 sec. I am testing on x86, then

Re: Question about GTK+ and timers

2011-04-06 Thread Igor Korot
Hi, Robert, On Wed, Apr 6, 2011 at 3:42 PM, Robert Pearce r...@bdt-home.demon.co.uk wrote: Hi Igor, On Wed, 6 Apr 2011 12:12:56 -0700 you wrote: My task is to read the external device thru the serial port with the 1 sec interval. And then update the GUI with the new data. At least the