rust-vmm / vhost-device

'vhost-user' device backends workspace
Apache License 2.0
68 stars 48 forks source link

i2c: Support for both bus name and bus number #632

Closed Q-LiuWei closed 8 months ago

Q-LiuWei commented 8 months ago

When the adapter name is used as a parameter, some adapters share the same name. For instance, both /dev/i2c-0 and /dev/i2c-1 have the bus name "xxxx". This leads to only the first found I2C adapter being opened.

To increase flexibility, accept both the I2C master's name and number as parameters and parse accordingly.

Summary of the PR

In some scenarios, serveral i2c adapters share the same bus-name, which results in only the first founded i2c adapter being opened.

To address this issue, introduced support for identification by names or numbers, providing users with a choice.

Requirements

Before submitting your PR, please make sure you addressed the following requirements:

stefano-garzarella commented 8 months ago

@vireshk can you take a look when you have time?