Just like on ordinary linux 2.4.37. You can find many articles in internet. Simplest way - use libusb 1.0 library.
Hello,
I want to ask what are possibilities of USB programming in Oleg 1.9.2.7-d firmware? Which library to use? What I need to download? Is it possible to cross-compile it on Linux PC (or just compile it on virtual Open-WRT) and then upload it to router?
I'm going to make a LCD display (with ATMega168) for my WL-500gPv2 router and I want to send information from firmware to my ATMega over USB.
Thanks in advance.
Just like on ordinary linux 2.4.37. You can find many articles in internet. Simplest way - use libusb 1.0 library.
e.g. this project: http://www.harbaum.org/till/lcd2usb/index.shtml doesn't require driver at all. To say more exactly the driver is built into the software ( lcdproc or lcd4linux ) lcd4linux is available in optware, lcdproc can be built natively.
Yes, libusb is the way to go
Last time I tried with the optware compiler on the router it didn't work tho... maybe it's also because the webcam driver claimed the xbox360 controller I was attempting to read out.
Maybe you have better luck with the crosscompiler
quick example:
With the init function you start the libusb and open the first (unclaimed) device with a specific vid and pid.Code:#include <stdio.h> #include <stdlib.h> #include <libusb.h> int Send(libusb_device_handle *h, unsigned char data[], unsigned char endpoint) { int transferred, r; r = libusb_interrupt_transfer(h, endpoint, data, sizeof data, &transferred, 0); return r; } int Init(void) { libusb_device_handle *Controller; libusb_init(NULL); Controller = libusb_open_device_with_vid_pid(NULL, 0x045e, 0x028e); }
Depending on the AVR configuration you can also read data from a specific usb endpoint when the buffer (data) is empty (or needs to be filled).
usb on avr can be a little messy btw
at least, it's not my favourite thing to do
I will definitly post pictures. It will be outside module for now (I'm going to buy a new router and I don't want to uncover it bcs of warranty).
But I don't have router yet...
- Get router
- Buy parts for board
- Make testing breadboard
- Programm AVR - AvrX + USB data reading process
- Make USB data sending program and test it on PC
- Compile code for/at router firmware
- Test everything
- Make final PCB
I hope it will be done in two weeks (buy everything, code and also I'm student and these days we have exams, so school is priority ).