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.

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);

return 0;

I got a big help from
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

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:

1 –
2 –

Comments are closed.