Skip to content

How do I know my idVendor and idProduct on FreeBSD 9 ?

I did not find any easy solution. I have a Huawei E173s and it seems that such modem is not working right at the moment. However, to find out which modem I have, I wrote a C code to help me. Please, if you have a better way, Tell me.

Update:
Yes, there is: usbconfig dump_device_desc

libusb is not well documented :(

1) Code

#include <stdio.h>
#include <libusb.h>

int main(int argc, char** argv)
{
int ret;
libusb_context *ctx;
libusb_device **dev_list = NULL;
libusb_device_descriptor desc;
ssize_t dev_list_size = -1;
ssize_t index;

ret = libusb_init(&ctx);
if ( ret != 0 )
{
printf("Library usb not loaded: %s \n", libusb_error_name(ret));
return 1;
}

dev_list_size = libusb_get_device_list(ctx, &dev_list);
if ( dev_list_size < 0 )
{
printf("No USB found...\n");
return 1;
}

//main rotine change here if you wanna
//see other USB info
for ( index=0; index < dev_list_size; index++ )
{
libusb_get_device_descriptor(dev_list[index], &desc);
printf("idVendor: %#x idProduct: %#x bcdUSB %#x \n",
desc.idVendor, desc.idProduct, desc.bcdUSB);
}

printf("done...\n");
libusb_exit(ctx);
return 0;
}

I got a big help from http://www.dreamincode.net/forums/topic/148707-introduction-to-using-libusb-10/
Please, read [1,2] for additional USB behavior and programming.

2) Compiling

gcc printusbinfo.c -lusb -Wall -o printusbinfo

3) Running

$ ./printusbinfo
idVendor: 0 idProduct: 0 bcdUSB 0x200
idVendor: 0 idProduct: 0 bcdUSB 0x200
idVendor: 0x8087 idProduct: 0x24 bcdUSB 0x200
idVendor: 0x8087 idProduct: 0x24 bcdUSB 0x200
idVendor: 0x4f2 idProduct: 0xb290 bcdUSB 0x200
idVendor: 0x489 idProduct: 0xe027 bcdUSB 0x110
idVendor: 0x12d1 idProduct: 0x1c05 bcdUSB 0x200
done...

Run this code before and after you plug in your USB 3g Modem. My case, the last line is my USB code.

It seems that FreeBSD does not handle it: http://doc.pfsense.org/index.php/Known_Working_3G-4G_Modems

1 – http://libusb.sourceforge.net/api-1.0/group__dev.html#gac0fe4b65914c5ed036e6cbec61cb0b97
2 – http://www.beyondlogic.org/usbnutshell/usb5.shtml

Comments are closed.