-
Notifications
You must be signed in to change notification settings - Fork 3
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
Simultaneous Client + Server Decoding #3
base: master
Are you sure you want to change the base?
Simultaneous Client + Server Decoding #3
Conversation
… attempting to analyze both client and server from the same channel. also organized the errors a bit
7cdf5c5
to
f285f90
Compare
Thanks @david-vankampen! A few requests if you have time:
Thanks! |
@Marcus10110 sounds good. For item 1, I just opened PR #4 . Once that completes, this PR should look much simpler. I will work on getting the other items addressed. Though for item 4, I am not sure what I would link to. Just the modbus spec? This doesn't implement any NEW parsing, just connects the two existing capabilities into one. |
Thanks David, I've merged your rename PR. Could you update this one accordingly? |
@Marcus10110 I have merged in the updates but something appears to have gotten shuffled slightly off now functionally - it is correctly decoding/framing the client request, but incorrectly starting the server response. I will investigate and update when I have found resolution. |
That's what I was worried about, the original developer had this problem when they first created the decoder, which is why we didn't add support originally. However I never took a close look at trying to determine if a packet is a request or response. I suggest the following: You could use the value of that to seed the value of Ideally, there would be some way to tell the difference between a request and a response, even if you have to wait till the end of the packet to make the determination. One way we've dealt with this sort of issue is to buffer the decoded bytes and their time stamps until we can tell what kind of message it is, then decode those stored bytes normally, and continue from there normally. We had a similar problem with the modbus analyzer, where you can't tell the difference between '0' bits and '1' bits until you see a transition - '01' or '10'. At that point, we would commit all of the buffered bits we had decoded. |
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.
Nice work!
I only found one new issue from the code review, mentioned in the comments below. Specifically, those new enum values will mess up saved captures and saved presets as written now, but it's an easy fix.
I also have a suggestion about the response first deciding problem in the comments on the PR.
Lastly, could you send us a saved capture that contains both traffic?
@Marcus10110 I believe the most recent commit should address the suggestion for adding a setting for seeding the Regarding
how should those be provided? |
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.
one small request in the legacy save/load code. Otherwise looks good!
Please create a new folder in the repo called "samples", then add the *.sal file, and a new readme.md file that has a quick description of the file. Thanks! |
…gs, added samples describing the "starts with response" mode of "client + server" analyzing.
@Marcus10110 all comments should be addressed. Thank you for your feedback. |
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.
Looking good! Sorry there always seems to be "one more thing"
I've tested your analyzer locally, looking good. Thanks for the files you've included!
Two things:
- (most important) We're planning to enable simulation support again in the logic 2 software. Right now, you can enable simulation by setting an environment variable before launching logic,
ENABLE_SIMULATION=1
.
However, when Both mode is selected, the simulator never produces any data, which then in turn prevents the simulation device from generating any data, breaking the capture. This is a pretty easy fix.
If you head over to this function, you will see 2 big if statement cases, one for client, one for server. We just need a 3rd case for both mode. Something like this would work fine, you don't need to make it as thourough as the other two if you don't want to. We heavily lean on simulation when we write analyzers, because it let's us easily test rare features or edge cases that aren't easy to reproduce with real world electronics.
U32 ModbusSimulationDataGenerator::GenerateSimulationData( U64 largest_sample_requested, U32 sample_rate,
SimulationChannelDescriptor** simulation_channels )
Something like this would probably be good enough. (I haven't tested this)
if( mSettings->mModbusMode == ModbusAnalyzerEnums::ModbusRTUBoth ||
mSettings->mModbusMode == ModbusAnalyzerEnums::ModbusASCIIBoth )
{
SendGenericRequest( 0x01, 0x01, 0x0013, 0x0013 );
mModbusSimulationData.Advance( mClockGenerator.AdvanceByTimeS( .125 ) );
U8 bytes[ 3 ] = { 0xCD, 0x6B, 0x05 };
SendGenericResponse( 0x01, 0x01, 0x03, bytes );
mModbusSimulationData.Advance( mClockGenerator.AdvanceByTimeS( .125 ) );
}
You can learn more about simulating your analyzer here:
https://support.saleae.com/user-guide/using-logic/demo-mode#generating-analyzer-simulation-data
- This is super minor, but it looks like you had manually re-named the modbus analyzer modbus3, probably in order to prevent it from conflicting with the original modbus analyzer. Unfortunately, this means your sample files were saved using modbus3, and when loaded into the software, the analyzer is automatically removed because no modbus3 analyzer was found.
I'd like to get this fixed. When I'm testing variations of analyzers we ship with, I usually just add an underscore to the end of the original dll before launching the software. Our software automatically loads all dlls in this folder, but only if they have the "dll" extension. If they say end with "dll_", that file will be skipped. That way you can develop your version of modbus with the original modbus name. Of course, this doesn't help if you want to compare side-by-side.
Built in analyzers are found here:
C:\Program Files\Logic\resources\windows\Analyzers
@Marcus10110 I implemented change suggestion 1. Regarding the second item - I am working in Linux, running the AppImage. Do you have a suggestion for manually overriding the default analyzer there? |
8d67acd
to
edb59c2
Compare
…ltaneous client + server
edb59c2
to
2b282a8
Compare
Ah yes, that's right. There is one extra step on Linux:
|
@Marcus10110 ok - should be all set! |
@Marcus10110 one other thing I noticed - the it appears they are being deployed with debug-info turned on? Not sure if that is intended. Just figured I'd point it out. |
@david-vankampen, nice catch. Yes, we include debug information on purpose. You can see that we build the modbus-analyzer/azure-pipelines.yml Line 37 in 687dfaa
The reason is because when the software crashes, if the user has crash reporting enabled, we'll upload the minidump to a crash reporting server. There, we'll create stack traces from the crash. |
I'll get through another review as soon as I can, but I'm backed up with other work for the moment. If it all looks good, I will go ahead and merge the PR for you too. |
@Marcus10110 whats the status on this? |
@Marcus10110 @schmicro bumping this PR back up - what is the status here? |
Sorry for the Year long delay! I just started testing this now with the samples you provided and the simulator, and it looks like the simulation for the new mode isn't working properly. Here is a screenshot: However, I was sure I was having another issue which I can't locate now. I'll keep looking, but at the moment let's assume simulation is the last issue. Also this would need to be updated from our branch, I think it's slightly out of date. If you would like help with any of this please let me know. Also to help make sure this doesn't fall off of our radar again, please open a support ticket to go along with this - we don't have a good system for tracking open github issues at the moment, but our support system is much better. |
… attempting to analyze both client and server from the same channel. also organized the errors a bit
…gs, added samples describing the "starts with response" mode of "client + server" analyzing.
…ltaneous client + server
…issell-homecare-inc/modbus-analyzer into simultaneous_client_and_server
@Marcus10110 dusting things off here - I've synced to upstream master, and am working to replicate the results you're reporting. To be clear, the issue is on RTU C&S, right? I am thinking the single clients, and ASCII C&S, look correct? |
That's correct |
plz can you give detail guide how to show this menu too logic2. i have created dll file . what next? |
@ntik98 Once you've got your .dll file generated, you can import your custom analyzer into the software via the instructions below. |
@Marcus10110 @timreyes I'm looking for this same plugin for the Modbus RTU serial protocol and this will be very useful. I request please approve the above changes and please share the .dll file. |
Everything has been implemented. Can anybody merge the pull request? or approve the review? @Marcus10110 ? |
@GunasekaranMP @sebistark Our entire team is currently heads down on some high priority projects at the moment. We’re likely unable to commit resources anytime soon to review and merge the PR into our production software. However, we’d love to get back to reviewing all Issues and PRs submitted for our analyzers as soon as we are available. Having said that, the latest commit can be found below, along with their provided analyzer lib files in case you would like to test it with your software. |
replaced master with client, slave with server, and added support for attempting to analyze both client and server from the same channel. removed some dead and commented code, and also organized the errors a bit. that can probably be taken a bit further yet.