Libusb Welcom Dualstick

Posted on by  admin
  1. Libusb Welcome Dual Stick 2

Libusb is a library for USB device access from Linux, macOS, Windows, OpenBSD/NetBSD and Haiku userspace. It is written in C (Haiku backend in C) and licensed under the GNU Lesser General Public License version 2.1 or, at your option, any later version (see COPYING). Libusb undefined reference to. Ask Question Asked 8 years ago. Active 2 months ago. Viewed 28k times 9. I'm trying to set up libusb API on my OS. I downloaded libusb api on libusb.org. I have libusb.so in /lib and also I have usb.h in /usr/local/include and the link for the.so and libusb.a in /usr/local/lib. LX8 (112 MB available) LX8/ 29C3 LX8/29C3/Our daily Job- Hacking the law 29C3.mp4. LX8/29C3/Certificate Authority Collapse.mp4. LX8/29C3/Re-igniting the crypto-wars on the web 29C3preview.mp4.

As I don't have a PS3 ATM but controllers I wanted to get some use out of them. I ran across this: However the instructions aren't flat out listed, and it took me a while to get it working. What you will need: SIXAXIS or Dualshock 3 Bluetooth 2.0 dongle or a Bluetooth 2.0 card (Some computers come with them) USB to B-mini (The cable you use to charge your controller should be fine) FreeBT (I'll show you where) BtSix 1.4 (I'll show you where) PPJoy 0.83 (I'll show you where) MAKE SURE YOUR PS3 IS OFF BEFORE DOING ANYTHING WITH THE CONTROLLER!!! You'll need to install libusb-win32-filter-bin-0.1.12.1.exe, get that FreeBT Next with the Bluetooth dongle. Download the latest version of FreeBT. FreeBT is an Open source Bluetooth Driver that will Allow BtSix to access the controller.

If you just bought the device, when you plug it in it should start to search for drivers. Do it manually, it should have an option to search your computer for the appropriate driver. There should also be a box Below it that will search specific folders Make the folder (XXXX src driver fbtusb, where XXXX is where you extracted the folder).

BtSix 1.4 Time to get BtSix 1.4. We won't do anything with it for now, just extract to a safe place. PPJoy Now get PPjoy. PPJoy is Free Software used to configure Joysticks for various ports. Open up PPjoy and press 'Add.'

What ever the Dialog says just click Add. The found new hardware wizard should pop-up, and press 'Install from a list or a specific location'. Remember where you extracted BtSix? Direct it to the Folder called 'Driver XP' using the search function.

Putting it all together Finally we get to plug the Controller in using a USB Cable. Open BtSix, then press the 'Address' Button, to Dialogs should come up with Hex code Unplug your controller and press the home Button.

You should now see the 'Pitch' and 'Roll' Bars moving based on where you move your controller. Configuring the Controller And here comes the more complicated part, the Controller Configuration Open up PPjoy and select the controller you made earlier then press 'Mapping.' Select the 'Modify the mapping for this controller' option and press next. Pick 4 Axes, 13 Buttons, and 1 POV hat, I'd recommend naming the Axis 1-4 X Axis, Y Axis, Z Axis, and Z Rotation, respectively. Then press next, Assign X,Y,Z, and Z rot to Analog 0,1,2, and 4 (I intentionally skipped 3) and press next. Assign buttons 1-8 to Digital 0-7, then assign Buttons 9-13 with Digital 12-16 and press next. On this one assign North-Digital 11, East-Digital 10, West-Digital 8, South-Digital 9.

Click to expand.Yes. But you can buy a Bluetooth dongle for pretty cheap. Here are some examples from Newegg. $12.99 $$6.50 $18.49 $23.99 I own a Belkin myself, but I bought it just because I didn't care about price and just wanted a Bluetooth dongle.

As long as it's Bluetooth 2.0 you should be able to find a decent one for $20. A couple notes about this: I would recommend not using the drivers you got with the dongle. You'll have to uninstall them to use your SIXAXIS, and FreeBT has the same functionality. Some new computers especially laptops have Bluetooth functionality out of the box.

Click to expand.I'm currently using a DualShock 3 for the wireless method (I've previously used a SIXAXIS for both) but I can't seem to get it to work for the wired method. As for vibration, I haven't gotten it to work, but I haven't tried, I will be trying to figure that out soon. EDiT: It appears BtSix doesn't support it.yet.

But he seems to release a new version every month. He may update the current version with FF.

But I'm not sure. If you are having issues you mind telling me if the pitch and roll in BtSix are moving, and if the Game Controllers Section of Control Panel recognizes your button presses. Saying your issue (Games not recognizing the controller) would really help also. What is Pidgin?

Pidgin is a multi-protocol Instant Messaging client that allows you to use all of your IM accounts at once. Pidgin can work with:. AIM.

Bonjour. Gadu-Gadu. Google Talk. Groupwise.

ICQ. IRC. MSN. MySpaceIM. QQ. SILC.

SIMPLE. Sametime. XMPP. Yahoo!.

Zephyr Pidgin is free software. It is licensed under the GNU General Public License (GPL) version 2. This means you are free to use it and to modify it, but if you distribute your modifications you must distribute the modified source code as well. And I forgot to okay you.

A month with no new post? That’s unacceptable. Since my, I actually have quite a few new ideas and projects to post about. The thing is there are so many of them that I don’t know which one to start with!

Anyways, I’ve decided to put a stop to this. In this blog post, I will describe some work I did a little while back about implementing HID-class serial communication for AVR microcontrollers using the V-USB library. Introduction First, let me explain what I am trying to do. As you probably know, is a very useful software-only implementation of low-speed USB device for AVR microcontrollers. It adds USB functionality for almost any AVR, particularly for those without hardware USB functionality. With this, it’s possible to make a very low-cost standalone Arduino with USB port and without having to use an FTDI chip. I know there is the Arduino Leonardo, which is based on ATmega32u4, and which has hardware-based USB functionality.

But mega32u4 only exists in SMT package, and it’s more expensive than mega328 after all. Besides, I am fully embracing the ‘I do it because I can’ spirit, and this is actually a great motivation for me to learn about V-USB. What do I need the USB for? Mostly for two reasons. One is to flash a program to the microcontroller, so it needs a USB-based bootloader. For this, there is a very nice open-source project called, which can bootload mega328 as a programmer. This way you can flash a program through the USB port directly, without using a serial cable or an external AVRISP programmer.

So this is all good. The second reason to have USB is for serial communication — the ability to transfer data (e.g. Strings) in and out between the device and a host computer through the USB port.

This is useful especially for debugging (i.e. Printing values to a serial monitor), unfortunately this feature is missing in most V-USB projects.

There are some related projects. For example, I came across the project, which turns a mega328 into a CDC-class USB-serial converter.

But there seem to be some limitations of using V-USB to implement CDC (i.e. Violates USB standard), and also CDC-class devices require installing a driver on Windows. I would like to make a HID-class USB device which does not require driver installation. So overall I didn’t find any available resource that I can use directly. Circuit Design and V-USB Now I’ve explained the motivation, let’s see how to go about implementing it. The first step is to learn to use V-USB. I started with the project downloaded from the V-USB website.

It is based on the tiny45 mcu. The program reads a sensor (e.g. Temperature or light) and presents itself as a USB keyboard to print out the sensor values to a host computer.

Libusb Welcome Dual Stick 2

This is an excellent starting point for me because USB keyboard is a standard HID-class device, and the project is simple enough that I can easily learn and make modifications. To adapt it to mega328, I first made a circuit based on USnoobie. Here is the schematic and my build of the circuit on a breadboard: It’s a pretty standard V-USB setup. I assigned digital pin PD2 (INT0) to USB D+, pin PD7 to USB D-, and PD4 to a pushbutton. The pushbutton is used to enter bootloading mode. Specifically, if the button is pressed when the circuit is powered up, the bootloader is activated and the mcu will appear as a USBasp programmer. Different from USnoobie, I’ve decoupled this button from the D- line, so that I can use the button for general-purpose input (otherwise pressing the button will trigger the D- line).

This requires changing the USnoobie code slightly to use pin PD4 for bootloading condition. Finally, I’ve also added a MCP9700 temperature sensor (you can replace it by any analog sensor such as photosensor) to analog pin ADC0 for testing later. The next step is to modify the source code. First, change usbconfig.h to match the D+ and D- pin settings, specifically the following three macro defines.

/./ Next, modify main.c. This step is pretty technical and tedious. It mainly involves changing register names to match mega328 (since the code was originally written for tiny45). Also, the calibrateOscillator; function can be removed as the mega328 will be running on an external 12MHz clock. I also modified the Makefile in order to compile and flash the code for mega328. After a few tweaks here and there, the EasyLogger started working on my mega328!

It can successfully output numerical values to a text editor through the USB port. This is very encouraging. If these steps don’t make much sense, you can take a look at the code below, and give it a try yourself. Learning HID HID stands for Human Interface Device. It’s a USB class designed primarily for keyboard, mice, joystick, and similar human interface devices. The nice thing about HID is that it’s supported on all operating systems.

For example, on Windows, the system uses built-in HID driver to handle USB requests, so no driver installation is required. This is why when you plug in a keyboard or mice, you never have to install a driver (imagine how annoying it would be if you had to!). To implement HID, you first will need to construct a HID descriptor, which describes the number of reports, and the size, meaning, and (optionally) value range of each report. For example, these reports can be the ASCII code of the pressed key, the x and y offsets, and button presses of the mouse. There are also more general-purpose reports like a buffer of bytes. This is what I will be using to transfer bytes in and out between the device and host.

To be honest, the whole USB descriptor thing was very obscure to me in the beginning. I didn’t know if there is one correct way to define it, or it can be flexible. As it turns out, Linux is pretty forgiving about it, but Windows is not. After many trials and errors, I finally settled with this HID descriptor.

First, the ATtiny45 (which functions as a USBtiny programmer) has been removed, partly to save space, and partly to simplify the design. Instead, the ATmega644 will be flashed with a USBasp bootloader, which allows itself to function as a USBasp programmer in bootload mode. This will take away 2KB of flash memory space, but on the plus side, it eliminates one chip, and the transfer speed of USBasp is actually noticeably faster than USBtiny. Additionally, using ATmega644 to directly handle USB tasks (thanks to the V-USB library) makes it possible to add USB serial functionality. As a result, you can do serial communication to debug the code, without any external USB serial converter.

Libusb

So it’s win-win-win The details can be found in my previous blog post about USB HID-class Serial Communication for AVRs. Hello Sir, I’m fairly new to all this.

I have an ATmega328 on a board and am using an ATmega8l USBasp to connect to it and upload and run programs. Apparently most of the Arduino examples are working just fine. Just the Serial ones aren’t running. So I followed your method and downloaded all the required softwares. Next as said in the tutorial I am uploading the HelloWorld code and then running the host software(which is the HID Serial Monitor). However as I try to “connect” to the USBasp, it says “could not find device”.

Could you please tell me which step I’m doing wrong or atleast how and where I should use that EasyLogger code for the ATmega328, cause I’m pretty sure I haven’t done anything with it except download and extract the files. Do I need to run any file? Cause I can’t see any.exe file. Thanks for your help in advance. First of all, thanks for the effort you spent on this. I tried to compile the library using Tiny cores from I run into trouble with line 13 of HIDserial.h – the definition of write for string.

I replaced it to return nothing and redefined it to voin instead of sizet (fixed the HDserial.c accodringly). It compiled, however, something seems not to be working correctly, when run using the circuit you are providing on the last image (the voltage decreased using 2 diodes, no zeners, etc). I suspect the problem is with oscilator, which, I read somewhere, is not reliable on 3.3V operation at 16MHz for ATtiny85. Can you, please, provide an example for ATtiny45/85 arduino sketch and some schematics?

I will sound stupid, but I cannot provide any other explanation of the behavior. When I only plug in the resistors and the diodes to the USB port (the same way as your picture with the ATTiny), the dmesg says something like USB device connected and than Error: Device not accepting address Exactly same thing happens when I try to connect the ATtiny85 with the resistors. As I do not have logic analyzer, I am kinda lost and don’t know how to provide more information 🙠x81 But, I made a simple code change – I put a blinking loop into the code and I can see the LED is not working – for me this could mean that the BOD jumped in or something 🙠x81 As I said, I am lost 🙂. Hello Ray, This is a very good work. Thank you for sharing it. I’m wondering if this library can coexist with a bootloader (like micronucleus) on a ATtiny85 Digispark-like board. I tried to change the pins in usbconfig.h (PB3 for D- and PB4 for D+ instead of PB0 and PB2) and then to flash to the chip, but it doesn’t seem to work: nothing happened and HIDSerialMonitor don’t recognise the board.

The problem is maybe the pins I used (does the library only work with PB0 and PB2?) or is maybe the VendorID and ProductID change after boot (bootloader starts with 16d0:0753, and then the program goes to 16c0:05fd). Or maybe it isn’t possible to have a bootloader and a program sharing the same USB port. Do you think that it is possible to do? If yes, what should I do / try? Best regards, Luca. Hi Luca, it should be able to work with a bootloader. Because the code relies on V-USB, according to V-USB requirement, D+ must be connected to INT0 (PB2) so unfortunately you can’t change this pin; D- however, can be substituted by another pin.

Does Digispark use PB3 and PB4? I had always thought it also uses V-USB internally, but perhaps I am wrong. If this doesn’t work, an alternative is to consider using the USBasp bootloader, which is built-on V-USB. SquareWear (ATmega328) and OpenSprinkler 2.1 (ATmega644) both use USBasp bootloader, and it should be pretty easy to modify it to work with ATtiny85. Hello, I like this project very much. I was looking to see if I could use this to read a USB keyboard and convert the scan codes into ASCII for a serial output which I can connect to an older computer using only a RS232 serial port. It would seem it’s possible with your project but I’m not sure.

I’m not very familiar with the HID protocol. When I found your website it looks promising and it might help with my project. It was very common to do this with PS/2 keyboards. But I have this mini-keyboard, only 6″ long, and it’s only made with USB. Ray First off, thank you very much for the information.

I am very fortunate to come across it as it’s helping me with a project of mine. I’m new to Processing and am running into trouble when trying to compile your code. Everything appears to be related to this “HIDAPI library” you mention and declare inside your code. I was able to install the G4P library which was easy as it looks like it was made for easy integration with processing, however, this javahidapi library seems to be tricker. First off, this is what I’m assuming you’re using for a library: I’ve been trying to work with the hidapi-1.1.jar which is available from the website above. I’ve tried putting in in my sketchbook library location in its native format as well as extracting it in multiple ways / folder combinations but I have always gotten errors when compiling / running your code saying: The package “com.codeminders” does not exist.

You might be missing a library Then in the status window is says: No library found for com.codeminders.hidapi No library found for com.codeminders.hidapi No library found for com.codeminders.hidapi Libraries must be installed in a folder named ‘libraries’ inside the ‘sketchbook’ folder. One of the last things I did was throw the hidapi-1.1.jar into the processing program folder core library folder.

That cleared up half the problem and allowed the program to run and compile only leaving the following messages in the compiling status window: No library found for com.codeminders.hidapi No library found for com.codeminders.hidapi No library found for com.codeminders.hidapi It will run / compile, but when I try and run either window’s executable I get “A Java Exception has occurred ” I’m running Java 8 update 25. It makes me think there’s still something going on with the hidapi library. Any help would be very much appreciated Thanks Lane. Well done sir! I’ve made my V-USB device using ATmega8535 and it works, tested using command prompt based serial monitor on windows 7.

Then I trying to use your HID Serial Monitor Interface using Processing software but it keeps saying my device not found. I think that is caused of device name definition in HIDDeviceInfo.class, HIDDevice.class, or HIDManager.class at HIDAPI Library. I’d like to use your HID Serial Monitor because it has more attractive interface than the command prompt.

So how can I change that library definition so my device can run on your serial monitor sir? Thanks for advance. That’s true, I agree.

I have been using PIC18F14K50 for a while (the first version of SquareWear was developped using it). However, Microchip’s software license is not very friendly for the open-source community (see discussions here: ).

So while they have superior products, they are not as open-minded as Atmel. Arduino does gain the advantage of popularity: there is likely an open-source library you can find for whatever component or sensor you are using. This reduces the development cycle, and makes it really easy to prototype a project. With PIC you may have to write your own library. At last, after a week googling I found you!! Thanks for this great tutorial.

I’m a bit overwhelmed by different ideas and implementation out there, but your is spot on 🙂 I just started with arduino, and my first objective is to work of what makes an arduino 🙂. The above schematic has both uses tx/rx and mosi/miso, my question is do I need special code to relay serial using tx/rx to another board? Or is it builtin and all I need is to connect their pin? What I’m trying to do is like this, HID Main – RX/TX RX/TX to MISO/MOSI – Breakout board For the reason that I’d like to re-use this HID enabled setup and just use another RX/TX breakout when I just needed it.

Or are these even possible? Thanks a bunch! Hi Ray, I have figured out the connections and I am able to transfer data via USB. There is one problem though.

2To install the complete version of SFT2841, the software serial number is required. The Schneider-electric.com site has changed - this page does no longer exist. Sft2841 serial number INSTALLATION OF THE COMPLETE VERSION OF SFT2841 V11..

The HIDSerialMonitor window size on the host computer is small for thee amount of data I am trying to debug. Hence, I tried to have a look at your “Processing” code so that I would be able increase the size of the window.

I have installed Processing 3.0.1 and tried to compile your code (original one without any modifications). I am getting this error ” GTextBase.stext is not visible”. I don’t have any clue what the error is (I am new to processing). Can you please help me on this. Sorry, the project has been so long ago that I don’t remember all the details. Before you dive in further, let me ask you this: can you not use a USB-serial chip to do data transfer the easy way? The main reason I worked on this project was to use it as a way to learn V-USB.

It’s a fun learning experience. But since cheap USB-serial chips exist (e.g. CH340G) for less than 50 cents, I’ve been using these chips on all current products I have designed. This way you can use the microcontroller’s UART functions (i.e. TX/RX) pins to transfer data to a host computer, and as much data as you want.

Wouldn’t this be the easiest solution for you? Hello, I have a problem in operating the circuit.

I used a card I made ATMEGA328P-au to 20 MHz. I compiled the code and program the chip with relative fuse programming. USBasp does not enter the programming mode. I get no error but it seems not work.

I tried to install the bootloader usnoobie compiling and programming the chip and fuse for quartz to 20MHz. Even in this way it does not work. Then I used the firmware precompiled usnoobie atmega328p4k20000000.hex and in this way the card works and enters USBasp mode. I do not understand what is wrong when I compile the bootloader for the new frequency. In the makefile I replace the item with 16000000 to 20000000 I question the need just that.

Pins d + and I d- keep the default ones. I tried everything but not getting errors do not know what to do. I could use the bootloader working but your can not install it. Then I wanted to install the bootloader on a card with my other ATMEGA328P already set with the lines d + = d- = d2 and d3. The card works very well because I made with VUSB a joystick with 6 axes and 36 buttons.

I was interested in the bootloader functionality to program the chip and the possibility of serial transmission. Hello, I realized it’s a library that a host software does not use the HID driver but the libusb libraries. Practically idetiche yours.

I basically cloned your project. I changed only some parts to be able to use the new libusb libraries. I created a version of the host -side software in gtk + 3 for both libraries libusb 0.1 to 1.0 for libusb libraries. The 0.1 is not stable enough, numerous errors of IO and also on my laptop after a certain time lead to a USB controller block ohci – pci and all that is connected does not work. The 1.0 are more stable. Very few errors of IO and no block – ohci pci controller.

I’m testing a sample program on the my board atmega328-20MHz from hours and there were only a handful of IO errors and no errors or severe block to exit the application. Thanks for the project. I implemented it on Attiny85 without arduino board.I compile it in arduino SW and find the hex file from temp folder and burn using avrdude or khazama programmer to my IC.

I realize after flashing program and fuse bits,Some IC works well and windows show HID USB complaint device in device manager. But Some IC dont works.

There is no problem in IC as i checked with simple LED on/off program.It works well. But for USB serial communication,Windows show unknown device. I tried many times by checking fuse bits/Hw/burning sw but some Attiny85 doesn’t work for this program. Can anybody direct me what i should do?

Comments are closed.