USB configfs questions and help
Hi, Last week I discovered the new configfs for the USB gadget support in the kernel. I found the following threads on the mailing list: https://lkml.org/lkml/2012/6/21/154 https://lkml.org/lkml/2012/11/26/38 Now there is some discussion about having a userpace library to handle the creation of all the necessary files easily. But I cannot find a trace of it. Does it exist already? If not I will need to write code for it anyway to support it in the USB gadget handler daemon I maintain to support this. It loads/unloads modules, sets up usb gadget modes, can start programs needed etc ... (See usb_moded: https://gitorious.org/meego-middleware/usb_moded ) So if there is no code out there do handle the creation of those configfs structures I do not mind doing the work. Also I have some questions about the documentation. In the section about the gadget creation it states, I quote: A gadget also needs its serial number, manufacturer and product strings. In order to have a place to store them, a strings subdirectory must be created for each language, e.g.: $ mkdir strings/0x409 What is meant with language here, and why does the example have a hex string as identifier. Are we rather talking about one of the USB identifiers here? The rest seems to be pretty clear so I'll start playing around with it. Thanks, Philippe -- 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: USB configfs questions and help
On Sun, 18 Aug 2013, Philippe wrote: Hi, Last week I discovered the new configfs for the USB gadget support in the kernel. I found the following threads on the mailing list: https://lkml.org/lkml/2012/6/21/154 https://lkml.org/lkml/2012/11/26/38 Now there is some discussion about having a userpace library to handle the creation of all the necessary files easily. But I cannot find a trace of it. Does it exist already? No mention of it has appeared on the mailing list. If not I will need to write code for it anyway to support it in the USB gadget handler daemon I maintain to support this. It loads/unloads modules, sets up usb gadget modes, can start programs needed etc ... (See usb_moded: https://gitorious.org/meego-middleware/usb_moded ) So if there is no code out there do handle the creation of those configfs structures I do not mind doing the work. Also I have some questions about the documentation. In the section about the gadget creation it states, I quote: A gadget also needs its serial number, manufacturer and product strings. In order to have a place to store them, a strings subdirectory must be created for each language, e.g.: $ mkdir strings/0x409 What is meant with language here, and why does the example have a hex string as identifier. Are we rather talking about one of the USB identifiers here? The word language refers to human languages, like English, French, Mandarin, and so on. The hex number is a language identifier, as specified by the USB Interface Forum: http://www.usb.org/developers/docs/ (see the paragraph near the end about LANGID codes). The strings are not USB identifiers; they are USB descriptors. The rest seems to be pretty clear so I'll start playing around with it. Alan Stern -- 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: USB configfs questions and help
Hi, On 18/08/13 17:52, Alan Stern wrote: Now there is some discussion about having a userpace library to handle the creation of all the necessary files easily. But I cannot find a trace of it. Does it exist already? No mention of it has appeared on the mailing list. From: https://lkml.org/lkml/2012/11/27/341 Couldn't we have a tool to manage all this? target has such a thing, you have just select a few things via a CLI tool and the tool creates the directories for you _and_ removes them later on. I don't want to push python on anyone but the removal magic is simply straight forward: unlink the disk ports, rmdir luns, tpgt,… Or http://marc.info/?l=linux-usbm=132431126927355w=2 I understand that the echo/mkdir like interface is not perfect for everybody. For target there is a python tool that handles it so you/the user does not see configfs internals. The problem with python is that small users which ship just a busybox as their RFS might consider python as too big. Therefore I would suggest a small C program/library and Yeah, a library is the way to go. It also standardizes the usage, allows for lots of language bindings - so if you want to use python/ruby/perl/C#/etc you can - and allows the whole thing to go into products. Or maybe I misunderstood your answer and it means nothing like that made yet? And does somebody know where that python tool might be available? Unfortunately I did not have the time today to read all the code, but some mails regarding configfs suggest some paths are created by configfs itself. I did not immediately see anything backing that up, but any input is welcome. It is a bit hard to follow all the different threads as the search mixes things up. $ mkdir strings/0x409 What is meant with language here, and why does the example have a hex string as identifier. Are we rather talking about one of the USB identifiers here? The word language refers to human languages, like English, French, Mandarin, and so on. The hex number is a language identifier, as specified by the USB Interface Forum: http://www.usb.org/developers/docs/ (see the paragraph near the end about LANGID codes). Of course! I just never looked deep enough into that. The strings are not USB identifiers; they are USB descriptors. True. I always mix the exact terms up. Thanks Alan! Philippe -- 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: USB configfs questions and help
On Mon, 19 Aug 2013, Philippe De Swert wrote: Hi, On 18/08/13 17:52, Alan Stern wrote: Now there is some discussion about having a userpace library to handle the creation of all the necessary files easily. But I cannot find a trace of it. Does it exist already? No mention of it has appeared on the mailing list. From: https://lkml.org/lkml/2012/11/27/341 Couldn't we have a tool to manage all this? target has such a thing, you have just select a few things via a CLI tool and the tool creates the directories for you _and_ removes them later on. I don't want to push python on anyone but the removal magic is simply straight forward: unlink the disk ports, rmdir luns, tpgt,� Or http://marc.info/?l=linux-usbm=132431126927355w=2 I understand that the echo/mkdir like interface is not perfect for everybody. For target there is a python tool that handles it so you/the user does not see configfs internals. The problem with python is that small users which ship just a busybox as their RFS might consider python as too big. Therefore I would suggest a small C program/library and Yeah, a library is the way to go. It also standardizes the usage, allows for lots of language bindings - so if you want to use python/ruby/perl/C#/etc you can - and allows the whole thing to go into products. Or maybe I misunderstood your answer and it means nothing like that made yet? Right -- nobody has mentioned building such a tool yet. And does somebody know where that python tool might be available? Not me. Alan Stern -- 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