Closed pavelmachek closed 5 years ago
I'll pick this one up. I've already got something similar set up on the N950 (WIP) so it will be easy enough to add this to the N900 and Droid 4.
In #39 I made a start with usb networking and mass storage using libgadget / gadgetfs. It is close to done, I just need to work on the gtk integration, and I was running into musb bugs at the time. I think they should be fixed now. So maybe libicd-network-usb can be used in combination with loading usbnet by default with gadgetfs.
I enabled the g_ether gadget in my kernel config and then set up usb0 in /etc/network/interfaces. If you've nearly got libicd-network-usb working with hildon-status-bar-usb, that would be better than my method so I'll leave it to you to finish off.
I think it would be useful to share what you have in /etc/network/interfaces for usb networking. It might take a few more days for me to get this ready.
Sure. This is what I add to /etc/network/interfaces:
allow-hotplug usb0
iface usb0 inet static
address 192.168.2.15
netmask 255.255.255.0
gateway 192.168.2.14
Then on my PC I run:
# ifconfig usb0 up 192.168.2.14
# iptables -A POSTROUTING -t nat -s 192.168.2.15/32 -j MASQUERADE
I can put this in a pull request if you like.
@dderby If it's not going to break existing network functionality, then please make a patch :)
Will do. I tested it on the Droid 4 with the default kernel and usb0 didn't come up. I think it's probably the kernel config. I'll check the N900 too and submit a patch once it's all working.
@dderby - sorry, I don;t get it - which package are you going to patch?
@freemangordon, as this is a temporary fix (until @MerlijnWajer finishes off the other stuff) and we don't yet have the leste-devel package, I was just going to add this to the root overlay in https://github.com/parazyd/arm-sdk/ where we already have /etc/network/interface files pulled into the build for N900 and Droid 4.
So the way it will work in the future is like this:
/etc/network/interfaces
or via icd2 plugin)What will need to be figured out is how to create the gadget by default.
For other types of debugging, just enable g_nokia as built in, then you will not need to create usb gadget. But it will also not be possible (afaict) to create other gadgets.
Will there be any option to configure gadgets manually? On PiZero people can create gadget as they wish like this: http://isticktoit.net/?p=1383
I usually create a script and run in rc.local
We could either have a mechanism to have various custom gadgets, or just allow a 'custom' gadget setting that allows people to run whatever script they want.
The custom gadget setting would be great. Users can have their own settings files, flags etc, eg. my config has several script files in several folder. It's also easier to backup and copy to other devices like a PiZero. A connected and disconnect event would be nice too.
FYI I'm planning to fix this by having ke-recv just always/autoconfigure usbnet, and ignore mass storage for the alpha. Then we should have usbnet working decently.
Unless we want this way earlier in the boot process, this should be fine?
@pavelmachek - few questions, since I want to wrap this up for the alpha:
Alternatively I can just probe the usb networking module on boot in some script, but since I'm working on ke-recv anyway ... if the above two are fine, I will make it work with ke-recv.
Not sure. 1. I don't see how downing the interface would cause problems, so probably ok. 2. Yes, I guess doing usb net by default is ok.
Thanks!
Once the following steps are done, this can be closed:
configfs
and usb_f_mass_storage
(or similar) is probed in ke-recv init scriptOptional, but nice to do:
EDIT: This was a note to self mostly
ke-recv
is in the repo now (as well as hildon-status-bar-usb
and hildon-usb-gadgets
). I am still in the process of testing it a bit more, but I think apt install ke-recv
should just work on the N900 at this point. It will set up static network without using it as gateway or doing any forwarding. I use it for ssh access only currently.
I will close this issue as it should work now, and make new issues for the open issues that are not particularly relevant for the alpha. LMK if just the static config and not as default gw was not what you wanted.
BTW: This should work before X is even started, so you can log in and do things while powervr is starting for a few minutes.
I created simple script to do configure usb0 networking, but I still need to launch it manually. It would be nicer to configure it by default.