It is currently Fri Sep 10, 2010 2:46 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 74 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
 Post subject: LIRC Client
PostPosted: Fri Jan 05, 2007 4:22 pm 
Plugin Developer

Joined: Tue Jan 02, 2007 5:08 pm
Posts: 373
Hello!

This is the Lirc Client plugin support thread, post any questions, comments, suggestions, bug reports etc. about this plugin in this thread. As always feedback from users would be very welcome!

I have posted a guide explaining how to run winlirc with realtime priority, which improves it's performance, in this post.

As of December 2007 you can find the latest version of these files in the EventGhost SVN. They are also included in all future beta versions, so easiest way to obtain the latest version is to install the latest nightly beta.

I have quoted the original starting post for the thread below, since it's become quite irrelevant as a starting post. :)


Plugin Developer,
-jinxdone

Quote:
Hi!

It reads on the wiki that a plugin for these remotes can't currently be written:
* LIRC Serial Port Receiver
* IgorPlug

I thaught that in the meantime before somebody writes a plugin for using those devices directly I would just continue using winlirc, but there wasn't a plugin for that either, so I wrote one..

you can get it here: http://www.zendurl.com/jinxdone/files/Lirc-v0.5.0.zip

**EDIT** newer version is as an attachment


It's still a work in progress, but gets the job done. As far as improvements go I was hoping to hear what you guys have to say about it? Also If you want to test it I'd like to hear what you think. :)

Also I need to do a few changes in it which of I'm not sure how to:
1. If no socket connection can be opened, disable the plugin (Same what the Disable Item action does, and as far as i understand this might not be currently possible)
2. A better way of creating enduring events is needed, as the current one is quite a hack, so ideas are welcome.



Btw why there aren't attachments allowed in this forum?


Attachments:
File comment: Fourth edition of v0.7.0
Lirc-v0.7.0.zip [6.57 KiB]
Downloaded 971 times
Lirc-v0.6.0.zip [4.25 KiB]
Downloaded 329 times


Last edited by jinxdone on Fri Jul 31, 2009 3:27 pm, edited 14 times in total.
Top
 Profile  
 
 Post subject: Re: (Win)Lirc event reader plugin
PostPosted: Fri Jan 05, 2007 7:23 pm 
Site Admin
User avatar

Joined: Mon Feb 06, 2006 11:28 pm
Posts: 2236
Very nice work. I currently can't try it out, because I disassembled my Lirc receiver.

jinxdone wrote:
1. If no socket connection can be opened, disable the plugin (Same what the Disable Item action does, and as far as i understand this might not be currently possible)

No, and it shouldn't disable itself. But you can raise an exception inside your __start__ method to indicate your plugin didn't started up correctly. EG will then show your plugin in red. Just write:
Code:
raise eg.Exception("The reason why it didn't work")

But EG will regardless of that call your __stop__/__close__ methods, so you have to take care that they don't depend on something that should have done successful in the __start__ method.

jinxdone wrote:
2. A better way of creating enduring events is needed, as the current one is quite a hack, so ideas are welcome.

You can use eg.RawReceiverPlugin instead of eg.PluginClass. RawReceiverPlugin has an internal repeat supression, that users can fine tune. This tuning has to be done with a Python script currently, but this might enhance in the future.
http://www.eventghost.org/forum/viewtopic.php?t=34

jinxdone wrote:
Btw why there aren't attachments allowed in this forum?

They are not "disallowed", the forum software simply has no function for them. It would need an addon and such addons make updating the forum software complicated. But we will find a way for uploads some day.


Top
 Profile  
 
 Post subject: Re: (Win)Lirc event reader plugin
PostPosted: Sun Jan 07, 2007 10:35 am 
Site Admin
User avatar

Joined: Mon Feb 06, 2006 11:28 pm
Posts: 2236
Bitmonster wrote:
But EG will regardless of that call your __stop__/__close__ methods, so you have to take care that they don't depend on something that should have done successful in the __start__ method.

I must correct myself. This is not true. Once the plugin has raised eg.Exception, it will not get a __stop__ call. But it might get a __close__ call.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 30, 2007 12:05 am 

Joined: Tue May 29, 2007 11:54 pm
Posts: 2
Hi jinxdone,

nice job. I discovered eventghost several weeks back, and your plug'in decided me to build a lirc receiver. Your plugin works for me. Thank folks ! Realy impressive job !

But I try to control the mouse move with my remote, but their is no acceleration at all. The repeat work, but the individual step of the mouse is so small that not usable. If I keep the remote button pressed, the mouse move on my screen, but really slowly ....
For you info, i run winlirc in realtime with the command line you suggest.

Do you think the eg.RawReceiverPlugin suggested by bitmonster could solve this issue ? Do I just need to replace eg.PluginClass by eg.RawReceiverPlugin in __init__.py ?

If you have an other version, I could help you to test it and give you feedback

Regards,
Nico


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 30, 2007 12:07 am 
Site Admin
User avatar

Joined: Mon Feb 06, 2006 11:28 pm
Posts: 2236
Do you get multiple events while holding down a single button?

_________________
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 30, 2007 11:29 pm 

Joined: Tue May 29, 2007 11:54 pm
Posts: 2
Bitmonster, yes I have multiple event with the original __init__.py

But, I just replace eg.PluginClass by eg.RawReceiverPlugin in this script, line 149:
Code:
### The EventGhost classes and functions are over here..
class Lirc(eg.PluginClass):
....

replace by:
Code:
### The EventGhost classes and functions are over here..
class Lirc(eg.RawReceiverPlugin):
...       


And It works ! The mouse is now accelerated when I keep the button pressed on the remote.

Regards


Top
 Profile  
 
 Post subject: Re: (Win)Lirc event reader plugin
PostPosted: Thu Jul 26, 2007 5:51 am 
Plugin Developer

Joined: Tue Jan 02, 2007 5:08 pm
Posts: 373
Hello again!

I just updated the plugin a little bit, I removed some obsolete code and switched over to using the RawReceiverPlugin class. And now you can also adjust the enduring event timeout. Sorry it took so long to do anything about it but I have been quite busy.. (oh the excuses :oops: )

Still though, I don't think it's possible to raise that exception from inside the __start__ method, as asyncore forks into background and after a certain time it calls the handle_expt() if it fails..


I'd be happy to hear any feedback you guys might have on it..

Take care!


Attachments:
Lirc-v0.6.0.zip [4.25 KiB]
Downloaded 118 times
Top
 Profile  
 
 Post subject: Re: (Win)Lirc event reader plugin
PostPosted: Thu Jul 26, 2007 1:43 pm 
Site Admin
User avatar

Joined: Mon Feb 06, 2006 11:28 pm
Posts: 2236
I have included your plugin in the 0.3.6.1049 beta version.

You are right that eg.Exception won't work right if called from another thread (like asyncore). I will have to think about a way how you can put your plugin into the error state in such situations.

_________________
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!


Top
 Profile  
 
 Post subject: Re: (Win)Lirc event reader plugin
PostPosted: Sun Jul 29, 2007 8:40 pm 
Site Admin
User avatar

Joined: Mon Feb 06, 2006 11:28 pm
Posts: 2236
@jinxdone
I've made some changes to EG's exception handling and your plugin code in 0.3.6.1055.

I changed your handle_expt this way:
Code:
    def handle_expt(self):
        self.handler.reader = None
        self.close()
        eg.actionThread.Call(
            self.handler.HandleException,
            (
                "Could not connect to the LIRC server!\n"
                "Please doublecheck your configuration and that the "
                "LIRC server is reachable"
            )           
        )

First I directly close the reader and set the plugin's reader variable to None, so no further request should throw an exception. Now comes the complicated part. We cannot directly raise an exception inside asyncore.dispatcher, because we have no control over the asyncore thread. We need to direct it to the thread the plugin is running in and that is eg.actionThread. The "Call" method of this thread will execute the supplied callable (self.handler.HandleException) with the supplied arguments (the message text) in its own thread.

So after this the plugin's HandleException is executed and I have defined it this way:
Code:
    def HandleException(self, msg):
        raise self.Exception(msg)

So here we simply raise the exception with the message. Now EG will print the msg and set your plugin into error state (indicated through a red label). If the user re-configures your plugin, the whole process starts over and it might succeed or the plugin will again go into error state.

_________________
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!


Top
 Profile  
 
 Post subject: Re: (Win)Lirc event reader plugin
PostPosted: Mon Jul 30, 2007 3:05 am 
Plugin Developer

Joined: Tue Jan 02, 2007 5:08 pm
Posts: 373
Very good.. I suppose you did the neccessary changes in eventghost to make raising the exception outside the __start__ method possible. :)


Is it possible to have actions in the same plugin?
I was going to add support for sending strings to the lirc-server as well (for transmitting IR codes), but that idea got shot down since it seems like it's not possible to have actions with RawReceiverPlugin class for the time being.

But that's not a very high priority obiviously, as you can just use the included Network Sender plugin for that same functionality.


Top
 Profile  
 
 Post subject: Re: (Win)Lirc event reader plugin
PostPosted: Mon Jul 30, 2007 2:04 pm 
Site Admin
User avatar

Joined: Mon Feb 06, 2006 11:28 pm
Posts: 2236
jinxdone wrote:
Is it possible to have actions in the same plugin?
I was going to add support for sending strings to the lirc-server as well (for transmitting IR codes), but that idea got shot down since it seems like it's not possible to have actions with RawReceiverPlugin class for the time being.

RawReceiverPlugin works fine with actions. The USB-UIRT, Serial and Tira plugins use it.

jinxdone wrote:
But that's not a very high priority obiviously, as you can just use the included Network Sender plugin for that same functionality.

I don't think the Network Sender plugin will work with LIRC. It uses another protocol.

_________________
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!


Top
 Profile  
 
 Post subject: Re: (Win)Lirc event reader plugin
PostPosted: Wed Aug 08, 2007 3:58 pm 
Site Admin
User avatar

Joined: Mon Feb 06, 2006 11:28 pm
Posts: 2236
I've just integrated a small modification into your code, because I had to change the way the asyncore.loop is handled. Formerly I used a thread that runs asyncore.loop with a dummy socket, so this loop is available to all code that uses asyncore.dispatcher or asynchat. The problem is, that the asyncore.loop uses select() to handle updates on the sockets. While select() is waiting for a change on the sockets, it will not take newly added sockets into account. So I used a rather small timeout (one second), after which select() should end and update its socket list.

Now I have removed this timeout and to inform asyncore.loop of a new socket, one has to call "eg.RestartAsyncore()" after creation of a new socket. This function will close the dummy socket, which will awake select(), and then creates a new dummy socket for the next call. This way EG uses less regular computation and new sockets are available immediately. I've changed all plugins relying upon asyncore accordingly (Zoom Player, VLC, Network Receiver).

_________________
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!


Top
 Profile  
 
 Post subject: Re: LIRC Event Receiver
PostPosted: Tue Nov 20, 2007 10:39 pm 
Plugin Developer

Joined: Tue Nov 20, 2007 10:30 pm
Posts: 13
Hi,

There is a plugin for ati remote wonder called winlirc_rw, wich sends winlirc comands for winlirc compatible software (the reverse action of you current plugin). I was thinking that it should not be very hard for you to do this if you want. This way alot of software not yet suported by eventghost would work with it (alot of dvb-s world use dvbdream, wich only support winlirc).

Thank you.

ps. i also have winlirc_rw source_code if you need it (cpp)


Top
 Profile  
 
 Post subject: Re: LIRC Event Receiver
PostPosted: Sun Dec 16, 2007 2:44 am 
Plugin Developer

Joined: Tue Jan 02, 2007 5:08 pm
Posts: 373
Hello again! Time for an update!

I just posted v0.7.0 as an attachment to the first of the thread post.

Code:
### changelog:
### V0.7.0      - Added support for sending lirc events along with a
### 2007-12-16    nice little dialog configuration screen
###             - The plugin now tries to get information about
###               remotes/actions/buttons on startup by querying
###               the server with LIST commands
###             - Small changes to the plugin description


I also changed the name to "Lirc Client", as it now both receives and sends events.

If somebody can test the new functionality I'd be very happy to hear some feedback as I don't have a Lirc-server set up right now that could send IR codes.. At least winlirc v0.65 spews errors at me when trying to send events, but I suspect that might be a lack of or broken functionality on winlirc's part. It'd be superb if somebody could test it with a *nix version of Lirc.

Of course any comments and feedback is very welcome!


It's possible there are bugs in there, but I'll fix those for 0.7.x. I've stared at the code enough for today! :)
It needs a bit of cleanup anyway so I'll get to it sometime in the near future.


*oh, and townkat, if i'll do that lirc-server-feature i think it'll be another plugin alltogether.. but i'll keep it in mind


Top
 Profile  
 
 Post subject: Re: LIRC Event Receiver
PostPosted: Sun Dec 16, 2007 3:12 am 
Plugin Developer

Joined: Tue Nov 20, 2007 10:30 pm
Posts: 13
please also atach the file, you made me curious :)

and of corse the lircserver needs to be a diffrent plugin


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 74 posts ]  Go to page 1, 2, 3, 4, 5  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: jonib and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group