Accessing Linux /dev/USB as standard files to communicate with USB device

I'm researching ways to communicate with a USB device in Linux and would prefer to not write a Linux Kernel driver. I understand that libusb exists and is a user-land library that would work, but our embedded device doesn't support usbfs ( and would be really a pain to change kernels to add the support ).

So my question is basically this: Is it possible / advisable to communicate with a USB device by directly reading and writing to the /dev/USB or the udev file corresponding to the USB device thus bypassing the need for a custom Linux Driver and usbfs?

I'm hoping it's possible to communicate using the USB devices protocol just by reading / writing protocol packets directly through file-type read/write commands once the /dev/USB or udev device file is open.

Thoughts and suggestions please.

FOLLOW UP:

Since the USB device I needed to talk to is a USB HID class device, I was able to use libudev and the standard Linux USB HID RAW driver by reading / writing directly to /dev/hidraw0 ( or the appropriate /dev/hidraw device ). It wasn't necessary to write a custom driver for a simple USB HID device.


Jim, I don't think you can escape the need to write a driver and just manage to read the USB file in /dev . Because who defines as to what should happen when you do a read() on the USB device file? And who defines what action should be initiated when you invoke sysioctl() ? Your driver! In other words, the device files are themselves incapable of anything until they are supported by the underlying drivers. In fact, you can treat the device files to be an abstraction of the underlying driver! So, no driver, no use of device file :(

I suggest you go through the following articles about how to write a driver and also understand the USB internals-

  • http://www.linux-usb.org/USB-guide/c15.html

  • http://www.linuxjournal.com/article/4786 ( Slightly outdated )

  • 链接地址: http://www.djcxy.com/p/57996.html

    上一篇: 语言HTML5应用程序

    下一篇: 访问Linux / dev / USB作为与USB设备通信的标准文件