Hot answers tagged

17

The USB documentation is pretty terrible. It suffers from excessive genericization, where they're trying to make everything so generic and general that it's hard to get from the docs to any specific application. The descriptor format is located in the document called "Device Class Definition for HID" at the link to usb.org you provide. The critical thing ...


9

While I'm not going to guess what every field is, your barcode scanner is emulating a USB HID keyboard. Each line with non-zero fields indicates a key-press, and all zeros indicates no key presses. The third field is the USB HID key code. See this link from the USB group, starting with page 53. Note that the USB HID codes do not align with ASCII or other ...


7

You need to change few others things to make it work as a gamepad. In usbd_hid_core.c you need to change : 0x02, //nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse to the 0x00 value. Other thing, the report descriptor has to be changed, this is mine for a 3-buttons 2-axis gamepad, (you can change it to add button or anything else with the HIDtool)...


6

After some hours of poking around in debugfs and the kernel sources, I figured it out. As it turns out the descriptor was fine, the problem was that udev (for whatever reason) decided the create the device file with root-only access. After fixing this, my device now appears as a 56-button 8-axis gamepad, which is not quite what I wanted, but still close ...


5

I think it will vary by manufacturer. There is a serial number field, but many don't fill it in. USBDeview is a free app that will let you peek at all the fields for all the installed devices (http://www.nirsoft.net/utils/usb_devices_view.html). A screen capture for an HID device on my system is attached below. Install it (actually, no need to even unzip, ...


5

If memory serves me right, the RN42 only allows you to use their defined HID descriptors. This would force you into using the keyboard, mouse, joystick, etc. The example that you linked to uses the Bluegiga WT12. The WT12 actually allows you to define your own HID descriptor. You could do a vendor specific report and define how the OS interprets the data ...


5

Cheapest and simplest solution I know of is to find an old USB PC keyboard. Extract the small circuit board from it. Run xev on your Linux machine to find which two contacts you have to short together on the board to get some character as an output. You can also trace out the patterns on the keyboard membrane to do this. Then buy any momentary button ...


4

Most USB parallel printer adapters, even when the drivers are set up right, are not all that well suited to signaling to things other than printers. For other parallel input or output tasks, you would likely be better served with something such as the FT245 or a similar USB IO chip. Or else use a USB capable micro-controller and write a program to run on ...


4

The Wikipedia page has more information. The TrackPoint needs to be treated as a pair (X-Y) of strain gauges. That Wikipedia page also includes a link to a relevant patents with more info. Updated - Here is some more info I found from my bookmarks: The A-to-D conversion (encoding) from the analog TrackPoint signals into either a standard serial or (later) ...


4

A simple solution is to use a 5V relay, and put a zener with about 7V breakdown voltage in series with the coil. Something like 1N5342 or 1N5921 (6.8V) would be appropriate. This way, the relay will see 5.2V when there is 12V, and nothing when the voltage is only 6V (or anything under the breakdown voltage). This is a very simple circuit, which doesn't rely ...


4

You probably want a CDC serial port. I'm going to disagree with laptop2d here, although HID drivers (e.g. ones for a usb mouse and keyboard) are common, I don't see how you would use any of the standard drivers for serial-like communication. You could of course write your own HID driver, or maybe there is a company out there selling them. Windows versions ...


4

It seems like the mystery data format is the official USB HID keypress format: https://wiki.osdev.org/USB_Human_Interface_Devices The first eight bytes which are read correspond to a key press event (the value for a keypress is according to the USB HID usage tables for keyboards): Offset Size Description 0 Byte Modifier keys status. 1 ...


3

Interesting. As a developer of keyboard firmware my guess would be that these boards internally rebuild the report each key-matrix scan cycle without blocking interrupts while doing so. This would work fine if sending the report is initiated by the keyboard controller (it'll just write the new report into the IN pipe buffer), but could cause empty packets if ...


3

I've managed to track down the issue. It was to do with my endpoint descriptor. I used a define PS_IN and PS_OUT where I should have used _PS_IN and _PS_OUT prefixed with an underscore. This off course didn't result into a compiler error, since all four of these defines are in fact valid, yet _PS_IN != PS_IN etc.


3

It's my understanding that a mouse is fundamentally a relative device. The values returned by the mouse are the amount of movement since it last reported. As such, if you want to make a system that performs like a typical computer mouse, you need to integrate the delta values reported by the HID driver. With a computer screen, basically every display-...


3

Normally module level products are aimed at prototyping and low-volume production. Therefore they tend to be produced and sold in smaller quantities at a higher cost than their chipset counterparts, and of course the companies that make them want to turn a profit on their R&D work. If you're prepared to do the additional design work yourself you may be ...


3

Download Atmel Studio 6 and check out the examples (integrated into the Studio). If I remember correctly there even is an example for HID Devices. Of course there is a fully implemented USB stack available upon which you can still build upon. Furthermore, there are examples for various other USB devices (Mass storage, ...) You might also want to refer to ...


3

Technically, it is possible. The board already has a Micro-AB port, and the MCU on it supports OTG. But all the examples now given are configuring it as a device. So you may need some coding to make it a host. Update: And, thanks to @PkP, he find their is a example for USB host in the MCU's datasheet, section 41.7.


3

One alternative to the FTDI SPI-to-USB chips is the MCP2210 IC from Microchip. The MCP2210 device is a USB-to-SPI Master converter which enables USB connectivity in applications that have an SPI interface. The device reduces external components by integrating the USB termination resistors. The MCP2210 also has 256 bytes of integrated user EEPROM. ...


3

Don't try to invent another bicycle. The optical mouse is a result of sophisticated engineering, not just a lens and a chip sensor. The lens is a complex optical path from illuminating LED/laser to focusing surface image to the pinhole of receiver sensor. It is a carefully designed light-folding unit, and can't be found in general stores. For a prototype ...


3

Unfortunately, you cannot wire a button directly to a USB cable. This will not work. You'll need an MCU to monitor your button, and communicate over USB. Using something like an ATmega32u4 that has a USB transceiver built-in would work. Give this sparkfun tutorial a read. Note that you aren't limited to using the sparkfun board. I chose that tutorial ...


3

You can't have a "HID keyboard" with a "single extra port"; the device of this kind must be a compound device, made of a two-port hub, with one port connected to non-removable HID device. The other port can be permanently connected to a mass-storage device. In this case you might not need to wrap all this as a composite device (a device supporting two ...


2

I'm not sure if there is a standard class definition in the USB spec for parallel ports, as there is for serial ports. If there is no such standard class definition, then it will take a custom operating system driver. This driver presents a parallel port interface on the OS side and talks to your USB device on the other side. Microchip had a similar ...


2

Sounds like you need to use the SPP (Serial Port Profile) This basically makes the BT module look like a UART to whatever is connected to it, although internally the BT module deals with things in packets (transparent to the user) You will need to implement the module as a master service, then anything can request to connect accordingly (modules ...


2

You can't have pressure sensitive buttons. You need to specify them as additional axes. Additionally, the controller really has 12 pressure sensitive buttons? In that case, you're out of luck, as I have yet to find any software that works with more then 8 axes (including windows!). Furthermore, you can consolidate some of your axes controlls: const ...


2

Jan Axelson, the author of USB Complete, has some fantastic HID info and tips on the lvr website (link goes to Atmel bookmark). I don't know if that addresses AVR32 specifically, but I can't imagine a USB stack hasn't been implemented and made available. I highly recommend USB Complete, by the way


2

The USB Serial Number is what you want. And Atmel has a small datasheet on how to implement it with their usb stack here. Additionally, any of the user configurable USB descriptors could be used. Assuming you are using the same VID/PID pair, you still have the Device Release Number, Manufacturer String Descriptor (Manufacturer Name), Product String ...


2

Have you tried V-USB library? It's a fantastic library for AVR microcontrollers, also supports HID protocol. Here's a link: http://www.obdev.at/products/vusb/index.html


2

Try using USB in interrupt mode. USB devices must respond to host requests within a certain time frame. You haven't detailed how long your timer tasks routine takes to execute but from this error it seems that it is taking too long and there is no way for the USB to respond in a timely fashion. Without specific details of your application, I would suggest ...


2

In order to make the device show up as two separate input devices in linux, the device's vendor_id and device_id need to be set up with the HID_QUIRK_MULTI_INPUT quirk in the USB HID driver in Linux. See hid-quirks.c in the linux kernel source for examples - there are currently 35 devices configured with a line like: { HID_USB_DEVICE(USB_VENDOR_ID_MOJO, ...


Only top voted, non community-wiki answers of a minimum length are eligible