{"action":"created","issue":{"url":"https://api.github.com/repos/nerves-project/nerves_system_rpi0/issues/27","repository_url":"https://api.github.com/repos/nerves-project/nerves_system_rpi0","labels_url":"https://api.github.com/repos/nerves-project/nerves_system_rpi0/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/nerves-project/nerves_system_rpi0/issues/27/comments","events_url":"https://api.github.com/repos/nerves-project/nerves_system_rpi0/issues/27/events","html_url":"https://github.com/nerves-project/nerves_system_rpi0/pull/27","id":254527334,"number":27,"title":"RFC: Configuring USB Gadget through configfs","user":{"login":"mobileoverlord","id":1391351,"avatar_url":"https://avatars3.githubusercontent.com/u/1391351?v=4","gravatar_id":"","url":"https://api.github.com/users/mobileoverlord","html_url":"https://github.com/mobileoverlord","followers_url":"https://api.github.com/users/mobileoverlord/followers","following_url":"https://api.github.com/users/mobileoverlord/following{/other_user}","gists_url":"https://api.github.com/users/mobileoverlord/gists{/gist_id}","starred_url":"https://api.github.com/users/mobileoverlord/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mobileoverlord/subscriptions","organizations_url":"https://api.github.com/users/mobileoverlord/orgs","repos_url":"https://api.github.com/users/mobileoverlord/repos","events_url":"https://api.github.com/users/mobileoverlord/events{/privacy}","received_events_url":"https://api.github.com/users/mobileoverlord/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-09-01T03:37:42Z","updated_at":"2017-09-27T15:45:28Z","closed_at":null,"author_association":"OWNER","pull_request":{"url":"https://api.github.com/repos/nerves-project/nerves_system_rpi0/pulls/27","html_url":"https://github.com/nerves-project/nerves_system_rpi0/pull/27","diff_url":"https://github.com/nerves-project/nerves_system_rpi0/pull/27.diff","patch_url":"https://github.com/nerves-project/nerves_system_rpi0/pull/27.patch"},"body":"DO NOT MERGE\r\n\r\nconfigfs seems to be the most modern and flexible way to configure USB Gadgets from the Linux user space.\r\n\r\nFrom the config fs docs:\r\n\r\n> Where sysfs is a filesystem-based view of kernel objects, configfs is a filesystem-based manager of kernel objects, or config_items.\r\n\r\nUsing configfs, we can dynamically add and remove gadget functions at runtime without having to recompile the linux kernel. This PR demonstrates some of my findings.\r\n\r\n`/etc/gadget_start.sh`\r\nRepresents recreating the current configuration where we have a CDC device with 1xACM and 1xECM. This setup is kinda neat, because we get to control the device name and serial number. In this example, I am able to set the device serial number to the `boardid`.\r\n\r\n<img width=\"617\" alt=\"screen shot 2017-08-31 at 23 31 43\" src=\"https://user-images.githubusercontent.com/1391351/29954269-9323d71e-8ea4-11e7-847c-69792625be62.png\">\r\n\r\nI added a busybox config because I needed to enable `ln` because calling `File.ln_s` was returning errors because the directories already existed. There might be a work around here, not sure. \r\n\r\nIn addition, I attempted to update the erlinit.config to execute the gadget script pre exec so that it might be able to use the `ttyGS0` port that it creates. Unfortunately, this did not work and the serial console ended up coming across `ttyACM0`. \r\n\r\n**RFC**\r\nThis is labeled as RFC because it has drawbacks but I wanted to demonstrate something interesting. I think that its really neat to be able to programmatically control the gadget properties and functions at runtime. In addition, you can enable a lot more combinations of functions that the gadget could serve such as USB HID, mass storage device, and more. I just through that this stuf was really cool and I wanted to share it with everyone.\r\n\r\n**Relevant Docs**\r\n\r\n_ConfigFS Gadgets_\r\nhttp://elixir.free-electrons.com/linux/latest/source/Documentation/usb/gadget_configfs.txt\r\n\r\n_ConfigFS_\r\nhttps://www.kernel.org/doc/Documentation/filesystems/configfs/configfs.txt"},"comment":{"url":"https://api.github.com/repos/nerves-project/nerves_system_rpi0/issues/comments/332565506","html_url":"https://github.com/nerves-project/nerves_system_rpi0/pull/27#issuecomment-332565506","issue_url":"https://api.github.com/repos/nerves-project/nerves_system_rpi0/issues/27","id":332565506,"user":{"login":"fhunleth","id":64669,"avatar_url":"https://avatars0.githubusercontent.com/u/64669?v=4","gravatar_id":"","url":"https://api.github.com/users/fhunleth","html_url":"https://github.com/fhunleth","followers_url":"https://api.github.com/users/fhunleth/followers","following_url":"https://api.github.com/users/fhunleth/following{/other_user}","gists_url":"https://api.github.com/users/fhunleth/gists{/gist_id}","starred_url":"https://api.github.com/users/fhunleth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fhunleth/subscriptions","organizations_url":"https://api.github.com/users/fhunleth/orgs","repos_url":"https://api.github.com/users/fhunleth/repos","events_url":"https://api.github.com/users/fhunleth/events{/privacy}","received_events_url":"https://api.github.com/users/fhunleth/received_events","type":"User","site_admin":false},"created_at":"2017-09-27T15:45:28Z","updated_at":"2017-09-27T15:45:28Z","author_association":"OWNER","body":"I think this is cool. It would be great to document so that people can create custom systems for using HID. I know that creating custom systems can be an annoying way of adding functionality to the Linux side of Nerves, but it *is* our current official way, and I'd like to not abuse our core team privilege by adding features to the official systems that we use in one of our projects that are not of widespread use.\r\n\r\nAs it stands, unless this can be made transparent to the majority of users (especially new users) who are using the RPi0 for serial and Ethernet, I'm pretty opposed to merging it. \r\n\r\nAlso, the whole script thing would need to be reworked. I regret adding support for `pre-run-exec` since it leads to unsupervised (in the OTP sense) shell scripting. On the other hand, I suspect that you wrote this in haste since it was pre-ElixirConf. That also makes me sad, since it means that writing a shell script was easier than coding in Elixir. Is it possible to fix that for next time?\r\n\r\nWhile I'm interested discussion, I think that the best course of action is for all of us who are interested in this feature to talk live. I'd also like to consider whether this is pre or post 1.0 so that we can prioritize it.\r\n\r\n"}}
{"actor":{"display_login":"fhunleth"}}