WinPCAP And Non-promiscuous compatible mode? - winpcap

I've heard that winpcap can work on Non-promiscuous wireless adapters. Is this true?
Is it worth the trouble to work around or should you just use Ethernet if available?

Yes, it is true, but it's a headache. When working with WINPCAP, Ethernet is much less troubled area.

Related

Where to begin when programming USB dev boards?

I recently acquired a Microchip EVB USB7252. I can use it as a USB hub. There are some pins on the board, and I have been looking for ways to use these as an interface between my computer and other devices (preferably my LCD screen).
So I got the IDE + compiler that is supposed to work for this product (MPLAB), but I could find no way to choose my model and get the correct target board.
I was hoping anybody (with likely more experience than me) could steer me in the right direction here. My only previous experience with dev boards is Arduino, where boards show up automatically as COM ports in the IDE. My ultimate goal here is to connect my peripherals to USB without using virtual COM-ports.
https://www.microchip.com/en-us/development-tool/EV33X03A
You can Try The IDE call "MPLAB" you said
and i think arduino CANT use "Microchip EVB USB7252"
So Try it And Good luck
It's a long way because USB is not easy protocol. You need to read USB specs first. Take a look at http://www.usb.org. Generally USB communicate between host and devices. There is special protocol used in this communication.
Perhaps the easiest way to do this will be using Linux and libusb or similar library. When you achieve some experience with this protocol you may be trying to write your own USB driver. I could also recommend to analyse some USB stacks like in Linux or in U-Boot one first.
If you have possibility then I'd also try to use some hardware/software USB protocol analyzers for some overview how does the communication look like.

USB programming

I want to program a microcontroller (AVR) to control some leds through USB. It's just out of interest in how to build and program USB devices.
There are some AVR microcontrollers that support the USB protocol or I could implement the USB protocol in an another microcontroller myself, but I wonder what to use to write your own drivers on the computer.
My level in system programming: total noob (hence the question)
So what is the literature you people would advice to get good knowledge of the USB technology and how to write your own drivers and beyond?
P.S.: I know:
C (probably will need it here)
Java (probably won't need it here)
Python (hope can use it here)
assembler (hopefully won't need it here XD).
...
P.P.S: driver development differs for different OS's. I use Linux and Windows, so any material related to one or both of these systems is welcome.
Well, although you can develop and write your own USB driver, the beauty of USB is that you don't need to write your own driver. the USB Implementers Forum has defined class specifications for all the standard device classes. If you can make your device fit into a standard device class the driver has already been written for you!
If you truly want to become familiar with USB development, you should start by reviewing the USB approved class specification documents.
If you are into framework for AVR microcontrollers with hardware USB then take a look into LUFA, and if you are into AVRs with software USB then look into V-USB. They have both implemented many USB classes so you don't have to do it on your own - just use them.
That sounds like a great project! I'd suggest starting off with something a little simpler since you're - as you say - a "total n00b". I'm not sure what hardware you currently have (or have in mind) but what I would suggest for the total beginner is the STK500. It's a development board that's very well supported in both Linux and Windows and will give you the most flexibility. It comes with LEDs and switches built in for your projects, but you will need to get a microcontroller. And for that I recommend the ATMega32, a great multi-purpose IC that's also well supported and has lots of documentation on the web.
Once you get those I suggest you do your development on Linux using avr-gcc (make sure to also install avr-libc). If you're using Ubuntu it's easy to get all the packages you need:
% sudo apt-get install gcc-avr avr-libc avrdude
Those should get you up and running. I'd suggest Googling around for help writing your first programs but another good resource is the online materials for this class at Cornell.
That's enough to get your feet wet with AVR microcontrollers and the development tools. The sky is the limit at that point but since you said you want to get into USB I'd suggest using the excellent V-USB framework to have your ATMega32 act as a USB device. After that, as they say, the steps to flipping LEDs are a piece of cake :).
I wonder what to use to write your own
drivers on the computer
libusb (here, here and here)
wdk
WinDriver
For libusb variants info read this
You could us libusb. It's powerful and cross-platform.
But what you're trying to do is a rather simple control interface. You can sidestep most of the complexity by using HIDAPI, I think.
http://www.signal11.us/oss/hidapi/
HID devices often use generic drivers that come packaged into the OS. That way you don't actually have to write any drivers ever, you just make your device compliant with the generic driver and tailor the client software to it.
I think this is what's usually done in the hobbyist electronics field, which is what you're interested in here.
HIDAPI is even recommended for simple communications with HID devices in the libusb FAQ since its a bit more complicated to do it across platforms using libusb.
One good way to go is just to develop a HID device, since the driver is built in to most higher level OSes and pretty flexible for simple IO like you are talking about. Another good option is just using a USB RS232 device or software. I use PICs which have a number of nice devices with USB onboard.
I had built my own test bed based on the ARDUINO UNO and i was using the ionlabs programmer of type usbasp and it worked perfectly fine but it did not allow to convert the TTL back to Rs-232 and hence i couldn't use the features such as serial.print() and i had to install the ftdi cable which allowed me to do this.
The drivers were the libusb 1.xx working just fine.
If you want to program the AVR you can use the ARDUINO software bundle or the stino to upload the programs.
You need to know c(only basics).
I created a USB-keyboard adapter last year for my capstone. I did not do the host programming but used existing code that you can find on the web.But I did program the device side and for that I got a lot of help from this website Teensy Look into their "Code Library" which has code for Keyboard, Mouse and others. Also, the USB protocol handbook will always be useful and you should always consult it when you are doing stuff with USB.
I wonder whether your AVB acts as a host or device. I guess your board is a usb device and you need to light the leds on your board. So, it may be a good way to initialize your board as a HID device. To achieve this goal, you need a HID gadget software stack running on your board. References as follows:
gadget framework in uboot
HID specefication usb org
debug tools such as USB Protocol Analyzer
libusb running on Host PC to send packets
The Microsoft documentation area of the WDK (Windows Development Kit) is recently available on MSDN. There is a section on USB, though you would be best to read the earlier sections first, in particular the "Getting Started" areas. They assume you'll be using C as the programming language for driver development.
WDK Site
WDK - USB Section
For Linux, the Linux USB website should be able to point you in the right direction. In particular you'll want the Programming Guide for Linux USB Device Drivers.

Turn on PC with USB-device

I want to be able to turn my PC on and off using an IR-remote sensor that is connected via USB to the PC. The sensor is a custom PCB implemented with an AVR microprocessor and V-USB software USB-implementation.
Now, turning off the PC is no problem with software, but is there any way to turn ON the PC using USB?
(Please note, I'm not talking about booting from USB-stick or USB-power supply ...)
There seem to be two problems:
keeping the USB powered on while the PC is off. It seems that most mainboard have a jumper for this functionality.
bringing the PC back to life. There seems to be no standard functionality for this. The solution is to "press" the PCs power button through the AVR on the USB board. I know, this means extra cable from the USB to the PC, but it seems to be the easiest solution.
Another workaround could be to send the power-on signal to the PC over ethernet. But I guess this will be more complicated than the power button solution and it involves extra cables too.
This Microsoft knowledgebase article describes how to enable "wake on USB" for a USB mouse. I just checked, and my keyboard device entry (on Windows Vista) has the same choice, already checked.
So, if your AVR is emulating a USB keyboard or mouse, it should be possible to wake the computer by sending the proper data.
there must be a way to do this with USB, since some PCs can be switched on with the keyboard. I think this will be some looking whether your mainboard/BIOS support it (it may be you need to turn it on in BIOS, this will probably also ensure your device gets power from USB although the PC is switched off), and whether that V-USB (unknown to me) can send the "wakeup"-signal.
good luck !
How "off" does the PC need to be? Is waking from sleep/suspend enough? The USB standard describes "remote wake-up".
Aside from enabling remote-wakeup, like unwind mentions, software on the PC is not involved in making this work.

How can I program a wireless adapter?

Is it possible to program a wireless adapter attached to a computer?
I need to modify how they work, not just using them to perform a task such as scanning or connecting.
I have already tried the Native Wifi API, but that library is too high level. I cannot modify how exactly the wireless adapter works.
Any solution in any programming language in any operating system is very welcomed. (Sounds so desperate lol)
You need an open-source operating system then. Hardware varies in how programmable it is, but for example, Atheros wireless cards do not have an on-board processor, and therefore they do the absolute minimum of the 802.11 protocol in hardware, leaving everything else to the device driver. More info in these places: http://linuxwireless.org/ http://git.kernel.org/?p=linux/kernel/git/linville/wireless-testing.git;a=summary;
If you really need to go further that what commodity hardware can do, look in to GNU Radio and the USRP/USRP2: http://gnuradio.org/redmine/wiki/gnuradio
And yes, you do have to be careful about the legal implications of this stuff, but then if you don't turn off the regulatory framework, there is software to help with that.
Generally speaking, the manufacturer will attempt to prevent you from doing this. Since what you're working with is really a radio transceiver, its operation is regulated. In the US, for example, such things fall under the purview of the FCC. Depending on the country, changing how it operates (and then operating it) is likely to be illegal.
If you have an atheros chipset on your WLAN card then load up linux and install ath5k/ath9k or madwifi and you can do some interesting things with the driver.

How to have a computer flash a light

I'd like to have an application monitor written in C# monitoring a set of Forex trading positions. It would be connected via USB to a real set of "traffic lights" sat on a desk which it would use to indicate system status. Can anybody suggest a good solution?
Normally I'd say parallel port or some other such thing, but if you've got your hopes up for USB, then definitely have a look at the Arduino. It's a very low cost microcontroller that can run standalone, or can talk to a PC through a number of flexible interfaces (including USB).
It is extremely popular with the hobbyist community, and as such, there are a number of entry-level projects to get one started with the device. Price on Sparkfun is $35 USD for a fully assembled USB-enabled version.
I have used the concepts in this CodeProject article to successfully light up LEDs.
It might meet your requirements if:
You can use parallel port instead of usb (or maybe usb to parallal cable/dongle)
You are ready to tackle some soldering and simple electronic tinkering
You can modify the vb code to monitor your status
As the author mentions in the article, you can destroy your computer's parallel port (and worse!) if you are not very careful.
In addition, a good engineer would insist that you isolate the lights from the port to further protect the computer. (relays, triacs, opto isolators, etc.)
That being said, it does work!
The easiest solution is to buy a USB traffic light, rather than building one yourself. E.g. USB Ampel. With a simple API included, it would probably be much easier.
Traditionally people have used the X10 automation framework for this kind of thing. People at my company use it to control lava lamps to indicate the status of our continuous integration build.
There's a pointer over at How does one get started writing applications that interact with x10 protocol?
One step further is to build something yourself using a microcontroller platform like the Arduino. Some examples of what is possible with the Arduino platform are available on the Arduino Playground page.
An article on how to make traffic lights using an Arduino is available at Instructables.
Channel9 has a video from the Microsoft PDC showing how some developers use a "Build Bunny" for something similar: PDC2008 ShowOff Entry: Brian the Build Bunny
There's also more information and source code here.
Try using simple usb experimentation interfaces such as Phidgets (Www.phidgets.com) or the Velleman k8055 USB experimentation board (http://www.velleman.be/ot/en/product/view/?id=351346).
We used this product at my last job to control a set of revolving traffic lights when a build would break on our CI server. The Ethernet is nice so that you are not limited to the 3M range of USB and it is as easy as opening a TCPClient to port 10000 and sending a "1R1\r".
http://www.6bit.com/products/smartrelayE.php?products_id=33