Skip to content
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

CdcAcmSerialDriver resolves wrong interfaces In/Out #29

Open
konradzuse opened this issue Jul 4, 2022 · 1 comment
Open

CdcAcmSerialDriver resolves wrong interfaces In/Out #29

konradzuse opened this issue Jul 4, 2022 · 1 comment

Comments

@konradzuse
Copy link

I have a CDC device that wasn't working. After some debugging in the CDC driver code, I realised that the IN and OUT interfaces were mixed up. The code assumes the order is always the same.

I rewrote it to be like this;

int numberEndpoints = mDataInterface.EndpointCount;
                
                for(var i=0;i<=numberEndpoints-1;i++)
                {
                    var endpoint = mDataInterface.GetEndpoint(i);
                    if(endpoint.Type == UsbAddressing.XferBulk
                       && endpoint.Direction == UsbAddressing.In)
                    {
                        mReadEndpoint = endpoint;
                    }else if(endpoint.Type == UsbAddressing.XferBulk
                             && endpoint.Direction == UsbAddressing.Out)
                    {
                        mWriteEndpoint = endpoint;
                    }
                }

so the ordering of the interfaces no longer matters, it should resolve the In and Out interfaces according to their direction.

Hope this helps someone else stuck with this.

@anotherlab
Copy link
Owner

If you would like to submit a pull request, we would be happy to review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants