Re: [PATCH] android/hidhost: Fix hex string to buffer convertion

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

 



Hi Szymon,

> Due to missing limit specifier buffer was always filled with last hex
> value in string.
> ---
> android/hidhost.c | 23 ++++++++++++++---------
> 1 file changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/android/hidhost.c b/android/hidhost.c
> index 5ea7c5a..124d710 100644
> --- a/android/hidhost.c
> +++ b/android/hidhost.c
> @@ -162,10 +162,18 @@ static void hid_device_remove(struct hid_device *dev)
> 	hid_device_free(dev);
> }
> 
> +static void hex2buf(const uint8_t *hex, uint8_t *buf, int num)
> +{
> +	int i;
> +
> +	for (i = 0; i < num; i++)
> +		sscanf((const char *)(hex + (i * 2)), "%02hhX", &buf[i]);
> +}

can we please build a cheaper version of this that does not require to use sscanf. Small hint is to look into src/util.c from oFono.

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