Re: [PATCH] android/client: Fix Send Pass Through command

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

 



Hi Grzegorz,

On Tuesday 23 of December 2014 15:29:23 Grzegorz Kolodziejczyk wrote:
> Parameter should be checked if it's given with (argc is lower than
> expected). Third parameter can be auto completed with cached bluetooth
> addresses.
> ---
>  android/client/if-rc-ctrl.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/android/client/if-rc-ctrl.c b/android/client/if-rc-ctrl.c
> index 52573a0..3980764 100644
> --- a/android/client/if-rc-ctrl.c
> +++ b/android/client/if-rc-ctrl.c
> @@ -67,10 +67,13 @@ static void cleanup_p(int argc, const char **argv)
>  }
>  
>  /* send_pass_through_cmd */
> -
>  static void send_pass_through_cmd_c(int argc, const char **argv,
>  					enum_func *enum_func, void **user)
>  {
> +	if (argc == 3) {
> +		*user = NULL;
> +		*enum_func = enum_devices;
> +	}
>  }
>  
>  static void send_pass_through_cmd_p(int argc, const char **argv)
> @@ -81,15 +84,15 @@ static void send_pass_through_cmd_p(int argc, const char **argv)
>  	RETURN_IF_NULL(if_rc);
>  	VERIFY_ADDR_ARG(2, &addr);
>  
> -	if (argc <= 4) {
> -		haltest_error("No key code specified");
> +	if (argc < 4) {
> +		haltest_error("No key code specified\n");
>  		return;
>  	}
>  
>  	key_code = (uint8_t) atoi(argv[3]);
>  
> -	if (argc <= 5) {
> -		haltest_error("No key state specified");
> +	if (argc < 5) {
> +		haltest_error("No key state specified\n");
>  		return;
>  	}
>  
> @@ -100,8 +103,7 @@ static void send_pass_through_cmd_p(int argc, const char **argv)
>  
>  static struct method methods[] = {
>  	STD_METHOD(init),
> -	STD_METHODCH(send_pass_through_cmd,
> -					"<bd_addr> <key_code> <key_state>"),
> +	STD_METHODCH(send_pass_through_cmd, "<bd_addr> <key_code> <key_state>"),
>  	STD_METHOD(cleanup),
>  	END_METHOD
>  };

Applied, thanks. 

-- 
Best regards, 
Szymon Janc
--
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