Randomized MAC address when using USB OTG networking


ssokolow

Member
Joined
May 24, 2012
Messages
245
Location
Ontario, Canada
I've been trying to get the USB OTG networking to Just Work™ but I've run into a problem I don't known how to diagnose:

  1. The MAC address seen by the host PC doesn't match the the address these commands agree on:
    • ifconfig
    • cat /sys/class/net/usb0/address
    • udevadm info -a -p /sys/class/net/usb0 | grep address
[*]Both MAC addresses seem to change to a new random value every time I restart the Pandora or switch into and back out of SD-Mass Storage mode.


This means that nearly every time I connect my Pandora to my desktop, I have to type my password to elevate privilieges, delete a new connection that pops up in the network manager, and then edit the configured "Pandora USB" preset to match the new MAC address.


It also means that I won't be able to trigger dhclient on connection because the DHCP server isn't available at the moment the cable gets plugged in.


Any suggestions? I'm still running the SuperZaxxon Beta 1.1 that came preinstalled on my Pandora because, so far, everything major I've tried has Just Worked™ and I'm too scared that, if I upgrade, one of the newer versions will introduce a regression.
 
Thats behaviour I have also seen on the caanoo.


Seems to be common for those devices but I have no clue why.
 
I have a way to fix the randomisation.

After establishing the connection the first time,  check and note down the MAC addresses on both the pandora and the host.

Then edit /etc/default/usb-gadget (you'll need to use sudo)

Change the line which reads:


MODULE_OPTIONS=""


to:


MODULE_OPTIONS="dev_addr=xx:xx:xx:xx:xx:xx host_addr=yy:yy:yy:yy:yy:yy"


Replacing the xx and yy place holders with (respectively) the device and host MAC addresses you noted down earlier.

Next time you reboot the gadget driver will use those addresses instead of randomly choosing new ones.

- Neelix
 
Last edited by a moderator:
Sorry for the delayed response. About a month ago, GMail started directing all forum notifications to the spam box "because they look spammy" and I only noticed now.

As for your advice, that makes sense but it seems that running SuperZaxxon 1.5 Final (off an SD card) has broken the USB OTG networking altogether. The network manager doesn't see it and I can't find anything that looks like a toggle for it aside from "enable USB host" which is already disabled.
 
OTG networking should be in settings->startup->services (or something like that).
Point. I'm not sure why I didn't think to check it.

(Either I'd forgotten that the service manager contains things which shouldn't affect battery consumption or I assumed it would affect battery consumption and, therefore, must be left off when not in use)

Anyway, I can't test it right now because I was stupid enough to use the internal OS updater and now my keyboard seems to be interpreting every second keypress as if I'm holding down Ctrl. (At least, that's the best I can conclude based on how the second press of A behaves like Ctrl+A)
 
Are you sure your Select/Ctrl button isn't actually stuck? That occasionally happens to me. Maybe try tapping it a few times?   (The right shoulder button is another candiate but unless the switch is broken that seems less likely...)

- Neelix
 
You mean the "upgrade pandora OS" thing? That's supposed to work right..
Well, I ran it, the network manager applet died part-way through due to "missing resources" and, when the process finally completed and I rebooted, the network manager was back... but my keyboard was misbehaving.

Are you sure your Select/Ctrl button isn't actually stuck? That occasionally happens to me. Maybe try tapping it a few times?   (The right shoulder button is another candiate but unless the switch is broken that seems less likely...)

- Neelix
Doesn't seem to be... though, whatever is going on, I just noticed that the left shoulder is behaving sort of like Caps Lock. There is a crack in the case running from the right shoulder button to the nearest battery door clip, but I've been treating this thing like it's made of glass (I saved for years to get it) so I can only assume it's like the hairline crack in the screen hinge... proof that the plastic on Rebirth Edition Pandoras is utter crap. (If it becomes a problem, I guess I'll disassemble my Pandora and break out the super glue)

Anyway, since I normally run my OS off the left SD card (I don't trust the longevity of non-replaceable flash), I just popped it out and confirmed that it IS a software problem. The copy of SuperZaxxon Beta 1.1 that came with the thing and still occupies the NAND is unaffected. (On the plus side, since it affected the keyboard, maybe the update will make Bluetooth keyboards work if I get it installed properly.)

I'll need a day or two to clear enough space on my desktop's /home to backup that SD card before reinstalling the OS and I'll want to diff against the copies of all the PNDs and other bits I keep on /srv (I've had too many corrupted MP3s on other devices for me to trust the authoritative copies of my files to any kind of flash memory... especially when my desktop's dosfsck has occasionally said iffy things about every flash-backed filesystem I've ever owned... Pandora SD cards included) so it may take up to a week to fit it all in among other demands life places on me.

I just wish the Pandora used UTF-8 for its filenames. Then I could stick the SD card in my desktop's card reader rather than running rsync off the NAND without worrying about corrupting any non-ASCII characters in filenames. (eg. "Sinéad O'Connor")
 
Last edited by a moderator:
OK, I finally found time to get my Pandora reinstalled (and my folding Bluetooth Keyboard works with the March 28th firmware release. Yay!) and setting the host-side MAC address does seem to be working.

Unfortunately, I haven't been able to set the device-side MAC address yet because, even with USB networking enabled on boot in the startup controls, the USB NIC doesn't appear in ifconfig or the network manager applet.

Other suggestions?
 
usb0 will show up on the Pandora after either of the following commands:

sudo ifconfig usb0 up
sudo dhclient usb0


Also I found a better way to specify  the device and host addresses.

Leave the MODULE_OPTIONS assignment in /etc/default/usb-gadget blank and instead add the following line to /etc/modprobe.conf

options g_cdc dev_addr=xx:xx:xx:xx:xx:xx host_addr=yy:yy:yy:yy:yy:yy


This has the advantage of persisting after coming out of suspend, and after using mass storage mode.

- Neelix 
 
usb0 will show up on the Pandora after either of the following commands:

sudo ifconfig usb0 upsudo dhclient usb0
In other words, it's a regression. I know that, with the SuperZaxxon beta that came with my unit, I didn't have to switch from the touchpad to the keyboard to get the link up.
Also I found a better way to specify the device and host addresses.
Thanks.
 
Last edited by a moderator:
In other words, it's a regression. I know that, with the SuperZaxxon beta that came with my unit, I didn't have to switch from the touchpad to the keyboard to get the link up.
I couldn't speak to that. I only fairly recently started using USBnet. I do however have another unit that's still running SZ beta 5a, and I just confirmed that it has the same issue on both versions of the kernel. That being that on the pandora end usb0 doesn't show up until activated and neither does it show up in Network manager at all. (whereas on the host end the interface appears immediately upon connection of the USB cable)


Do you know which beta you were running at the time?


- Neelix

EDIT:  I just spotted something interesting though...  a console message from modem-manager:


modem-manager: (net/usb0): port's parent platform driver is not whitelisteded
It might give a clue as to how to fix the issue...   I'll do some more research.

P.S. Yes it really says "whitelisteded"!

EDIT2:  Actually this seems to be less useful than I initially thought... modem-manager wouldn't have any reason to interact with it anyway...
 
Last edited by a moderator:
In other words, it's a regression. I know that, with the SuperZaxxon beta that came with my unit, I didn't have to switch from the touchpad to the keyboard to get the link up.
I couldn't speak to that. I only fairly recently started using USBnet. I do however have another unit that's still running SZ beta 5a, and I just confirmed that it has the same issue on both versions of the kernel. That being that on the pandora end usb0 doesn't show up until activated and neither does it show up in Network manager at all. (whereas on the host end the interface appears immediately upon connection of the USB cable)

Do you know which beta you were running at the time?
It's still on my NAND. (Autobooting my OS off the left-hand SD makes backups and reinstalls easier and gives me the option of recovering from worn-out flash memory) It's SuperZaxxon Beta 1.1.


I don't remember specifically what I used to do to get it to request an IP without dropping to terminal, but one difference between the current version and the copy of Beta 1.1 on my NAND is that, with Beta 1.1, usb0 appears in ifconfig without having to be manually brought up.


Anyway, I suppose what I need to do now is figure out how to detect that the cable has been plugged in and run "dhclient usb0" automatically.


EDIT: It probably had something to do with getting the "Edit" button in the "Network Connections" dialog un-disabled for the "ifupdown (usb0)" entry that appears on Beta 1.1 but not the current version so I could then ask the network manager to handle running dhclient on cable detect. The inability to present a stable MAC address to the desktop so it knows to proxy DHCP-related traffic immediately on connect was one of the reasons I opened this thread.
 
Last edited by a moderator:
Back
Top