Source Code for mlxcable

I am trying to check whether or not a sfp is connected to a port on a mlnx5 regardless of the link being functional. This led me to the mlxcable command which is the solution for what I was trying to check. Now the issue is, where I need to perform this check is in a C file. So I wanted to know where I could get access to the source code of the mlxcable command to see how I could possibly implement it within C.

I can write a script and call it from the C file but it isn’t an efficient solution so I would prefer not to do it that way.

Any help would be greatly appreciated.

Could be that open-source mstflint might help.

Use --enable-adb-generic-tools when running configure. After compilation there will be mstlink command that can be used to check link status.