lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1265206478.31341.111.camel@localhost.localdomain>
Date:	Wed, 03 Feb 2010 06:14:38 -0800
From:	Marcel Holtmann <marcel@...tmann.org>
To:	Jiri Kosina <jkosina@...e.cz>
Cc:	Bastien Nocera <hadess@...ess.net>,
	Michael Poole <mdpoole@...ilus.org>,
	"Gunn, Brian" <bgunn@...ekai.com>, Ping <pinglinux@...il.com>,
	linux-kernel@...r.kernel.org,
	BlueZ development <linux-bluetooth@...r.kernel.org>
Subject: Re: [PATCH 1/3] HID: make raw reports possible for both feature
 and output reports

Hi Jiri,

> In commit 2da31939a42 ("Bluetooth: Implement raw output support for HIDP
> layer"), support for Bluetooth hid_output_raw_report was added, but it
> pushes the data to the intr socket instead of the ctrl one. This has been
> fixed by 6bf8268f9a91f1 ("Bluetooth: Use the control channel for raw HID reports")
> 
> Still, it is necessary to distinguish whether the report in question should be
> either FEATURE or OUTPUT. For this, we have to extend the generic HID API,
> so that hid_output_raw_report() callback provides means to specify this
> value so that it can be passed down to lower level hardware drivers (currently
> Bluetooth and USB).
> 
> Based on original patch by Bastien Nocera <hadess@...ess.net>
> Signed-off-by: Jiri Kosina <jkosina@...e.cz>
> ---
>  drivers/hid/hidraw.c          |    2 +-
>  drivers/hid/usbhid/hid-core.c |    5 +++--
>  include/linux/hid.h           |    2 +-
>  net/bluetooth/hidp/core.c     |   13 ++++++++++---
>  4 files changed, 15 insertions(+), 7 deletions(-)

Acked-by: Marcel Holtmann <marcel@...tmann.org>
 
> -static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count)
> +static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count,
> +		unsigned char report_type)
>  {
> -	if (hidp_send_ctrl_message(hid->driver_data,
> -			HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE,
> +	if (report_type == HID_FEATURE_REPORT)
> +		report_type = HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE;
> +	else if (report_type == HID_OUTPUT_REPORT)
> +		report_type = HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUPUT;
> +	else
> +		return -EINVAL;

If you wanna be a little bit more readable, then using a switch
statement helps instead of else if. Just my 2 cents.

Regards

Marcel


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ