Add input buffering and support for polling#4
Open
Jaffe- wants to merge 1 commit intoICBTech:masterfrom
Open
Conversation
The driver now supports a listening mode, which is set by writing to the sysfs attribute 'listen'. In this mode, the radio is constantly in RX mode and stores incoming packets in a receive buffer. When not in listening mode, the behavior is the same as before. poll() is also implemented to be able to use select() to check for new packets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi, I don't know if you accept pull requests or not, but here's some additions to the driver if you're interested. :)
I'm using your driver in a project, and it works great. However it isn't easy to use from userspace since you have to call read() in order for the radio to go into listen mode. Instead of the radio only going into RX mode when a call to read() is active, it is useful to be able to set the radio in RX mode and do other things while the radio is receiving. This commit adds the possibility to put the radio in RX mode and have the driver's IRQ handler put things into a circular buffer when they are received. read() now only gets data from the buffer (or blocks if the buffer is empty).
I added the sysfs attribute "listen" (which takes '1' or '0') to put the driver in this autonomous mode. If the attribute is 0 then the driver should behave as it did before (only turning on RX when read() is called).
Support for O_NONBLOCK and poll/select is also added (useful if userspace wants to find out if there are any pending messages to be read). Perhaps signals should also be added to make it complete.
I'm not very experienced with driver development, so I'm not fully sure if things like locking is right. It seems to work very well though.