Re: [PATCH] btmgmt: Fix endianess in cmd_scan_params()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andre,

> The kernel expects Mgmt commands parameters in little-endian byte order
> so this patch fixes cp.interval and cp.window in cmd_scan_params().
> ---
> tools/btmgmt.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/btmgmt.c b/tools/btmgmt.c
> index 066fde9..b0da592 100644
> --- a/tools/btmgmt.c
> +++ b/tools/btmgmt.c
> @@ -2404,6 +2404,7 @@ static void cmd_scan_params(struct mgmt *mgmt, uint16_t index,
> 							int argc, char **argv)
> {
> 	struct mgmt_cp_set_scan_params cp;
> +	uint16_t interval, window;
> 
> 	if (argc < 3) {
> 		scan_params_usage();
> @@ -2413,8 +2414,11 @@ static void cmd_scan_params(struct mgmt *mgmt, uint16_t index,
> 	if (index == MGMT_INDEX_NONE)
> 		index = 0;
> 
> -	cp.interval = strtol(argv[1], NULL, 0);
> -	cp.window = strtol(argv[2], NULL, 0);
> +	interval = strtol(argv[1], NULL, 0);
> +	window = strtol(argv[2], NULL, 0);
> +
> +	put_le16(interval, &cp.interval);
> +	put_le16(window, &cp.window);

the struct is already packed. So not need for unaligned access. Just use the standard endian conversion functions.

Regards

Marcel

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux