Re: [PATCH 2/2] fs: configfs: use hexadecimal values and new line
On 04/15/2017 03:35 AM, Stefan Agner wrote: Other unsigned properties return hexadecimal values, follow this convention when printing b_vendor_code too. Also add newlines to the OS Descriptor support related properties, like other sysfs files use. Signed-off-by: Stefan Agner--- drivers/usb/gadget/configfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 863ca4ded1be..a22a892de7b7 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c @@ -738,7 +738,7 @@ static inline struct gadget_info *os_desc_item_to_gadget_info( static ssize_t os_desc_use_show(struct config_item *item, char *page) { - return sprintf(page, "%d", + return sprintf(page, "%d\n", os_desc_item_to_gadget_info(item)->use_os_desc); } @@ -762,7 +762,7 @@ static ssize_t os_desc_use_store(struct config_item *item, const char *page, static ssize_t os_desc_b_vendor_code_show(struct config_item *item, char *page) { - return sprintf(page, "%d", + return sprintf(page, "0x%02x\n", os_desc_item_to_gadget_info(item)->b_vendor_code); } @@ -904,7 +904,7 @@ static inline struct usb_os_desc_ext_prop static ssize_t ext_prop_type_show(struct config_item *item, char *page) { - return sprintf(page, "%d", to_usb_os_desc_ext_prop(item)->type); + return sprintf(page, "%d\n", to_usb_os_desc_ext_prop(item)->type); } static ssize_t ext_prop_type_store(struct config_item *item, looks good to me: Reviewed-by: Krzysztof Opasiak -- Krzysztof Opasiak Samsung R Institute Poland Samsung Electronics -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] fs: configfs: use hexadecimal values and new line
Other unsigned properties return hexadecimal values, follow this convention when printing b_vendor_code too. Also add newlines to the OS Descriptor support related properties, like other sysfs files use. Signed-off-by: Stefan Agner--- drivers/usb/gadget/configfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 863ca4ded1be..a22a892de7b7 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c @@ -738,7 +738,7 @@ static inline struct gadget_info *os_desc_item_to_gadget_info( static ssize_t os_desc_use_show(struct config_item *item, char *page) { - return sprintf(page, "%d", + return sprintf(page, "%d\n", os_desc_item_to_gadget_info(item)->use_os_desc); } @@ -762,7 +762,7 @@ static ssize_t os_desc_use_store(struct config_item *item, const char *page, static ssize_t os_desc_b_vendor_code_show(struct config_item *item, char *page) { - return sprintf(page, "%d", + return sprintf(page, "0x%02x\n", os_desc_item_to_gadget_info(item)->b_vendor_code); } @@ -904,7 +904,7 @@ static inline struct usb_os_desc_ext_prop static ssize_t ext_prop_type_show(struct config_item *item, char *page) { - return sprintf(page, "%d", to_usb_os_desc_ext_prop(item)->type); + return sprintf(page, "%d\n", to_usb_os_desc_ext_prop(item)->type); } static ssize_t ext_prop_type_store(struct config_item *item, -- 2.12.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] fs: configfs: use hexadecimal values and new line
On 2017-02-01 01:02, Felipe Balbi wrote: > Hi, > > Greg KHwrites: >> On Tue, Jan 31, 2017 at 06:19:17PM -0800, Stefan Agner wrote: >>> Other unsigned properties return hexadecimal values, follow this >>> convention when printing b_vendor_code too. Also add newlines to >>> the OS Descriptor support related properties, like other sysfs >>> files use. >> >> configfs is not sysfs, so watch out, you might not need/want those new >> lines as tools read the values and are not expecting them. >> >> Have you verified that nothing will break with this? How have you >> tested it? I am actually writing OS Descriptor support for libusbgx (fork of libusbg) when I stumbled upon this. The helper function there do not care about the new line, but I just thought we should fix it for the sake of coherency to the other properties. I am also fine dropping this patch. > > I would rather not change things like that, specially since Android guys > are alreadying using configfs. Do you happen to know where the source of that part is? So we could check if they make use of any OS Descriptor support yet... -- Stefan -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] fs: configfs: use hexadecimal values and new line
Hi, Greg KHwrites: > On Tue, Jan 31, 2017 at 06:19:17PM -0800, Stefan Agner wrote: >> Other unsigned properties return hexadecimal values, follow this >> convention when printing b_vendor_code too. Also add newlines to >> the OS Descriptor support related properties, like other sysfs >> files use. > > configfs is not sysfs, so watch out, you might not need/want those new > lines as tools read the values and are not expecting them. > > Have you verified that nothing will break with this? How have you > tested it? I would rather not change things like that, specially since Android guys are alreadying using configfs. -- balbi signature.asc Description: PGP signature
Re: [PATCH 2/2] fs: configfs: use hexadecimal values and new line
On Tue, Jan 31, 2017 at 06:19:17PM -0800, Stefan Agner wrote: > Other unsigned properties return hexadecimal values, follow this > convention when printing b_vendor_code too. Also add newlines to > the OS Descriptor support related properties, like other sysfs > files use. configfs is not sysfs, so watch out, you might not need/want those new lines as tools read the values and are not expecting them. Have you verified that nothing will break with this? How have you tested it? thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] fs: configfs: use hexadecimal values and new line
Other unsigned properties return hexadecimal values, follow this convention when printing b_vendor_code too. Also add newlines to the OS Descriptor support related properties, like other sysfs files use. Signed-off-by: Stefan Agner--- drivers/usb/gadget/configfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index ea1a40f5b23d..8e9adcfff748 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c @@ -737,7 +737,7 @@ static inline struct gadget_info *os_desc_item_to_gadget_info( static ssize_t os_desc_use_show(struct config_item *item, char *page) { - return sprintf(page, "%d", + return sprintf(page, "%d\n", os_desc_item_to_gadget_info(item)->use_os_desc); } @@ -761,7 +761,7 @@ static ssize_t os_desc_use_store(struct config_item *item, const char *page, static ssize_t os_desc_b_vendor_code_show(struct config_item *item, char *page) { - return sprintf(page, "%d", + return sprintf(page, "0x%02x\n", os_desc_item_to_gadget_info(item)->b_vendor_code); } @@ -903,7 +903,7 @@ static inline struct usb_os_desc_ext_prop static ssize_t ext_prop_type_show(struct config_item *item, char *page) { - return sprintf(page, "%d", to_usb_os_desc_ext_prop(item)->type); + return sprintf(page, "%d\n", to_usb_os_desc_ext_prop(item)->type); } static ssize_t ext_prop_type_store(struct config_item *item, -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html