Usbconfig equivalent in Haiku

I am trying to configure my ethernet controller to run in usb-ecm mode and I believe this is done via usbconfig in linux and in freebsd
something like:
usbconfig -d <X.Y USB device address> set_mode <0 or 1>

how do we do this in Haiku?

Thanks

I’m fairly sure you need a usb device driver for this

My memory for absolutely useless things remembered that this was discussed on the mailing list. I thought “recently”, but its actually from 2011!

Phillipe Houdoin wrote:
“When devices allow several kind of USB connectivity, like USB mass
storage and modem, in particular when they use the gadget framework to
achieve that, the current interface needs to be switched into using
this or that mode, and we do have a driver for that, located under
src/add-ons/kernel/drivers/common/usb_modeswitch.cpp (I dunno if it’s
in the default image yet, though).”

It looks like the device ID needs to be added to it, there’s been a few changes over the years

1 Like

Its an experiment, the RT8153(ethernet adapter on Surface hub) can work as a device based on the driver, or in USB_ECM mode, it has 2 modes.
I can’t get ethernet to work so I just want to make sure it is in the right mode for USB_ECM which would be the 2nd mode, default mode is ethernet driver.

it doesn’t appear to be in the default image.
What would be the command to query the configuration of the USB device?
Listusb -v doesn’t show which one is selected on the device, it gives me the same as linux does.
drivers loaded list usb_ecm, but unless the RT8153 is in the 2nd mode, it won’t work as a USB_ECM modem.

My reading of that message and brief reading of the code (not that I’m in any way experienced here) is that the IDs will need to be added to that driver. Create a ticket?

Thanks, I will add the ID’s and test locally

isn’t USB-ECM the default mode? It is the only possibly supported configuration of this device.

So the default mode of the device in windows is mode 0 - ethernet device, the 2nd mode is mode 1, usb-ecm device.
I don’t know how to query the device for the mode it is running on.
I just build a nightly image to test the usb_modeswitch.
But hit new issues:
The direct write of the image to the SSD method brings up an installer that asks for another partition.
The etcher method to write to a USB drive give me a blank screen after boot(which is better than the last stable release that did not support USB 3 and froze on boot with a kernel panic)
Not to mention now the screen is tripled, so I got 3 times the same graphics output on my screen, either that or I have been hitting the schnapps badly…

Just choose live boot, it will work the same, there is no functional difference between the installed system and the medium apart from forstbootprompt running on the first boot and the tiny partition size

I would recommend to submit a bug report with the output of “listusb -v” to give enough information. usb_ecm should itself be able to pick up the device.

So usb_modeswitch is present in two places:
Tried live mode in the SSD installation:

/boot/systems/add-ons/kernel/drivers/bin/usb_modeswitch
/boot/systems/add-ons/kernel/drivers/dev/usb_modeswitch

“but it says cannot execute binary file: not an executable”
can’t chmod as it is a read only filesystem as it is the live cd so will try the raw file in the USB partition and install to HDD, the ISO method is not working in the USB.
And still have the triple screen.
It just sucks that I am stuck at such a basic level, which is a problem for adherence to Haiku. Happy to help sort out these kinks, but the documentation is not really particularly helpful.
We need more Wiki style things like Arch has so people can post tutorials.

usb_modeswitch is a kernel driver, not an executable.

Alright, but that’s a funny one since in linux it’s an application, easier to play with

[Device /dev/bus/usb/0/1/1]
Class … 0x00 (Per-interface classes)
Subclass … 0x00
Protocol … 0x00
Max Endpoint 0 Packet … 64
USB Version … 2.16
Vendor ID … 0x045e (Microsoft Corp.)
Product ID … 0x07c6 (RTL8153 GigE [Surface Ethernet Adapter])
Product Version … 0x3000
Manufacturer String … “Microsoft”
Product String … “Surface Dock GigE”
Serial Number … “000001000000”
[Configuration 0]
Configuration String . “”
[Interface 0]
[Alternate 0 active]
Class … 0xff (Vendor specific)
Subclass … 0xff
Protocol … 0x00
Interface String … “”
[Endpoint 0]
MaxPacketSize … 512
Interval … 0
Type … Bulk
Direction … Input
[Endpoint 1]
MaxPacketSize … 512
Interval … 0
Type … Bulk
Direction … Output
[Endpoint 2]
MaxPacketSize … 2
Interval … 8
Type … Interrupt
Direction … Input
[Configuration 1]
Configuration String . “”
[Interface 0]
[Alternate 0 active]
Class … 0x02 (Communication)
Subclass … 0x06
Protocol … 0x00
Interface String … “CDC Communications Control”
[Endpoint 0]
MaxPacketSize … 16
Interval … 8
Type … Interrupt
Direction … Input
[Descriptor 0]
Type … 0x24
Data … 00 10 01
[Descriptor 1]
Type … 0x24
Data … 06 00 01
[Descriptor 2]
Type … 0x24
Data … 0f 03 00 00 00 00 ea 05 00 00 00
[Interface 1]
[Alternate 0]
Class … 0x0a (CDC-Data)
Subclass … 0x00
Protocol … 0x00
Interface String … “”
[Alternate 1 active]
Class … 0x0a (CDC-Data)
Subclass … 0x00
Protocol … 0x00
Interface String … “Ethernet Data”
[Endpoint 0]
MaxPacketSize … 512
Interval … 0
Type … Bulk
Direction … Input
[Endpoint 1]
MaxPacketSize … 512
Interval … 0
Type … Bulk
Direction … Output

Supported by https://github.com/torvalds/linux/blob/master/drivers/net/usb/cdc_ether.c#L839
This means one could add the ID in usb-ecm.

EDIT: actually it is blacklisted in the linux driver. See https://github.com/torvalds/linux/commit/d5b07ccc1bf5fd2ccc6bf9da5677fc448a972e32

I am will try that now, unsure whether I need to send a message, but that will be step two.

Please read the user guide and FAQ.

No luck after adding Microsoft codes for the RT8153:

#define MICROSOFT_VENDOR 0x045e
{{ 0, 0, 0, MICROSOFT_VENDOR, 0x07c6}, MSG_MICROSOFT},

And message(this is from the android tabled that uses the 8153):
{
0x55, 0x53, 0x42, 0x43, 0x08, 0x60, 0xd9, 0xa9,
0xc0, 0x00, 0x00, 0x00, 0x80, 0x00, 0x06, 0xe0,
0X00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}

Will attempt this in Fedora.
Also I am getting:
invalid ioctl 8295.
Is there a utility to dump ioctl codes?
Or a post build map?

Either that or just get it running as 8152 as Linux does, seems better than what I am trying to do with USB_ECM