-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use toolbar to select channel #19
base: master
Are you sure you want to change the base?
Use toolbar to select channel #19
Conversation
One issue with having the configuration for Channel both as a interface option (configured with the cogwheel) and in the toolbar is that when you start capturing the value you set in the toolbar is not respected. The intention with the toolbar is that the values you set is always used when starting a capture, not other configurations or default values. If I stop the capture and start again, or do a restart, I would expect the value in the toolbar to be used. Currently it's always reverted back to the interface options value. This can be solved by reading and using the value from control_in before getting the |
@stig-bjorlykke , thanks for this info. Indeed I have not tested it with restarts. Do you recommend to remove interface option or use control_in on restarts? |
I will recommend to remove the interface option and only use the setting from toolbar. The user will bring up the toolbar and configure the channel before starting a capture, or while capturing, and the value will stay until changed by the user. This way the value in the toolbar is always correct. One disadvantage is that the last used channel value is not stored, and restarting Wireshark will default back to 11. I don't think this is a big issue. |
@stig-bjorlykke I think I've managed to keep interface configuration while correctly using toolbar on capture restarts (reading |
@hubertmis The toolbar seems to work like expected, but the setting in interface options is ignored so I still think this should be removed. The |
@stig-bjorlykke How did you test interface options? It works fine on my home Linux machine (arch) |
@hubertmis I try to set a value different than 11 and start capturing, then observed that the toolbar was still showing 11 and the packets was from channel 11. In general it's difficult to be able to configure one value from two different places. Who will win when both are different from the default value? |
@stig-bjorlykke In my setup it worked like following:
It is intuitive for me. However if it does not work on all platforms I'll just remove channel from interface configuration. |
@hubertmis Thank you for this contribution! Looks great! I can test this PR on my Windows machine. @hubertmis can you rebase it to the master? However, if @stig-bjorlykke recommends removing the channel from the interface I would strongly consider doing so. One potential problem with this approach, however, is that we also use this sniffer extcap python script without Wireshark (e.g. in CI of our SDK examples). @e-rk Thoughts? |
@LuDuda We can remove channel from Wireshark interface GUI, while maintaining command line option to select the channel if the script is used without Wireshark. What do you think about this approach? |
@hubertmis you are right, I didn't think that through. |
While I think that adding GUI capabilities like changing the channel during the capture is extremely useful from Wireshark user standpoint, I feel that usability as a module is just as important here. |
Using Actually I forgot about the feature that if a setting is never changed by the user in the toolbar it will never be sent to the extcap utility (because the toolbar may not be enabled by the user). It's just a bit hard to understand which value is used when starting the capture. Try changing the channel in both the toolbar and interface options, and observe that the toolbar setting wins over the interface option. I'll have look at how to improve Wireshark to better visualise which value will be used to the user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for sending improvements once more.
One comment below.
self.channel = int(payload) | ||
while self.running.is_set() and not self.setup_done.is_set(): | ||
time.sleep(0.1) | ||
self.serial_queue.put(b'channel ' + payload) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be useful to move this code to a separate method to make it accessible to programs using this extcap as a module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Will do
0591f21
to
963e2a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am approving this with just one more question below.
@@ -151,6 +151,17 @@ def correct_time(self, sniffer_timestamp): | |||
|
|||
return sniffer_timestamp + overflow_count * self.TIMER_MAX | |||
|
|||
def update_channel(self, channel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think that the name of this method feels a bit off. Wouldn't set_channel
sound more appropriate here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of current name either. set_channel
was my first idea, but it sounds like a typical setter. This method is more than a setter - it is used to update the channel value after the channel was set during initialization. That's how I came up with update
. Do you think that set_channel
would be better anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, IMO set_channel
would sound better. I don't think that it requires a special name just because it changes previously initialized value.
One could also use @property
decorator, but I think it would make it less readable here.
After f2f discussion it was decided to rename the method to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contribution one more time! The code looks great!
I verified that on Linux it works like a charm.
On Windows, however, I would say that it works completely unpredictable. Sometimes it chooses the channel from the toolbar, sometimes from the interface settings. Sometimes it refreshes the select from in the toolbar when the channel is chosen from the interface, but sometimes it locks on previous one e.g. 13 while it receives frames on channel e.g. 18. The user experience is very weak.
I would say that we either try to fix this (maybe add some sleeps 😄)) or remove the interface setting.
Anyhow, please remember to add documentation about a new way of using a sniffer (with toolbar) - in this or the subsequent PR.
@LuDuda I have experienced this on Windows today as well. In my case the toolbar settings take precedence all the time. I have also found out that the toolbar value can't be changed by the extcap during startup. I think I have satisfactionary solution to this. |
@e-rk If we expose the interface setting to the user, we should use it. If we decide to not use it when toolbar is enabled, we should not expose interface setting to the user. |
@hubertmis Yes, this is why I proposed removing that window and relying on the toolbar exclusively. Clarification: By exclusively, I mean when |
@e-rk, Ok I thought tshark needs interface option to use it. Then I'm ok to remove it. |
@hubertmis I forgot that extcap needs to report all options to be able to receive them in tshark. Turns out, the tshark needs the interface options after all, and because there is no clear indication whether the tshark or the Wireshark was used, the behaviour can't be adapted to both. This and the different behaviour on Windows with the toolbar value put this situation in a bind unfortunately. If I had to choose between both, I would go with the GUI in the end. Sorry for making false hopes. |
If the channel control combination has issues on Windows only then it seems like a Wireshark issue which should be fixed. I'll have a look at this. |
Do we have any decision here? Should we remove channel option from interface configuration until Wireshark issue is fixed? |
I'll vote for keeping the channel option, based on the knowledge that |
Due to the limited time we have before the first release of the sniffer (let's say ver 0.5.0), I would vote for postponing of merge this PR to the next production release, unfortunately. I think we should dedicate more time to make sure Windows is well supported as well. |
As much as I would like to have the channel selection toolbar, I have to change my mind and admit that I have some concerns right now. The interface option approach is proven to cause no problems across platforms and with the |
Another approach here is to discard the channel fetched from the toolbar during start capture (before receiving This should be easy to test by discarding the "channel set" in It's not an ideally solution (as described in my first comment) but it's explainable and should work equally on all platforms. |
I have tested on Windows and I find it to work exactly like it does on Linux and macOS. Some information how this actually works:
Based on this I think the current behavior is the best solution to handle the channel settings. This should of course be documented. It has been requested a feature to be able to set the toolbar values when starting |
@stig-bjorlykke Thank you for investigating this. The first release will be made without the toolbar feature but I will come back to taking care of this once the release is done. |
Just remember to remove the dummy toolbar before the release because it does not provide any functionality and will confuse users. |
No description provided.