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]
Date:	Sat, 22 Jan 2011 05:55:16 -0800
From:	Greg KH <greg@...ah.com>
To:	Alan Ott <alan@...nal11.us>
Cc:	Jiri Kosina <jkosina@...e.cz>, linux-input@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] hid: Add HID Report Descriptor to sysfs.

On Fri, Jan 21, 2011 at 01:19:45AM -0500, Alan Ott wrote:
> Add a new sysfs entry called report_descriptor which contains the HID report
> descriptor.
> 
> Signed-off-by: Alan Ott <alan@...nal11.us>
> ---
>  drivers/hid/hid-core.c |   28 ++++++++++++++++++++++++++++
>  1 files changed, 28 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index d678cf3..0ff1ba2 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -1159,6 +1159,28 @@ static bool hid_hiddev(struct hid_device *hdev)
>  	return !!hid_match_id(hdev, hid_hiddev_list);
>  }
>  
> +
> +static ssize_t show_report_descriptor(struct device *dev,
> +				      struct device_attribute *attr,
> +				      char *buf)
> +{
> +	int i, cur = 0;
> +	struct hid_device *hdev = container_of(dev, struct hid_device, dev);
> +
> +	for (i = 0; i < hdev->rsize; i++) {
> +		if (cur + 4 >= PAGE_SIZE)
> +			break;
> +		sprintf(buf + cur, "%02hhx ", hdev->rdesc[i]);
> +		cur += 3;
> +	}
> +	/* Replace the last space with a newline. */
> +	buf[cur-1] = '\n';
> +	buf[PAGE_SIZE-1] = '\0';
> +	return cur + 1;
> +}

If you are going to do this this way through sysfs, please make this a
binary file, not a text one.

thanks,

greg k-h
--
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