[Pdbg] [PATCH] main: Set I2C backend device specified in arguments

Amitay Isaacs amitay at ozlabs.org
Tue Jan 29 17:05:28 AEDT 2019


On Mon, 2019-01-21 at 16:49 +0300, Artem Senichev wrote:
> Restores the functionality that allows to set I2C backend
> device through command line arguments, it was broken by commit
> dacc9b57e4615f125eb1f56d842a64c40abb1408

Good catch.

It would be better if the setting of "bus" property is done in the I2C
case of the switch statement.

> 
> Signed-off-by: Artem Senichev <artemsen at gmail.com>
> ---
>  src/main.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/src/main.c b/src/main.c
> index 22e74a5..6ae6863 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -594,6 +594,15 @@ static bool target_selection(void)
>  		return false;
>  	}
>  
> +	/* Set device for I2C backend */
> +	if (backend == I2C && device_node) {
> +		struct pdbg_target *pib;
> +		const size_t len = strlen(device_node) + 1 /* include
> last null */;
> +		pdbg_for_each_class_target("pib", pib) {
> +			pdbg_target_set_property(pib, "bus",
> device_node, len);
> +		}
> +	}
> +
>  	if (pathsel_count) {
>  		if (!path_target_parse(pathsel, pathsel_count))
>  			return false;
> -- 
> 2.20.1
> 

Amitay.
-- 

Behold the turtle. He makes progress only when he sticks his neck out. 



More information about the Pdbg mailing list