@voxltester And, in general, for all software engineers out there here is a helpful tip. ModalAI is not affiliated with Anthropic in any way but I do want to highlight their Claude Code tool. It can really help you not just write code, but to understand code that is already there. So, for example, in this post there is a question about how the -b option is parsed. It's a bit complicated how all of the pieces fit together but if you were to ask Claude this question: "I'm using the device driver in the file lightware_laser_i2c.cpp. I was told that the LightwareLaser class can take the command line option -b to specify the i2c bus number using the start command. Can you show me where in the code the -b option is parsed?". Claude will then give you this answer:
The -b option is not parsed directly in this file. Looking at the code:
At line 450, the custom option parsing only handles -R for rotation:
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (Rotation)atoi(cli.optArg());
break;
}
}
The -b option (for I2C bus number) is handled automatically by the BusCLIArguments class, which is instantiated at line 445:
BusCLIArguments cli{true, false};
This class is included from <px4_platform_common/i2c_spi_buses.h> (line 47). The cli.getOpt() method internally processes standard I2C/SPI options like -b (bus), -a (address), etc., before returning custom options like -R to this driver's switch statement.
If you want to see where -b is actually parsed, you'd need to look at the BusCLIArguments class implementation in the PX4 platform common library:
src/lib/drivers/device/posix/i2c_spi_buses.cpp
or
platforms/common/i2c_spi_buses.cpp
The PRINT_MODULE_USAGE_PARAMS_I2C_SPI_DRIVER(true, false) call at line 435 documents that this driver accepts I2C options (including -b), but the actual parsing is abstracted away in the shared bus infrastructure.