Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: johannkraus on July 29, 2016, 11:29:05 AM
-
Hi there,
I'm using Tiny Core Linux on my different RPis for quite a while now. One of my projects is miniaturising an RFID-based attendance system currently running on a Raspberry Pi B. I bought a couple of RPi zeros and now I am experimenting with some new hardware, i.e. OLED vs LED, capacitive touch vs button, battery power vs power supply, ... AND ...
USB OTG vs. wlan/usblan/serial
The RPi zero supports gadget mode, i.e. one can program the RPi from another computer using only a single USB OTG cable. The available gadget modules enable mass storage mode, ethernet, serial, etc. I'm most interested in the mass storage mode, as it would enable mounting the gadget on a host computer and transferring some data without the need for LAN or a serial connection.
I was already able to do this with Raspbian following this guide http://blog.gbaman.info/?p=699
But I do have some issues with Tiny Core Linux and need your help. This is what I tried so far:
- I installed the newest beta as it has Kernel 4.4.15
- I added dtoverlay=dwc2 to config.txt
- trying modprobe dwc2 tells me that there is no module to load
- I downloaded http://tinycorelinux.net/8.x/armv6/releases/RPi/src/kernel/4.4.15-piCore+_modules.tar.xz and there it is
- I copied dwc2 and the gadget modules to lib/modules/.../usb and also copied modules.dep
- finally, I was able to modprobe dwc2
Then if I modprobe g_mass_storage it tells me that there is no such device. Shouldn't dtoverlay do it's magic?
I would really appreciate any help! I built my last kernel ~10 years ago in my Gentoo times and just learned that something like device tree exists.
To make some advertisement for USB OTG:
- one would not need a serial connection to the GPIO - you can use usb
- the Pi zero can be powered from it's usb port, i.e. the gadget mode one :)
- you can have ethernet over usb without additional hardware, i.e. wlan stick or breakout board
- and lot more fun stuff :)
- the obvious downside is that you loose the only usb port on the RPi zero
Best Johann
-
Okay - I finally had some time to compare Raspbian to piCore:
- after adding dwc2 overlay to config.txt and modprobe dwc2 in Raspbian there is another tty in dev -> ttyGS0. I would assume this is the device the gadget modules use. And this device is not present in piCore. Remind that adding the overlay and modprobe dwc2 just works and does not give any error in piCore. But all the messages in dmesg about enabling the new usb (non host) device are missing.
- using Raspbian one can dynamically load overlays via dtoverlay in the bash. If I do so, the device is also not created. However, I think this is unrelated to my problem here.
- in piCore I can also modprobe further modules that seem to be needed by the gadget modules, i.e. libcomposite and usb_f_acm.
It seems that dtoverlay cannot handle the dwc2 overlay. Well, sit back and ... RTFM -> https://searchcode.com/codesearch/view/37919024/
To use the gadget serial driver you must configure the Linux gadget side kernel for "Support for USB Gadgets", for a "USB Peripheral Controller" (for example, net2280), and for the "Serial Gadget" driver. All this are listed under "USB Gadget Support" when configuring the kernel. Then rebuild and install the kernel or modules.
I assume that the gadget side kernel was not configured. I will have a try rebuilding the kernel - will take some time ;D
and
- I copied dwc2 and the gadget modules to lib/modules/.../usb and also copied modules.dep
I assume depmod -a should be better than copying modules.dep
-
piCore kernel configuration is the same as Raspbian, except few more features enabled, like zswap, etc. Nothing removed compared to Raspbian.
-
Thanks Béla. I tried it once again now with piCore-8.0rc1 and succeeded. Probably last time I forgot to make the changes from depmod persistent. Gadget mode via g_multi (which includes mass storage, serial, and ether) now runs perfectly.
This is how I succeeded:
- Copy dwc2 and the gadget modules to lib/modules/.../usb
- Call depmod -a and make the result persistent
- Add /sbin/modprobe dwc2 to /opt/bootlocal.sh -> again don't forget to call backup
- Add dtoverlay=dwc2 to config.txt. Don't do that before your system loads dwc2 module at startup as your usb port will then probably not accept your keyboard anymore (as dwc_otg is replaced by dwc2).
- Create a container to share via g_multi, e.g. dd if=/dev/zero of=/home/tc/piusb.bin bs=512 count=2880 and mkdosfs piusb.bin
- After reboot call modprobe g_multi file=/home/tc/piusb.bin stall=0
You now can add the g_multi modprobe to bootlocal. I needed a short sleep between modprobing dwc2 and g_multi, e.g. sleep 5. Otherwise I had strange errors on enumerating usbs on the host computer.
For a working ether over usb I just set up the usb0 interface via ifconfig as described elsewhere in this forum for static eth0.
For a working serial via /dev/ttyGS0 I modified cmdline.txt to use GS0 and the /usr/sbin/startserialtty script.
@bmarkus -> I would be interested in having the usb modules builtin the image. They're less than 1MB in size and really provide a benefit for Pi zero users. Any more Pi zero users here?
If the modules could be builtin - Is there a way to modprobe dwc2 and g_multi and setting up usb0 ethernet automatically iff dtoverlay=dwc2 was added to config.txt? This would make an out-of-the-box pi zero gadget with serial or ethernet via usb.
Best
Johann
-
No two users will use the same hardware and driver. The base image is fine. My USB hub/ethernet uses the usbip-KERNEL.tcz package. After I burn the image, I mount the partition and add that extension to the drive, and edit onboot.lst Takes a minute to do.
-
@bmarkus -> I would be interested in having the usb modules builtin the image. They're less than 1MB in size and really provide a benefit for Pi zero users. Any more Pi zero users here?
If the modules could be builtin - Is there a way to modprobe dwc2 and g_multi and setting up usb0 ethernet automatically iff dtoverlay=dwc2 was added to config.txt? This would make an out-of-the-box pi zero gadget with serial or ethernet via usb.
gadget is not an essential functionality, it will not go to the base. However it can be useful to have when no ethernet is available. What we can do to make kernel modules and support programs if any as tcz, test and add to the repo. If it works fine, we can decide to preinstall same way as openssh.
@johannkraus
Can you provide list of kernel modules and user space programs, files needed?
-
gadget is not an essential functionality, it will not go to the base.
Okay - g_ether and g_mass_storage are not. But you currently support a serial connection via ACM0 or S0. Having gadget mode in PiZero one can have a serial connection without any additional hardware or cable (despite a power usb cable connected to the usb port, which is needed anyway for power). To me this seems more essential than connecting GPIO pins and sharing ACM0 ;) But I understand your point - ACM0 is available anyway ;D
@Paul_123 My point is that gadget is built into PiZero, therefore no need to buy any additional hardware nor to make software configurations. All PiZero users get this for free.
However it can be useful to have when no ethernet is available. What we can do to make kernel modules and support programs if any as tcz, test and add to the repo. If it works fine, we can decide to preinstall same way as openssh.
@johannkraus
Can you provide list of kernel modules and user space programs, files needed?
That would be fine. I'll have a look at the the minimal set of kernel modules needed for serial/ether/storage configurations and come back to you.
For now I can only tell what lsmod tells me
usb_f_acm 6023 1
u_serial 11369 1 usb_f_acm
usb_f_rndis 17023 1
g_multi 5631 0
usb_f_mass_storage 39135 2 g_multi
libcomposite 49319 4 usb_f_acm,usb_f_rndis,g_multi,usb_f_mass_storage
u_ether 14023 2 usb_f_rndis,g_multi
dwc2 109939 0
udc_core 12750 2 libcomposite,dwc2
Being lazy for serialtty I have:
Having cmdline0.txt (like cmdline3.txt) as
console=ttyGS0,115200 ...
my change to /usr/sbin/startserialtty is at line7
elif [ "${model:0:17}" = "Raspberry Pi Zero" ]; then
port=ttyGS0
However, this does not work if dwc2, libcomposite, usb_f_acm and u_serial are not available and modprobed before. And it should only be made iff the dwc2 overlay is used. I don't find infos about used overlays in /proc/device-tree otherwise I would just add this to the elif condition above.
And being even more lazy - for ether and mass storage I have in /opt/bootlocal.sh
# ------ Put other system startup commands below this line
/sbin/modprobe dwc2 # <- but this is too late for /usr/sbin/startserialtty and had to be moved to line 2
/bin/sleep 5 # <- and this is killing performance if moved to line 2 :) Currently searching a way to avoid it.
/sbin/modprobe g_multi file=/home/tc/piusb.bin stall=0
/sbin/ifconfig usb0 192.168.100.2 up
-
Any updates on this? Is there a tcz package available to setup u_ether? I'm using a pi zero and I haven't got a USB ethernet adapter so I'd really like to use this feature.
-
Any updates on this? Is there a tcz package available to setup u_ether? I'm using a pi zero and I haven't got a USB ethernet adapter so I'd really like to use this feature.
What are you missing?
-
Not sure where I get the dwc2 overlay and how to set it up. Running modprobe dwc2 gives me "modprobe: module dwc2 not found in modules.dep". Do I need to download the linux modules package (http://tinycorelinux.net/8.x/armv6/releases/RPi/src/kernel/4.4.20-piCore+_modules.tar.xz)?
-
dwc2 overlay is shipped with piCore. Enable it in /mnt/mmcblk0p1/config.txt For more info read /mnt/mmcblk0p1/overlays/README
Kernel modules in the archive
http://tinycorelinux.net/8.x/armv6/releases/RPi/src/kernel/4.4.20-piCore%2B_modules.tar.xz (http://tinycorelinux.net/8.x/armv6/releases/RPi/src/kernel/4.4.20-piCore%2B_modules.tar.xz)
Extract modules you need and create a personal tcz with them or add to backup, tcz is preferred.
-
gadget is not an essential functionality, it will not go to the base. However it can be useful to have when no ethernet is available.
It's also quite useful because the power usage via USB is about half of that with a USB/Ethernet adaptor, on a Pi Zero.
-
Sorry but I just can't figure it out. I have enabled the `dwc2` overlay in config.txt and I created a tcz package with the following modules added:
4.4.20-piCore+/kernel/drivers/usb/gadget/legacy/g_ether.ko
4.4.20-piCore+/kernel/drivers/usb/gadget/libcomposite.ko
4.4.20-piCore+/kernel/drivers/usb/gadget/function/usb_f_rndis.ko
4.4.20-piCore+/kernel/drivers/usb/gadget/function/u_ether.ko
4.4.20-piCore+/kernel/drivers/usb/gadget/udc/udc-core.ko
4.4.20-piCore+/kernel/drivers/usb/dwc2/dwc2.ko
I also put `modules-load=dwc2,g_ether` after `rootwait` in cmdline.txt and then I reboot my rpi. It doesn't show up as a usb device on my machine. Is there something I forgot to do?
I also tried the method described above with loading dwc2 and g_ether in /opt/bootlocal.sh with a 5 second delay and setting the ip with ifconfig but I can't ping it from my main machine.
Doing `ip link` doesn't show `usb0` and I see nothing in dmesg or a difference in `lsusb` before and after plugging in my RPi. I have tried with multiple microusb cables too. When I plug in my phone I see a new usb device was connected so I know that works.
-
Have you tried to run
sudo lsmod
, to see if the modules have been loaded.
-
How can I do that without a keyboard? I can plug in a monitor but I wont be able to use a keyboard because the only USB port on the pi zero will be occupied by my OTG cable.
-
USB uart adapter connected to gpio pins.
Add console to cmdline.
-
Sorry but I just can't figure it out. I have enabled the `dwc2` overlay in config.txt and I created a tcz package with the following modules added:
This happened to me when I added dtoverlay=dwc2 to the last line of config.txt. As some lines above there is a [RPI3] statement your overlay will not be loaded on a RPI0.
So either move this some lines up to the [ALL] section or better add a [RPI0] statement before this line.
I also put `modules-load=dwc2,g_ether` after `rootwait` in cmdline.txt and then I reboot my rpi. It doesn't show up as a usb device on my machine. Is there something I forgot to do?
As far as I can tell adding modules-load to cmdline.txt will not work with Tiny Core Linux. This is a feature only available in Raspbian. So please add modprobe to /opt/bootlocal.sh.
As soon as g_multi is in lsmod you can setup usb0 via ifconfig. Your keyboard will still work after modprobing dwc2, g_multi, ... (until you unplug ;) ).
-
Alright, have not had much time to work on this project lately but I successfully added the modules and it seems like dwc2 module is loaded on boot now. Here is the output of lsmod:
usb_f_rndis 17023 0
u_ether 14023 1 usb_f_rndis
libcomposite 49319 1 usb_f_rndis
dwc2 109939 0
udc_core 12750 2 libcomposite,dwc2
squashfs 32160 62
i2c_bcm2708 5740 0
spi_bcm2835 7424 0
bcm2835_gpiomem 3823 0
bcm2835_wdt 4133 0
zram 22461 1
uio_pdrv_genirq 3718 0
zsmalloc 14329 1 zram
lz4_compress 3289 1 zram
uio 10230 1 uio_pdrv_genirq
My problem now is that g_ether fails to load properly, here is the output of dmesg:
[ 22.042841] dwc2 20980000.usb: EPs: 8, dedicated fifos, 4080 entries in SPRAM
[ 22.573179] dwc2 20980000.usb: DWC OTG Controller
[ 22.573255] dwc2 20980000.usb: new USB bus registered, assigned bus number 1
[ 22.573318] dwc2 20980000.usb: irq 33, io mem 0x00000000
[ 22.573590] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[ 22.573609] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 22.573622] usb usb1: Product: DWC OTG Controller
[ 22.573634] usb usb1: Manufacturer: Linux 4.4.20-piCore+ dwc2_hsotg
[ 22.573645] usb usb1: SerialNumber: 20980000.usb
[ 22.577937] hub 1-0:1.0: USB hub found
[ 22.578019] hub 1-0:1.0: 1 port detected
[ 27.653659] g_ether 20980000.usb: failed to start g_ether: -2
This is the output I get from trying to manually do: sudo modprobe g_ether
modprobe: can't load module g_ether (kernel/drivers/usb/gadget/legacy/g_ether.ko): unknown symbol in module, or unknown parameter
-
Check the kernel module dependencies. You have a missing module.
-
@bmarkus
I checked the modules.dep file and it reported the following dependencies (same out as running modprobe --show-depends g_ether):
kernel/drivers/usb/gadget/function/usb_f_rndis.ko
kernel/drivers/usb/gadget/libcomposite.ko
kernel/drivers/usb/gadget/udc/udc-core.ko
kernel/drivers/usb/gadget/function/u_ether.ko
Here is the files I have in my package:
`-- lib
`-- modules
`-- 4.4.39-piCore+
|-- kernel
| `-- drivers
| `-- usb
| |-- dwc2
| | `-- dwc2.ko
| `-- gadget
| |-- function
| | |-- u_ether.ko
| | `-- usb_f_rndis.ko
| |-- legacy
| | `-- g_ether.ko
| |-- libcomposite.ko
| `-- udc
| `-- udc-core.ko
`-- modules.dep
I couldn't find any other dependencies in modules.dep that g_ether requires or any of its dependencies.
-
By using the modinfo command.
modinfo g_ether
Sometimes the depends: shows what modules it needs.
-
Why not test to include the hole gadget directory to your own module extension pack.
And this is how to managed to do the module extension pack.
http://forum.tinycorelinux.net/index.php/topic,18858.msg129216.html#msg129216
You modify the example above with just two lines. And also the dwc2 driver.
mkdir -p /tmp/package/usr/local/lib/modules/4.4.39-piCore\+/kernel/drivers/usb/gadget/
cp -r /home/tc/modules/4.4.39-piCore\+/kernel/drivers/usb/gadget/* $_
There are also lots of parameters to be set.
modinfo g_ether.ko
filename: g_ether.ko
license: GPL
author: David Brownell, Benedikt Spanger
description: RNDIS/Ethernet Gadget
srcversion: 5E4C828D24F6E477C9CB5EE
depends: libcomposite,u_ether,usb_f_rndis
intree: Y
vermagic: 4.4.39-piCore+ mod_unload modversions ARMv6
parm: idVendor:USB Vendor ID (ushort)
parm: idProduct:USB Product ID (ushort)
parm: bcdDevice:USB Device version (BCD) (ushort)
parm: iSerialNumber:SerialNumber string (charp)
parm: iManufacturer:USB Manufacturer string (charp)
parm: iProduct:USB Product string (charp)
parm: qmult:queue length multiplier at high/super speed (uint)
parm: dev_addr:Device Ethernet Address (charp)
parm: host_addr:Host Ethernet Address (charp)
parm: use_eem:use CDC EEM mode (bool)
-
See
depends: libcomposite,u_ether,usb_f_rndis
-
Okay, I think I've resolved the dependencies but still I can't load the module with the same error. Do I have to manually specify all the parameters listed by `modinfo` to the kernel module?
-
Hi, may be, that my approach is quite different, but why not to use the u-boot bootloader to do all that stuff?
It is designed exactly for this purpose. It has USB and ethernet drivers and you may simply flash the card and do even much more. It's really powerfull. Look: http://www.denx.de/wiki/U-Boot/WebHome
-
thanks for the tip @jgrulich it certainly looks like something interesting but I'm already commited to the approach with picore + g_ether but I'll keep this in mind if I run in to more problems.
-
Okay, I think I've resolved the dependencies but still I can't load the module with the same error. Do I have to manually specify all the parameters listed by `modinfo` to the kernel module?
Just to be curious: What happens if you load g_multi? I just tried to modprobe g_ether and got a "No such device error". But g_multi works on my Pi.
According to this site (http://trac.gateworks.com/wiki/linux/OTG) there seem to be alternative modes for ethernet:
- cdc eem
- rndis
This might be switched in g_ether via use_eem parameter (but probably only when compiled with support - and I was not able to switch).
From dmesg I don't see which one (rndis / eem) is used with g_multi. But my host tells me:
[1210370.212087] cdc_acm 1-4:1.2: ttyACM0: USB ACM device
[1210370.212363] usbcore: registered new interface driver cdc_acm
[1210370.212365] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[1210370.287192] usbcore: registered new interface driver cdc_ether
[1210370.293888] rndis_host 1-4:1.0 usb0: register 'rndis_host' at usb-0000:00:1a.7-4, RNDIS device, 12:88:92:94:83:ca
[1210370.293911] usbcore: registered new interface driver rndis_host
[1210370.317397] usbcore: registered new interface driver rndis_wlan
[1210370.319988] rndis_host 1-4:1.0 enp0s26f7u4: renamed from usb0
-
Thanks @johannkraus and others for the help I got it working now. Not sure what I was doing wrong but it seems that redoing the steps again got it working. `g_ether` works fine for me with the rndis mode for ethernet.
-
Hi...i am a new user here. As per my knowledge it can be useful to have when no ethernet is available. What we can do to make kernel modules and support programs if any as tcz, test and add to the repo.
-
See the extension making section of the wiki here:
http://wiki.tinycorelinux.net/wiki:creating_extensions
In addition, for RPi, there are more kernel modules here:
http://tinycorelinux.net/9.x/armv6/releases/RPi/src/kernel/4.9.22-piCore_modules.tar.xz
-
can someone summarize the exact steps in the right sequence to enable the OTG serial access please? I'm fighting with this almost couple of hours without any success. It is so easy in Raspbian...
-
Sorry, I am new too. I have no advice to give, but was worried that nobody responded yet? Have you tried the Rpi pages? Some of the threads on this forum reference things like SSH and "headless Pi" and OTG and USB Gadget.
My interest is in Pi Brambles, and, specifically, SD-card unmounted Pi zero Brambles. Here are a few other threads that might help.
http://forum.tinycorelinux.net/index.php/topic,21821.0.html
http://forum.tinycorelinux.net/index.php/topic,22341.0.html
http://forum.tinycorelinux.net/index.php/topic,20195.0.html
I think those threads might help, but I am too new to linux (the sum total of my coding ability is "DOS for idiots", "anatomy of hexadecimal JPEGs" and 6502-assembly language) to offer real advice.
-
Sorry, one link above is THIS PRESENT POST! You've obviously been there/here. I meant to post this other one : http://forum.tinycorelinux.net/index.php/topic,22211.0.html
-
So, I have managed to (1) purchase 3 QTY raspberry Pi's (12 total QTY, envisioned), (2) purchase one SD card and 2 power supplies, (3) Install PiCore9.0.xsomething?, using?, maybe GParted (GUI) to zero the card and format and partition it, and , $dd if=PiCore-9.0.img of=/dev/sdb to put the image onto the SDcard.
If I remember right, I did not really use GParted to partition; I think just to low-level format. I think the dd command I used is the one that determined the size, and shape, and flavor, and etc. of the partitions, and the "structure" of the file system(s). The vagueness of the above description reveals the extent of my ignorance. In short, so far, much of the process was automatic.
To my surprise, it booted, and I had a command line. The user name and password took a guess or two, because some website I was on told me the wrong info. I think it booted to tc@box:^$ as the username, and I think PiCore was the password. One website told me this was the default, and another said default was no-password? Perhaps the latter was for another version of PiCore and/or tinycore?
Anyhoo, @bot, I am sorry I cannot solve your problem yet, but I might be working on it soon. I will try the Raspbian instructions on my new PiCore machine (Pi Zero) and see if they work. I think I will be trying the Gadget Ethernet, not Gadget Serial, as I do not have the "TTL-USB console wire-thingy", and don't plan on purchasing one just yet.
https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/overview
https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/serial-gadget
https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/ethernet-gadget
https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/ethernet-tweaks
https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/other-modules
@bot, I am, of course, without any ability to offer advice on these pages, as I lack perspective and wisdom in this area.
I am still learning the relevant linux commands, and the one time I had PiCore "fired up", i.e. booted, I couldn't even shut it down or unmount it, for lack of the proper terminology! I think I hacked some solution that PROBABLY wouldn't corrupt the card on shutdown, but I forget since (my handwritten notes inform me) I was working on this back on 11/26/2018.
A couple more days poking around on various linux websites, and I found the relevant commands; (a) shutdown, (b) kill, (c) reset, (d) exit, (e) umount, (f) umount -l [lazy unmount] , (g) eject, (h) ps or pstree, followed by kill , (i) sudo shutdown -r now, (j) sudo reboot, and et cetra, et cetra ... (Also, perhaps, REISUB; How did I not know REISUB? Too many years on a windows computer, I am a Ctrl+Alt+Del man!).
So, the next steps in my plan, are (4) umount -l /dev/sdx , followed by (5) eject /dev/sdx ( I think sdx might be something more like mmcblkx?) . Hopefully this works without a hitch, but I have a feeling I will have to reference the thread : http://forum.tinycorelinux.net/index.php/topic,21821.0.html in order to actually get the thing working properly. (I don't yet understand all this business about "loading extensions" and "creating persistence"; I assume that PiCore loads entirely to RAM, lives there while it is on, and disappears from RAM when the power goes off; leaving the SDcard to give a fresh boot next time? Safe assumption, or must I work to achieve this?).
Next step is to (6) fire up the second Raspberry Pi Zero, and boot PiCore9.0.? to it, (7) repeat above steps to remove the SD card, (8) buy a third power cord (or better yet, a multi-USB power hub module, of some kind), (9) Figure out how to Ethernet gadget them all, except the first one, which, like the mighty Sauron, will be "one USB Host, to rule them all, and in the Pi-ness bind them", and finally, (10) buy 9 more Pi-zeros (with appropriate power supplies and micro-USB-to-micro-USB comm. wires)
OK, that's my plan. @ bot, I hope you are not really a bot, as I have, thus, wasted much time speaking to imaginary things, of imaginary things. But my imagination has made a computer that my mind/hands can't quite build, so, perhaps, the writing of this post will organize my thoughts and make it happen?
-
So, life intrudes, projects are delayed, but I'm back. This is an extension of my 20 year quest for Strong AI, itself an extension of my investigation of Natural Intelligence, and really only in the last 5 to 8 years have I been trying to organize the "silicon" to get it done right. Previously, I posted some interesting comments on a 6502 forum, back about 2014 or 2015. Those are worth reading, to understand the development of my thought on these topics.
Back in my "retro-6502" days (2014-2015), I was working on my plans for "robot eyes". Those are "still in the works", but, for today, and yesterday, and the next month or two, I will need to start organizing my "robot spinal cord". Namely, USB gadget-ize, 10 R-Pi zeros, and distribute the boards, physically, onto a titanium skeleton (11+ QTY. , 8 mm. diameter, one-foot sections; 8 for limbs; 3 for spine; + miscellaneous? ; motors, "muscles" and "joints" are "in the works"). Originally I was on a very shoestring budget and figured "run clean and light" and thus, picore, RAM-resident (saves money on micro-SDs), but I can probably afford the SD cards now. Still, I was glad to stumble on this old post, and to try to update it with my experience.
Also new to this project, is my dedicated, wall-plug power supply, with some 12 USB "ports" (receptacles), all of them dealing 1 Amp or more, up to 3.5 Amps for some "ports" (receptacles). So, plenty of power. Even if I USB gadgetize the 8 peripheral processors, "the limbs", I will leave them booted and powered from this power supply, and just use the USB gadget function to program--through a 10 "port" (receptacle) USB strip--from the master board to the slaves. Eventually, I will do the "Ohm's Law" math, and get it battery or maybe even solar powered.
I was not sure I knew how to do this; how to gadget-ize while leaving the power supply in place, or if there was some extra programming involved? As it might have been the case that plugging one r-pi zero (gadgetized) into another (non-gadget) would force the non-gadget to power the gadget. The master RPI zero cannot run 10 slave RPI zeros through its USB port; not enough amperage supply. But, luckily, this is not the case, as my USB volt-ammeter confirms. With a series of interesting little experiments I have gotten 2 Raspbian slaves to show up on the network of one Raspbian master, and crucially, they remain powered by my external power supply, not the R-PI zero master-board. I should probably try to see if two raspbian slaves will show up under (ifconfig) one picore master? I bet they would? I should try that today.
So, with the equipment above, and just ping, ifconfig, lsusb, lsblk, and a little bit of knowledge about IPs, I was able to get the 2 boards to show up under ifconfig, as "usb0" and "usb1", with assigned , dynamic IP (IPv4) addresses. I should probably study RNDIS, a bit, as I think that might be the "protocol" that assigns IPs to usb devices? I don't know? I had a few "USB books" by Jan Axelson, but they were too high level to interest me ( I like physics of ones and zeros; bare metal) and too low level to be practical to this project. The advice of johannkraus is JUST RIGHT. Nevermind the books. roll up your sleeves and DO IT!
It probably wouldn't hurt to reassign user-names, hostnames, and passwords, both for my Raspbian SD cards, masters and slaves, and for my piCore masters and slaves. That way IP addresses would be easier? I suppose I could also assign static IP addresses? I know how to do that, but I forgot. Also, with cat /proc/cpuinfo I can take notes on the serial numbers of each device, so that my scientific experiment is more rigorous (meticulous notation!).
Anyhoo, so, last night I stumbled on this post again, and saw--now, with my two years experience in linux CLI--that johannkraus provided excellent instructions; albeit, a bit cross purpose to my own. But his knowledge of rpis and adding modules and of tiny core persistence has helped me, quite a bit, to organize my thoughts and move my programming actions in a positive direction (instead of continued 2 year stagnation).
So last night I (1) found and downloaded modules, (2) unzipped and placed on a flash drive, { (2b) removed flash drive from laptop; booted rpi zero with not-yet-gadget-ized picore 9.0.? ; and plugged flash drive into the rpi zero } ;(3) navigated the CLI of picore (I have v. 9 and v. 11 picore; but no desktop, as of yet) to place the relevant modules in /lib/.../usb , as johannkraus indicated, (4) ran his depmod -a command, even though I don't know what it does, (5) updated .filetool.lst and ran backup, (6) added /sbin/modprobe dwc2 to the onboot.lst , even though I dont know what that does. Presumably, on boot, something "new" will happen?
And then I got tired and fell asleep.
I see, this morning, that I did forget to get the file modules.dep . I wonder if it is a necessary one?
I suppose I should just try plugging the microSD into my laptop, edit the cmdline.txt (or was it cmdline.txt ?) to include dtoverlay=dwc2, and then eject, and then go boot a pi or two, to see if one will be master and one slave? See if ifconfig comes up with more than just a loopback address? comes up with a "usb0" readings; and an IPv4 inet address for it? I could ping it, just for fun!
I also ignored johannkraus' steps about g_multi , since I think this is needed for his mass storage device, whereas, I need g_ether, for my device.
I kinda wish I knew what he meant by this :
"For a working ether over usb I just set up the usb0 interface via ifconfig as described elsewhere in this forum for static eth0."
Any ideas? Anybody? Suggestions?
I think I recall somebody posting (above, somewhere?) that the raspbian instructions to add to cmdline.txt "modules-load=dwc2,g_ether" command doesn't work with picore? hmmm? I'll think about it? Try it?
I have some more steps to figure out this morning, and still have to follow the rest of the thread. Somebody else had trouble getting g_ether to work, but eventual with johannkraus' help--and some perseverence and elbow grease--they got it going.
-
Ugh! Failure.
sudo poweroff. Count to five so the electrons can all find their homes. Slide the card out. Put it in the laptop. Un-dtoverlay=dwc2 the config.txt file.
Now, I did try the:
[RPI0]
dtoverlay=dwc2
version of that line; somebody else mentioned trying that . Maybe I will try it under the [ALL] heading instead? Or erase, or comment-out, the [RPI3] line?
I dunno? Otherwise, I have to dig through all the other modules, maybe try g_multi like johannkraus did? Or see what the other g_ether fella did to get it working?
I dunno? I guess I'll have to learn lsmod, modprobe, depmod, dmesg, and a hundred other things?
-
Tried commenting out [RPI3] AND commenting out line below it AND asserting the [RPI0] line AND asserting the proper line below it. No dice.
I think this is not the right direction (though I could try asserting [ALL] AND asserting the proper line below it ; deleting RPI0 line and commenting out RPI3 line).
No, I think I need some more fundamental understanding of what is going on here; how all the "moving parts" work together? RTFM? Yup.
-
OK, gbaman says:
"g_ether - Using virtual ethernet, you should simply be able to ssh into the address of your Raspberry Pi. To do this, there is a little extra configuration required though. There is a few ways we could set up the point to point networking. The proper way would be to set up a DHCP server on one of the ends. A far simpler way though is just to give the Raspberry Pi a fixed IP address. To do this, you will need to run echo -e "interface usb0 \nstatic ip_address=169.254.64.64" | sudo tee -a /etc/dhcpcd.conf. You can then access the Raspberry Pi Zero by connecting to 169.254.64.64, or by using raspberrypi.local if your computer has Bonjour installed (Mac and most Linux OSs including Raspbian). Note this method does not support adding a fixed address to the cmdline.txt file. For that, you have to use the Ethernet only kernel below."
This, I should try next. Static IP address.
Right after I make certain I know what lsmod and modprobe and depmod does. And install modules.dep? I wonder where to put this file?
OK, I just this second, fixed one issue. My modules.dep file, had mostly HID and net entries; very few or none, for "gadget". So definitely need to update/replace/save a new modules.dep file. Step 1 identified. Step 1 accomplished!
-
OK, even worse (better, now I know!). My modules.dep file was insufficient, because I did things wrong. I think I should take the WHOL:E FOLDER for 4.9.22-piCore from the picore scr, unzip it, and replace the WHOLE FOLDER on the picore-slave card. Then modules.dep will point to all the extra modules I could possibly want. (g_ether, g_serial, g_multi, etc.)
Last night, I just grabbed the few that I thought I would want/need. Apparently, I need "the whole structure"? I suppose if I was good with modprobe and depmod, commands, I could figure out a frugal way, but I am fairly certain the extra MB will not be onerous?
OK, maybe I'm smart enough to be frugal, but forgetful about persistence? Forgot to make my modules.dep "update" permanent last time. So I have reinstalled the 1000-2000 lines of modules.dep (vs. 100-200 from standard install, picore modules.dep). Around line 189, g_ether is described as having four dependencies; rndis, udc-core, libcomposite, and u_ether (not exact names; but you get the picture; .ko, object files, I guess?).
So I can probably be frugal if I just am certain to include these four files?
This is the point of depmod, right? to update the modules.dep file?
The "WHOLE FOLDER" (updated, scr, /lib/modules/4.9.22-piCore/) is 50 MB, which, for a normal picore install of 50 to 100 MB, is significant; nearly doubling the size of the operating system? But if that is the only way that I can get it to work, that is what I will do.
-
Boy I hate software. My USB books always spoke of Host vs. Device, and sometimes, master vs. slave, but all this "gadget" stuff seems REALLY imprecise? Maybe its just my poor old biologist-brain?
So I have the master-picore booted up, and it LACKS the g_ether modules. Is this OK? I assume the point of updating the slave-picore to have g_ether modules incorporated into its core, is to teach the slave, or "USB-Device", how to not be master, AKA how to not be "USB-host"? So, the master, the USB-host, doesn't need this lesson. It should be able to go on doing its "Host" thing.
There was an error when I booted the two boards up (simultaneously; I throw one big power switch. But I could leave the slave board "USB-info-wire" unplugged until they both get booted up? And THEN, try to plug slave/device to master/host? I will try this next.). The error said something about usb timeout?
I will boot again, with info-wire unplugged. If error messages go away, Hooray! If ifconfig reads a usb0 entry, Hooray! If not, then I will try again to provoke the error message by booting with everything hooked together. Then maybe a dmesg to find out what the error means? or further "internet-sleuthing"?
-
So, if piCore can't do the "cmdline.txt", "modules-load=dwc2,g_ether", then, do I have to do something else in its place?
Or is that what I am doing, here, manually, with all the plugging and unplugging and file-shuttling and modprobing and stuff? I am the module loader here, and thus this "normal" step can be skipped?
Obviously not, since I am bad at loading/implementing kernel, modules? I could use some automation!
I hope I don't have to assemble or compile or link the object files? (.ko is an object file, right?) I mean, I read about it in a book once, but never had to perform where it counts?
I'll just fumble around with a few other things until I get desperate enough to try "old school", blob-making, machine code.
I can try using a Raspbian master-board-card with my purported-putative-picore-slave?
Or I can try using my picore (11) master with my two (functioning) Raspbian slaves?
That should suffice for today's work. There is a Star trek TOS marathon (AKA soap commercial delivery vehicle) on today, and I want my HDMI-TV back for "fun stuff".
-
OK, I dmesg-ed the picore master-board-card. I didnt grep it or cat it or search it or even pipe | less it. The last ten or twentey messages indicate that some USB device is trying hard to reach the master.
This device is device 7-14. The errors in getting recognized involve "failed to enumerate device", and "port3 attempt power cycle", and "error -110", and "device not accepting address 7 (thru-14?, etc.)", and "device descriptor read/64".
I was ifconfig-ing it, And I was lsusb-ing it. Perhaps this was creating the errors. was also plugging and unplugging the slave-board-info-wire from the master-board-10-hub-strip, i.e. info-wire. Both boards are powered from their dedicated USB power jack.
OK, like I said, enough troubleshooting for today. I should read more, or understand more before I try again.
-
This is an excerpt of a PM I sent; a plea for help. But I might break out of this zombie thread, and start a new post somewhere; with "half-success" of my bramble-pi, I have experience to share, despite the flounderings my ramblings show, in this post.
"I HAVE been able to get Raspbian to do what I want; one board/SDcard for master, and a different board for slave. Also, I have a USB voltmeter-ammeter to check that both boards draw an independent power supply through their power USB-receptacles; leaving the other USB-data-receptacle to pass master and slave instructions and responses. I was worried that USB gadget mode would force the slave to try to obtain power through the master's "USB-info"-receptacle; but it does not.
(Although I have read some internet "horror stories" of fried boards due to cheap USB hubs and/or "newbies", like me, plugging things in wrong, and some "back-voltage"/"back-flow" occurring. But I don't really know much about this and just cross my fingers that it doesn't happen to me.)
So, what's the problem, you say? I would like to boot 10 "peripheral boards" --slaves--from one micro-SD card; a piCore9.0.3 that has been outfitted with ethernet gadget mode. That way, I can boot each one in sequence, eject and remove the card, then boot the next one; and in this way use the same card to get the whole array of r-pi zeros up and running. And for the one master-picore board, I could afford a spare, extra SD-card, and just leave that one in while it runs the show.
I have followed many/most of johannkraus' instructions, blindly, in some instances, but still can't get ifconfig to show the picore slave as eth0 or usb0?
I have added modules, but I "picked and chose"? Maybe I needed to add the WHOLE 50 MB of modules? I am using piCore 9.0.3 for the slave board, and I have downloaded the entire 50 MB and unzipped it on my laptop. I then dragged and dropped the files I wanted onto flashdrive, and brought flashdrive over to the booted picore 9.0.3. The modules i dl-ed were for Linux kernel 4.9.22. (I also have the unzipped modules file for picore 11; but have not used them; my picore 11 card is a master, for now).
The master-picore is the latest version. Picore 11.0. But that shouldn't matter.
I have run depmod -a. The modules (folders) that i have added to /lib/modules .../drivers/"et-cetra" , have been added to the opt/.filetool.lst list, and saved, and I have used the backup command. I have ensured that I have the dependencies for the g_ether function; there are four listed in the modules.dep file.
I actually manually transferred the modules.dep file from the 4.9.22-modules package to the picore. I'm pretty sure its added to .filetool.lst and used the backup command after that too.
I have altered the config.txt final line to read dtoverlay=dwc2. I have used # to comment out the line [RPI3] and the line below it.
I have not altered the cmdline.txt file in any way; in contrast to the Rapbian method of ethernet-gadgeting.
So, I get two kinds of behavior in my setup. I can use a picore master and raspbian slave; and a raspbian master and picore slave. Right now, both of these setups show, under dmesg, that the slave board is trying to reach the master (there are several types of error messages; I might detail them below, if I can't figure this out in less than a week). Failled to enumerate. Device is trying to power. error -110. failed with error -16. failed with error -22. etc etc etc.
Now with picore as master and raspbian slave, lsusb registers a USB device is there, but ifconfig does not show any eth0 or usb0.
****ASIDE: (Hmmmm... now that I think of it, this is CURIOUS behavior? A Raspbian slave works fine if the master board is Raspbian too? Which indicates that the piCore11, master-SD card, is the one that can't handle the ethernet-gadget devices? hmmmm? It can register them in lsusb, but not configure them and assignan IP? hmmmm?)***********
With raspbian as master and picore as slave, neither lsusb or ifconfig registers a USB device.
The dmesg USB errors are different for these two different setups. I suppose this will be my next clue.
And, just for completion's sake, I'll describe further, the final two possible setups; with raspbi-master and raspi-slave, the setup works and usb0 and usb1 show up under ifconfig, and are assigned IP addresses. And for picore-master and picore-slave, the thing I am trying to achieve, nothing under ifconfig. (I haven't checked the dmesg ? maybe it will show evidence of the slave trying to get recognized on the bus, and getting errors/failure notices?).
The dmesg messages are definitely related to my plugging and unplugging the slave board to the USB-10-receptacle strip that I have connected to the USB-info-receptacle of the master board. The master board is in charge of this 10-receptacle-strip and dmesg notices when things are plugged and unplugged.
OK, well I hope this enough to adequately help you to troubleshoot with me. It would be VERY helpful. In the meantime, I will do some more research on the particular errors encountered in dmesg. I will write them out longhand and type them up and maybe post my tragedies on the forum post, in the hopes somebody will take pity on me.
A last ditch desperation would be to wipe the picore 9.0.3; start over with picore 11; load ALL the modules, 50 MB worth (Whoah! 800 MB for picore11/Linux-4.19.81 !) ; repeat the steps johannkraus listed about depmod, and persistency. and try again? But I don't really want to start over. I feel like I am close to success."
-
OK, I think I have my head screwed on straight here. I put ALL of the drivers from the 4.9.22 modules zip file onto the piCore-9.0.3, soon-to-be-gadgetized micro-SD card.
I checked modules,dep ( in vi editor ), and it has 1559 entries; this is the same as if I opened up that file (taken straight from the 4.9.22 modules zipped file) on my laptop; 1559 lines.
The original modules.dep that comes with the 9.0.3 image is only like 180 lines.
There are 1900+ items in the 4.9.22 modules zip (or tar or xyz or whatever it was) file. Because I was using command line interface (I haven't figured out desktop TCZ stuff yet) I am not certain I left the original modules and structures in tact? I might have just overwritten the old modules with all the 1900+ QTY new modules? Do these 1900+ new modules need a special "implementation" command?
Anybody sensing any problems yet? I would like to think I am done with modprobe and depmod and dependency-searching and LKM-and-.ko "kernel stuff"?
johannkraus mentions after adding dwc2 overlay to config.txt and modprobe dwc2 in Raspbian there is another tty in dev -> ttyGS0.
and I stumbled across this link https://linux.die.net/sag/hwutils.html (https://linux.die.net/sag/hwutils.html) . I haven't digested / cogitated it yet?
I dunno. Lunchtime. Miore later, If I get motivated.
-
Hi ladnar
There are kernel module extensions available. This is a list of extensions available for piCore 9:
http://tinycorelinux.net/9.x/armv6/tcz/info.lst
You can open the file in a web browser and search for 4.9.22 for the names of the kernel module extensions.
Or you can run these commands to see the names of the 18 extensions:
tc@E310:~/zzz$ wget http://tinycorelinux.net/9.x/armv6/tcz/info.lst
--2020-10-01 16:36:03-- http://tinycorelinux.net/9.x/armv6/tcz/info.lst
Resolving tinycorelinux.net... 89.22.99.37
Connecting to tinycorelinux.net|89.22.99.37|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 21994 (21K) [text/plain]
Saving to: 'info.lst'
info.lst 100%[==========================================================================================================================>] 21.48K --.-KB/s in 0.09s
2020-10-01 16:36:03 (246 KB/s) - 'info.lst' saved [21994/21994]
tc@E310:~/zzz$ grep 4.9.22 info.lst
alsa-modules-4.9.22-piCore.tcz
ax25-4.9.22-piCore.tcz
bluetooth-4.9.22-piCore.tcz
filesystems-4.9.22-piCore.tcz
graphics-4.9.22-piCore.tcz
ipv6-4.9.22-piCore.tcz
net-bridging-4.9.22-piCore.tcz
netfilter-4.9.22-piCore.tcz
net-sched-4.9.22-piCore.tcz
net-usb-4.9.22-piCore.tcz
ppp-modules-4.9.22-piCore.tcz
raid-dm-4.9.22-piCore.tcz
rtc-4.9.22-piCore.tcz
usbip-4.9.22-piCore.tcz
usb-serial-4.9.22-piCore.tcz
v4l-dvb-4.9.22-piCore.tcz
w1-4.9.22-piCore.tcz
wireless-4.9.22-piCore.tcz
tc@E310:~/zzz$
You might want to check if any of them contain the modules you need.
-
Rich, I will take that under advisement. I am already swimming deep over my head. I better tread water, float, and catch my breath.
Still going over johannkraus' successful attempt, and his and the community's help getting Linkan to have succesful g_ether. Maybe my mistakes will be revealed?
But bot was still having problems when I first popped on this thread, so I am guessing whatever the solution is, its not well documented.
(I wonder if there is a software way to tell which USB port on a pi-zero is drawing the power? Anybody have a command for that? I guess i could use my USB voltmeter-ammeter; ideally, I would need two or four volt-ammeters for proper experiments?)
Anyway, I am on JK's second message, about where he says RTFM; OI will do that. And follow his advice:
"I copied dwc2 and the gadget modules to lib/modules/.../usb and also copied modules.dep " .I assume depmod -a should be better than copying modules.dep
depmod -a should create the modules.dep file ; maybe copying it into the directory skips an important step? I'll make certain that is done and then make the results persistent. And then read some more!
-
OK, apparently I didn't make the loaded modules (all 1900+ .ko files) persistent?
If I run depomod -a, the modules.dep file goes from having 1500+ entries back down to 180+ entries?
When I reboot, modules.dep goes back up to 1500+ entries (I made that persistent, at least!). I guess I can count the ,ko files in the /lib/modules/4.9.22-piCore directory? There's a command for that, if I can remember it / find it?
If there are 1900+ .ko files, I can install/configure them all? Or is this overkill?
modules.dep says g_ether only needs four files: usb_f_rndis.ko , libcomposite.ko , u_ether.ko , udc-core.ko
I dunno. read more manuals? Learn how to configure the kernel? I guess.
-
I was worried modprobe didn't know the path pr couldn't work from root , from /
This website https://gist.github.com/gbaman/4c1345c0c4d6d82149d4 (https://gist.github.com/gbaman/4c1345c0c4d6d82149d4) , although for Raspbian, says this 11. To manually load a kernel module, after rebooting use sudo modprobe moduleName. To unload a module, use sudo rmmod moduleName.
That seemed like good advice. Also, the previous 6 items.
6.Then run sudo cp -R /tmp/PiZeroCombined/fat32/* /boot/ (to copy the kernel and device tree stuff)
7. Then run sudo cp -R /tmp/PiZeroCombined/ext4/lib/* /lib/ (to copy the kernel modules themselves)
8. At this point, you have 2 options, you can either set the module you want to run on startup, or dynamically load and unload them.
9. To set a module to load on startup, edit the modules file with sudo nano /etc/modules and add the module name you want to start (e.g. g_ether) to the end on a new line. Also, make sure to the check the "Using the modules" section before rebooting.
10.Then, reboot the Raspberry Pi using sudo reboot. (http://6.Then run sudo cp -R /tmp/PiZeroCombined/fat32/* /boot/ (to copy the kernel and device tree stuff)
7. Then run sudo cp -R /tmp/PiZeroCombined/ext4/lib/* /lib/ (to copy the kernel modules themselves)
8. At this point, you have 2 options, you can either set the module you want to run on startup, or dynamically load and unload them.
9. To set a module to load on startup, edit the modules file with sudo nano /etc/modules and add the module name you want to start (e.g. g_ether) to the end on a new line. Also, make sure to the check the "Using the modules" section before rebooting.
10.Then, reboot the Raspberry Pi using sudo reboot.)
I assume things are similar for PiCore. "6.Configure kernel? , 7. Load the necessary modules? 8-9. Add sudo modprobe g_ether to onboot.lst ? 10. then, make persistent (filetool.lst ; and "backup") and reboot.
and, of course, 11. modify config.txt with the dtoverlay=dwc2 line.
No warranty on the above methodology. In fact, is there an opposite of a warranty? Indemnification? Warning.
-
OK, I su-did the following (You like that one? I made that one up myself!)
modprobe g_ether.ko
modprobe udc-core.ko
modprobe libcomposite.ko
modprobe usb_f_rndis.ko
modprobe u_ether.ko
I think That's everything. I should make it persistent.
I forgot to check if I have the 1900+ files of the entire 4.9.22 zipped modules file (I've got them backed up, stored, on my kali laptop; but they won't do much good there! Have to get them persistent and in the right folders on the piCore-slave uSD, and get the kernel to talk to them? config-ed with them? or whatever it is that modules do with kernels?).
I have a notebook around here with simple CLI commands like "How many freakin' MB of data in this folder", and "How many files in this folder; and all the folders beneath it?".
"How many files does this folder collect, before you can call it a man? How many Trees, of devices are here, stored within this silicon we got from sand? Yes and how many times, must the Shebangs fly, before we close it out with a Sh@z@m? The answer my friend, is not in this crappy poem; the answer is not in my bad poems."
-
Sorry if this brings you back to Linux preschool, but the repetition helps me.
Count Files using wc :
$ ls | wc -l
Count Files Recursively using find :
$ find <directory> -type f | wc -l
Count Files using tree :
$ tree <directory>
3 directories, 3 files
Check Disk Usage in Linux Using the du Command :
du <options> <location of directory or file>
I DON'T have all 1900+ files persistent on the card. i goofed up somewhere? But maybe don't need them? I modprobed the five .ko's that I KNOW I need.
I bet I have to "configure the kernel" (whatever that means?) ... Yuuuuclk .... uggggh! Onerous tasks!
I guess for tonight, I will depmod -a to update the module.dep file (or not; maybe try it with and without update?); and I will alter config.txt to say dtoverlay=dwc2 ; and I will look for an etc/modules (like in raspbian) to add g_ether as the last line; but picore probably wants it in the onboot.lst, I'll wager? Then try to boot piCore as a g_ether gadget device.
If that doesn't work, I will have to quit for a few days while I read about kernel configuration.Yuck. I mean, closed door=opened window ?
-
Hi ladnar
You could create a gadget extension (squashfs-tools.tcz required):
tc@E310:~/pi$ wget http://tinycorelinux.net/9.x/armv6/releases/RPi/src/kernel/4.9.22-piCore_modules.tar.xz
--2020-10-01 22:58:43-- http://tinycorelinux.net/9.x/armv6/releases/RPi/src/kernel/4.9.22-piCore_modules.tar.xz
Resolving tinycorelinux.net... 89.22.99.37
Connecting to tinycorelinux.net|89.22.99.37|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11161928 (11M) [text/plain]
Saving to: '4.9.22-piCore_modules.tar.xz'
4.9.22-piCore_modules.tar.xz 100%[============================================================================================================================>] 10.64M 3.30MB/s in 3.2s
2020-10-01 22:58:46 (3.30 MB/s) - '4.9.22-piCore_modules.tar.xz' saved [11161928/11161928]
tc@E310:~/pi$ tar xf 4.9.22-piCore_modules.tar.xz
tc@E310:~/pi$ mkdir -p package/usr/local/lib/modules/4.9.22-piCore/kernel/drivers/usb
tc@E310:~/pi$ cp -a lib/modules/4.9.22-piCore/kernel/drivers/usb/gadget package/usr/local/lib/modules/4.9.22-piCore/kernel/drivers/usb
tc@E310:~/pi$ mksquashfs package gadget-4.9.22-piCore.tcz
Parallel mksquashfs: Using 2 processors
Creating 4.0 filesystem on gadget-4.9.22-piCore.tcz, block size 4096.
[============================================================================================================================================================================================================|] 186/186 100%
Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 4096
compressed data, compressed metadata, compressed fragments, no xattrs
duplicates are removed
Filesystem size 253.94 Kbytes (0.25 Mbytes)
36.96% of uncompressed filesystem size (686.99 Kbytes)
Inode table size 946 bytes (0.92 Kbytes)
44.58% of uncompressed inode table size (2122 bytes)
Directory table size 510 bytes (0.50 Kbytes)
54.60% of uncompressed directory table size (934 bytes)
Number of duplicate files found 0
Number of inodes 43
Number of files 30
Number of fragments 0
Number of symbolic links 0
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 13
Number of ids (unique uids + gids) 2
Number of uids 1
tc (1001)
Number of gids 1
staff (50)
tc@E310:~/pi$
Copy gadget-4.9.22-piCore.tcz to your tce directory. Then:
tce-load -i gadget-4.9.22-piCore
sudo modprobe g_ether
Check if your modules are loaded:
lsmod
-
Thanks,
I will give it a try, but right now I am "extreme apartment hunting"; I really did not have the time to clog the tinycore/picore pages with my meager experiments; but I did anyway. And now I am paying for it (in stress levels and worry). I'll see you, here, in a week or two when I, like a cat, land on my feet! Maybe I'll have a gadget extension and/or configured-and-rebuilt kernel by then? Maybe I will have some greater grasp of what I am doing, then.
Thanks again for the specific advice / code.
-
Old link, but I am going to try to absorb two or three chapter tonight.
https://linux.die.net/lkmpg/index.html
this part looks good.
https://linux.die.net/lkmpg/x44.html
-
Hi ladnar
Unless you are planning on learning how to program in C and writing your own kernel modules, I don't think that guide will be
of much help to you.
The instructions listed in reply #50 should take well under 5 minutes. The most time consuming step is the download time
of 4.9.22-piCore_modules.tar.xz. The tce-load step will even run depmod for you since it checks if extensions contain
kernel modules. If you are satisfied it loaded the 5 modules you mentioned in reply #48 loaded, you can:
1. Add gadget-4.9.22-piCore.tcz to your /etc/sysconfig/tcedir/onboot.lst file so the extension gets loaded when you boot.
2. Add modprobe g_ether.ko to your /opt/bootlocal.sh file so the module and its dependencies get loaded when you boot.
-
Have started C, but as with most other things in life, have been separated from the book that would teach it. I think I still have the pdf somewhere? Thanks Rich. (I already know a fair amount about the process; headers, pre-compile, compile, assembly, object files, linkers, binary blobs, etc. Studied a bit of Barry Brey's textbook on x86, MASM and TASM, circa 2001; and Rodnay Zaks 6502 early 1980s book; and Ritchie and Kernighans "C" classic textbook. tarted to read Two Tennenbaum books, one on distributed systems, the other one was the one Torvalds read before he wrote Linux. Also had nice book on Binary dissasembly; I forget the author? A recent book from stach press, out of Frisco? But you're right. I can't know everything, at least not ALL AT ONCE. So "C" might have to wait You be happy to see, below, that I have maybe figured out my problem --besides my exuberance outstripping my talent. I think the latter caught up to the former, finally.)
First things first. I looked at my old posts (under "doctor anonymous" handle ) and realized, I already half-solved this problem, about 9 months ago! But I was moving apartments then, too, and so I had lost track of my progress. The good doctor was working with usbboot, and got it half-functional.
Now, I think I have figured out this modprobe stuff, and I think I know why it was working with Raspbian and not with piCore. Its the persistence thing. I guess "persistence" is not the thing I need, per se. (A GOOD shell script FIRST, then persistence of that script.).
I tried putting the following thing into onboot.lst ; It will go there, but its useless ! "sudo modprobe g_ether". But the simple shell scripts I made, also placed in my onboot.lst , for "Meyer's Strong AI Standard Directories" (MSSAID), execute fine. So, something like that is needed here. I think I can probably solve user/member bot's problem too, with "serial" mode. (for the moment, please ignore the impertinence of a biologist walking in and telling the experts that LSB/FHS has to be changed (to include MMSAID). I know LSB has a history, but its also come a long way, and has much further to go!)
I don't have time today to look into serial, but will write g_ether script and post it here (if my idea works). Also, depmod -a stymied me a few time, because the chmod permissions for modules.dep are 755 ; I was going to chmod it to 777, and then back again, but then I remembered just to sudo it.
That link ( https://linux.die.net/lkmpg/x44.html (https://linux.die.net/lkmpg/x44.html) ) helped alot to explain modules, and another page I stumbled on with some good example on how to actually use, lsmod, modprobe, depmod, and modules.dep . It wasn't rocket science, and I think a clutter and junk in my brain just reached critical mass.
It was also important to hear about the difference between insmod and modprobe, and the function of the depmode and modules.dep in making modprobe much easier and convenient than insmod.
Anyhoo, I should go write the script. It will basically just load all the modules that I have been typing in one at a time. I'll put the script in the onboot.lst and it will execute on startup (instead of the modules erasing / reverting, when I shut the power off). That's what was happening. I got all the modprobe stuff done, but then would shut it off to switch the wires around and hook it up to the master board. For whatever reason, I figured its better to turn master and slave b oard on simultaneously, so they both "negotiate the bus" at the same time. Maybe not necessary, but I considered it prudent (funny things can happen with USB and power and hubs and etc? Funny, buggy things!). But in this case, shutting off power was undoing the modules.
Also, anyone stumbling on this post who doesn't want to read the previous one hundred (20 or so) should note that I have placed five modules in the appropriate /lib/modules/4.9.22-piCore/ .../ folders, and placed the path of those folders in the /opt/.filetool,lst , and then typed the backup command. This seems to have worked for these five files.
g_ether.ko ; usb_f_rndis.ko ; u_ether.ko ; udc-core.ko and libcomposite.ko
The script will just be this, I think:
#!/bin/sh
sudo modprobe g_ether
exit
I wonder if this could be put in cmdline.txt, because raspbian has that line about "load-modules,g_ether" or whatever? Maybe that command actually works? Maybe all this time, that is all I had to do? I will try it my way first, and if that doesn't work, I will try the raspbain cmdline.txt edit.
-
OK, Rich, I realize you just gave me the right answer (two right answers! Your previous two posts!), slightly after I figured it out. Thanks again. And thanks for putting up with my slow learning curve, and the volumes I've written about it! Now I just have to peel off five minutes from my day, but I just spent that time researching and posting. time to go catch a bus. I've got other things to do. Maybe tonight.
-
Ok my script works, AFTER I boot. It lets me run the script by typed command, in CLI. Successful! But not when I put it in the onboot.lst? (I changed it to a two line script; it needed a "depmod -a" before the "modprobe g_ether". I think I even put in a "cd /" as the first line.
Must be a permissions thing? Or maybe modprobe doesn't like to execute in an "bootup" shell script? No that seems to silly to be true.
I must have forgotten something about onboot.lst ?
I am going to try the right answer (supplied by Rich, above). Make an extension? I have never done that before. I suppose I could add a desktop, now that I downloaded TC extension?
-
Hi ladnar
Ok my script works, AFTER I boot. But not when I put it in the onboot.lst? ...
That's not what onboot.lst is for. The only thing that goes into onboot.lst is which extensions you want loaded when
you boot.
-
Oh!!! I see. Rich already said. optbootlocal.sh.
Thanks again. I better slow down and read thorough, one more time. This will work tonight!
-
OK, about onboot.lst. I will learn this extension thing. And only put those there.( I read like 1/3 of the manual, two years ago. If I try again, it might make more sense.)
Maybe tonight's the night I get a desktop, too; TC.tz !
-
Hi all,
I have a problem getting mass storage mode to work. I went for putting all required kernel modules in extensions (dwc2 & gadget) and modprobing them upon boot.
As far as I can tell all dependencies are present and g_ether works perfectly fine.
However if I run:
sudo dd if=/dev/zero of=/tmp/usb.img bs=1M count=10 #Without any fs, just for testing
sudo modprobe g_mass_storage file=/tmp/usb.img stall=0
I get following error:
modprobe: can't load module g_mass_storage (kernel.tclocal(drivers/usb/gadget/legacy/g_mass_storage.ko): Invalid argument
Same with g_multi. Also with params "removable=1", "ro=0" I get above error. dmesg shows
LUN: removable file: (no medium)
no file given for LUN0
g_mass_storage 20980000.usb: failed to start g_mass_storage: -22
Any hints apreciated.
I run latest piCore release 12.0, untouched kernel on a pi zero, non W.
BR
Eric
-
Hi,
solved. Needed to put required parameters in /etc/modprobe.d/g_mass_storage.conf. Did that by:
sudo mkdir /etc/modprobe.d
echo "options g_mass_storage file=/mnt/mmcblk0p2/piusb.img removable=1 ro=0 stall=0 iSerialNumber=123456"
This is what I did to get it running on piZero with piCore12.0*:
* Extensions squashfs-tools and optionally nano need to be in place. I loaded them on demand.
* Existing wifi is an advantage - otherwise detour by card reader/pendrive
Enable dwc2 overlay
sudo mount /dev/mmcblk0p1
sudo echo dtoverlay=dwc2 >> /mnt/mmcblk0p1/config.txt #In my case the very end of the file was section [all].
sudo umount /dev/mmcblk0p1
Create module extensions and make them load at start
mkdir -p /tmp/dwc2/package/usr/local/lib/modules/5.4.51-piCore/kernel/drivers/usb
mkdir -p /tmp/gadget/package/usr/local/lib/modules/5.4.51-piCore/kernel/drivers/usb
cd /tmp
wget http://tinycorelinux.net/12.x/armv6/releases/RPi/src/kernel/modules-5.4.51-piCore.tar.xz
tar xf modules-5.4.51-piCore.tar.xz
cp -a lib/modules/5.4.51-piCore/kernel/drivers/usb/dwc2 /tmp/dwc2/package/usr/local/lib/modules/5.4.51-piCore/kernel/drivers/usb
cp -a lib/modules/5.4.51-piCore/kernel/drivers/usb/gadget /tmp/gadget/package/usr/local/lib/modules/5.4.51-piCore/kernel/drivers/usb
mksquashfs /tmp/dwc2/package/ /tmp/dwc2-5.4.51-piCore.tcz
mksquashfs /tmp/gadget/package /tmp/gadget-5.4.51-piCore.tcz
cp /tmp/dwc2-5.4.51-piCore.tcz /mnt/mmcblk0p2/tce/optional/
cp /tmp/gadget-5.4.51-piCore.tcz /mnt/mmcblk0p2/tce/optional/
chmod 664 /mnt/mmcblk0p2/tce/optional/dwc2-5.4.51-piCore.tcz
chmod 664 /mnt/mmcblk0p2/tce/optional/gadget-5.4.51-piCore.tcz
sudo echo "dwc2-5.4.51-piCore.tcz" >> /mnt/mmcblk0p2/tce/onboot.lst
sudo echo "gadget-5.4.51-piCore.tcz" >> /mnt/mmcblk0p2/tce/onboot.lst
As I understand, neither is it required to add modules.dep, nor is it needed to run depmod -a, since tinycore does that automatically when kernel modules are included in an extension.
Create container file for a quick test
sudo dd if=/dev/zero of=/mnt/mmcblk0p2/piusb.img bs=1M count=1024 #Create container of file 1GB size
Modify bootlocal.sh to load kernel modules on start (Did that with nano)
Added follwoing in "Load modules..." section, where an out-commented "/sbin/modprobe i2c-dev" used to be
/sbin/modprobe dwc2 #Load dwc2 module
sleep 5 #Make sure enumeration on host works properly
Added follwoing below for g_ether mode*
/sbin/modprobe g_ether stall=0 #Load g_ether module which will be RNDIS by default
/sbin/ifconfig usb0 192.168.100.2 up #Bring up usb0 ethernet device and assign fixed IP
Added follwoing below for g_mass_storage mode*
sudo mkdir /etc/modprobe.d #Create folder for module configs
#Create config for g_mass_storage to shair container file in read+write mode
echo "options g_mass_storage file=/mnt/mmcblk0p2/piusb.img removable=1 ro=0 stall=0 iSerialNumber=123456" > /etc/modprobe.d/g_mass_storage.conf
/sbin/modprobe g_mass_storage #Load g_mass_storage module
*Only load either g_ether or g_mass_storage.
Commit changes and reboot
filetool.sh -b
sudo reboot
-
pieric newbie puts my newbie to shame. I'll have to reasd him again to try to absorb some of it. Two months ago I found some random bits of advice on mass storage mode, but clearly not though to help. Glad he fixed it himself.
Anyway, its been two months since I flogged this particular pi horse, and I am ready to give it another try. October 4th Rich gave me the answer, but I made the mistake of trying to extend my mmcblkp02 partition, and some error got me stuck with a larger partition but a filesytem that didn't expand to fill it. At least, I think that is what the error said / meant.
I have new microSD cards, and I will just start fresh. If anybody knows why I would get that error, let me know, becuase I am about to try the "readme" advice again, on a fresh card with a fresh OS, on a pi zero.
"1) Start fdisk partitioning tool as root:
sudo fdisk -u /dev/mmcblk0
Now list partitions with 'p' command and write down the starting and
ending sectors of the second partition.
2) Delete second partition with 'd' than recreate it with 'n' command.
Use the same starting sector as deleted had and provide end
sectore or size greater than deleted had having enough free space
for Mounted Mode. When finished, exit fdisk with 'w' command. Now
partition size increased but file system size is not yet changed.
3) Reboot piCore. It is necessary to make Kernel aware of changes.
4) After reboot expand file system to the new partition boundaries with
typing the following command as root:
resize2fs /dev/mmcblk0p2
Now you are ready to use the bigger partition."
If I recall correctly, the "resize2fs" command spit an error at me. I will try again tonight, and do as Rich said in his post, to get my USB gadget working and get the modules automatically loaded on each fresh boot. Probably get TC.tcz GUI extension put on there too. And of course, my hobbyhorse of the MSSAID, artifical intelligence folders, for my raspbery pi cluster computer.
-
Hi,
solved. Needed to put required parameters in /etc/modprobe.d/g_mass_storage.conf.
...
Hi pieric,
I'm trying to replicate your steps on piCore 13.1. Most of your steps seem to have worked for me, except for loading the dwc2 module, and the ifconfig step.
when I reboot, dwc2 doesn't get loaded, and if I try to do "modprobe dwc2" myself from a command line, I get:
modprobe: can't load module dwc2 (kernel.tclocal/drivers/usb/dwc2/dwc2.ko): unknown symbol in module, or unknown parameter
I've checked, and the module is being loaded into the filesystem where it should, based on my tcz, so the os can find it. Do you know if anything has changed in this module in 13.1?
The ifconfig line is failing with
ifconfig: SIOCSIFADDR: No such device
I'm assuming this is happening because the dwc2 module isn't being loaded. Presumably, it creates the "usb0" device?
Oh, and one last thing, when I reboot with these changes, my usb keyboard that is plugged into a usb hub on the pi (wired via gpio), no longer seems to work. Is this to be expected?
I'm not quite sure where to go from here.
Thanks in advance for any help you can give me,
Chris
-
Hi creitzel
I think you may be missing:
kernel/drivers/usb/gadget/udc/udc-core.ko
What does this return:
modinfo dwc2
-
You were definitely on the right track Rich. I was just going to post that I figured out how to get the dwc2 module to load.
After I posted this, I found another post that was having the same problem with dwc2 on 13.x, and the missing module was "roles.ko", so I included that in my tcz as well, and now it seems to be loading fine. As for the "udc_core.ko", I'm pretty sure I already have that one, because I copied the entire "gadgets" sub folder into my tcz, and it is in there. I found the need for "roles.ko" using your "modinfo dwc2" command. :)
So, now it appears to load the modules correctly on boot, and it creates the usb0 device, and the ifconfig statement works to assign the ip, and bring the interface up.
Now I'm stuck where I can't seem to ping it or ssh into it, from my windows 10 machine. I've tried scanning for new hardware on the Win10 box, but that doesn't seem to do anything. Do I have to somehow point ssh to the usb ip or something? Although, the fact that ping doesn't work either, is kinda telling me that the problem may be on the Win10 side.
Sorry, for my lack of knowledge, I'm fairly new to this part of linux/piCore.
Thanks for any help you can give in advance,
Chris
-
Hi creitzel
I think the way to connect to the pi remotely goes something like:
ssh tc@aaa.bbb.ccc.ddd
where aaa.bbb.ccc.ddd is the IP address of your pi.
-
yeah, that would be the way I would ssh from a command line in win10. I also have putty installed, which allows ssh connections as well.
The problem I have right now, is the win10 box doesn't seem to recognize the fixed ip that I gave to the pi, it just keeps timing out whenever I try to access it.
I think I'll give it a go from my linux laptop, and see if that can recognize it.
Thanks for all you help, it's much appreciated.
-
Hi creitzel
Are both machines on the same subnet? i.e. Are they both 192.168.1.xxx or 10.10.1.xxx.
-
Just for completeness, I've tried both with it on my subnet, and with it on a different subnet. Either way, if I try to ping to the ip that I've assigned to it, it times out, like it would if there was no machine at that ip.
It is also connecting via wifi on my lan's subnet, which is currently how I'm able to work on it, because once I enabled dwc2, my usb hub HAT that is connected via the gpio pins has stopped working, so my usb keyboard isn't working right now.
I also now have tried it with my linux laptop, with the same results. i.e. ping times out when I try to ping the ip assigned to the pi.
I'm not sure what else to check on the win10/linux box side. There must be something I'm still missing on the pi side.
-
Hi creitzel
... It is also connecting via wifi on my lan's subnet, ...
Is the other machine also connected to the same wifi router?
-
Yes, my win10 box is connected via ethernet cable to the router, and my linux laptop is connected via wifi to the same router. I don't know if the problem is being caused by that though, I've had the win10 box connected to the network (via the same router) both through ethernet cable, and a wifi dongle at the same time before, and it just gets 2 different ip addresses, one for the cable, and one for the wifi connection.
The interesting thing I noticed last night, when I tried using the pi plugged in to usb on my linux laptop, is it doesn't seem to show up at all when I try doing a "lsusb" at the command prompt. This makes me think that something must be missing in the pi's configuration. Every other network/usb type device I've ever used would at least show up in that list, whether I was having issues with it's configuration or not. This is consistent with how it is behaving on the win10 box too, the usb device doesn't show up in device manager at all.
-
You know what? I just thought of something. I just grabbed a random cable out of my box o' cables when I started playing around with the pi this time. I bet it's a charging only cable, which would totally explain why the host computers aren't seeing any device when I plug it in. I'll check this first thing when I get home this evening, after work.
-
Ok, so I did in fact have just a charging cable, and not a data cable. That was why it wasn't showing up in Windows at all. I've now switched to a data cable, and now I've got to figure out how to get windows to use it's internal RDNIS driver for the pi. It currently sees it as an unknown usb device.
Thanks again for all your help Rich.
-
Ok, so does anyone have any idea where the device descriptor for g_ether is on the pi 0?
Now that I have a data cable, when I plug it into a Win10 box, it reports it as an undknown usb device, specifically stating that it couldn't get a device descriptor. When I plug it into my ubuntu laptop, it gets reported as a usb hub. This is definitely pointing towards the pi 0 misreporting it's device descriptor to the hosts.
Again, any help would be appreciated. :)
Thanks in advance,
Chris
-
Alright, I guess I'm done with this experiment. I can't figure out how to change the device descriptor on the pi (in fact I haven't seen anything that looks like its even doable).
Win10 is now recognizing the device as a generic usb hub, still reporting the device descriptor error, and Ubuntu reports it as a usb hub as well.
Based on the fact that there are several write-ups where people have claimed to get this working, my guess is that the current versions of Ubuntu, and Win10 have changed how they query devices, and that the g_ether code isn't up to date with those changes.
I guess I'll go back to trying to get ssh working via bluetooth.
-
Hi creitzel
Did you load the g_ether.ko driver:
modprobe g_ether
Have you looked at this:
https://www.olimex.com/forum/index.php?topic=8239.0
-
Hi Rich,
yes I loaded the g_ether module. I included a line in bootlocal.sh which did that modprobe statement. Everything looks great on the pi-zero side, no errors, and I can verify that the dwc2 and g_ether modules are loaded using lsmod.
The problem is when I connect the usb to a host computer, both Win10, and Ubuntu Mate 22.04 are identifying the pi as a "generic usb hub", rather than an RNDIS Ethernet device. This appears to be a common problem from what I've read on the internet, and the solution posted in all of those threads is to just force windows to load the proper driver for the device.
That said, Win10 no longer allows you to do this. I have been trying all night to get Win10 to allow me to install the RNDIS driver, and it just won't allow it. It looks like maybe they've beefed up security or something, to disallow it.
I don't know that there is much more I can do with it. It appears to me that the g_ether module, and the gadget framework might be out of date with what the newer versions of the OS's are doing to query device descriptors or something.
-
Is it worth trying usb modeswitch?
-
Hi creitzel
This link looks kind of interesting:
https://wiki.t-firefly.com/en/Firefly-Linux-Guide/demo_usb_ethernet.html
This section mentions load order of the modules is important:
https://wiki.t-firefly.com/en/Firefly-Linux-Guide/demo_usb_ethernet.html#kernel-settings
This section also appears to be relevant:
https://wiki.t-firefly.com/en/Firefly-Linux-Guide/demo_usb_ethernet.html#network-sharing-to-realize-pc-internet-access
To check net.ipv4.ip_forward execute this:
tc@E310:~$ sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 0
tc@E310:~$
To enable it, execute this:
tc@E310:~$ sudo sysctl net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1
tc@E310:~$
-
Is it worth trying usb modeswitch?
Juanito, I'm not sure that util is available for windows. Usually it's the windows device manager that you use to assign drivers to usb devices.
Hi creitzel
This link looks kind of interesting:...
Rich, I read through that article, and it seems to cover the same things that the articles I've been finding cover. Things I've already tried. The order thing seems to be out of my control as well, as I'm just loading the g_ether.ko module, and it appears to be loading the others, in whatever order it thinks is appropriate.
One thing I just discovered about the device from the windows side is that it is declaring itself to be a vendor id of 1a40 and a product id of 0101. When I google for this vendor/product pair, it comes back with a Terminus Technology Inc. USB Hub, which is why windows and linux are trying to install hub drivers for it, I think.
Do either of you know if I can change the Vendor Id and/or Product Id, somewhere in the configuration files of piCore? Maybe through parameters to the g_ether module? I think if I can get the pi to report a vendor id/product id for an RNDIS network device, windows should load the appropriate driver, and I might be in business.
Thanks again for sticking it out with me, and answering questions. Much appreciated! :)
-
Ok, so it looks like, from what I've read, that if I use
sudo insmod /{path to g_ether}/g_ether.ko idVendor=0000 idProduct=0000
where the 0000's are replaced with appropriate values, and the path is the correct path, that I should be able to start g_ether with parameters for the vendor and product id. That said, I've tried it every different way from sunday that I can think of, and I just keep getting
insmod: can't insert '/usr/local/lib/modules/5.10.77-piCore/kernel/drivers/usb/gadget/legacy/g_ether.ko': unknown symbol in module, or unknown parameter
am I doing this wrong?
Also, I came across an article on the linux gadget system in general, and it appears that you can mount a config filesystem to pass parameters into the gadget kernel layer. I haven't tried this one yet, because it looks like you have to completely define the gadget, and I don't know what the default config is for g_ether.
so, no luck so far at changing the vendor and product id's. :(
-
Hi creitzel
What happens if you try it like this:
sudo modprobe libcomposite.ko
sudo modprobe u_ether.ko
sudo modprobe usb_f_ecm_subset.ko
sudo modprobe usb_f_rndis.ko
sudo modprobe usb_f_ecm.ko
sudo modprobe usb_f_eem.ko
sudo modprobe g_ether.ko idVendor=0000 idProduct=0000
-
Hi creitzel
What happens if you try it like this: ...
Hi Rich. I didn't know you could pass module params through modprobe. When I read the help for it, it didn't look like it accepted them. That is why I was trying to use insmod.
But, I tried this, and it appears that there's no difference. By that, I mean that the pi appears to load everything fine, with no errors in dmesg. I don't know of a way to see if if actually took the idVendor and idProduct parameters, but it didn't complain about them. And then on the Win10 box, it's still reporting an unknown usb device/usb hub, with VendorID= 1a40 and ProductID= 0101. So, if it did in fact take the parameters, it seems to be ignoring them/not using them.
From everything I've read, this seems to work for a lot of people, and none of them seem to be having the same trouble I am. Maybe I'm barking up the wrong tree here. Maybe there's just some simple step I've missed or something. Although, I've been through this a bunch of times, and I'm not seeing it lol.
-
Ok, I think I now understand why it was reporting a usb hub to the win10 box. I have a little usb hub that connects to the pi zero, and it's been a while since I actually installed it, and I thought that it was connected via the gpio, but it's not. It actually mounts like a HAT, but it has little plunger connectors that actually connect right to the zero's usb connector (there's 2 little contacts right by the connector that it connects to).
Anyway, I basically threw a dart, and said, I wonder if this would work if I took the hub off the zero. So, I uninstalled the hub, and tried again, and poof now it's not reporting a hub to the win10 box anymore. It briefly reported an RNDIS/Ethernet gadget (which is obviously what I want), but then quickly changed it to a serial port. So now I'm at the point, where it is creating a new COM port (COM3), which doesn't actually work, because I'm running g_ether, and not g_serial. lol. Anyways, it's progress I guess. Now to figure out how to make it stop switching to a usb serial device.
-
With usb modeswitch on the RPi?
-
With usb modeswitch on the RPi?
I think I see what is going on now. Windows has changed it's usb detection code, and there is more needed on the pi side now. Several people have encountered the problem of g_ether being misidentified as a serial device. Here's a link that describes the problem
https://answers.microsoft.com/en-us/windows/forum/all/windows-10-vs-remote-ndis-ethernet-usbgadget-not/cb30520a-753c-4219-b908-ad3d45590447
one of the answers on there led to a script file using the configfs that supposedly handles this problem (see the comment by dlech). I adapted the script file for piCore, and it did indeed make Windows see the device as an RNDIS device, the first couple of times I plugged it in. Then it went back to recognizing it as a serial device, and at one point actually killed the wifi support on the pi, so I had to go back to using an HDMI/Keyboard setup to access it again.
I think I've had enough fun with this approach. Ultimately, all I'm looking for is an easy way (other than wifi) to access the pi via ssh. I think I'll switch back over to my bluetooth investigations, and see if I can't get something going there. I'd actually prefer to use bluetooth if I can, because when the project is done, I don't want to have to disasseble the case to get access to the usb port on the pi.
-
BT is a huge stack too, with lots that can go wrong. If I may suggest changing the hw, get a regular Pi that has an ethernet port too, would be the simplest solution.
-
BT is a huge stack too, with lots that can go wrong. If I may suggest changing the hw, get a regular Pi that has an ethernet port too, would be the simplest solution.
Yeah, I'm familiar with regular pi's too, I've had a few pi zeros, a few pi 3's and even have a pi 4. I got the pi zero for this project, specifically for it's size.
It's not really a big deal if I can't get some kind of SSH/maintenance interface going through usb/bluetooth. I've done a couple of projects with pi zero's already, but it would just be a nicety for me, if I didn't have to pull the pi out and hook it up to HDMI/keyboard to work on it. On the projects I've already done, I just keep 2 different sets of wifi settings on the zero, one which brings up the AP and allows users to connect, and one that disables the AP and connects to my home wifi, so that I only have to boot it once with HDMI/Keyboard, switch to the settings for my home network, and then I can ssh into it.
Also, it was a chance to explore and learn a bit more about pi's, as I've never done anything with the usb gadget interface or bluetooth before now. :)