USB communication on FreeBSD
USB communication on FreeBSD
I wrote a program in C that communicates with my MikroMMB for PIC18FJ board over USB (standard HID device). It works without a problem on Linux (Ubuntu 10.10) by reading and writing to /dev/hidrawX device. But I need it to work on FreeBSD (version 8.1) as well. Unfortunately, there I can only read from /dev/uhidX but can not write to the same device (nothing comes to the board). I have tried several methods but nothing seems to work and Google in not much of a help either. Does anyone have any experience with USB communication on FreeBSD? A working example would be ideal.
Re: USB communication on FreeBSD
Finally I figured it out. I'm posting my solution here if someone will need something similar someday.
FreeBSD in addition to /dev/uhidY device also creates two devices in /dev/usb/, namely /dev/usb/X.X.0 and /dev/usb/X.X.1. First one is for reading and second one for writing data to the USB device. By looking at the output of dmesg, one may notice that the USB device is recognized as uhidY and also ugenX.X. The later gives you a hint which /dev/usb/X.X.* device you should look at.
FreeBSD in addition to /dev/uhidY device also creates two devices in /dev/usb/, namely /dev/usb/X.X.0 and /dev/usb/X.X.1. First one is for reading and second one for writing data to the USB device. By looking at the output of dmesg, one may notice that the USB device is recognized as uhidY and also ugenX.X. The later gives you a hint which /dev/usb/X.X.* device you should look at.