1// -*- C++;indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*-
2/*
3 * find_mice.cpp
4 *
5 *  Test suite program for C++ bindings
6 */
7
8#include <iostream>
9#include <iomanip>
10#include <usbpp.h>
11
12#define VENDOR_LOGITECH 0x046D
13
14using namespace std;
15
16int main(void)
17{
18
19	USB::Busses buslist;
20	USB::Device *device;
21	list<USB::Device *> miceFound;
22	list<USB::Device *>::const_iterator iter;
23
24	cout << "idVendor/idProduct/bcdDevice" << endl;
25
26	USB::DeviceIDList mouseList;
27
28	mouseList.push_back(USB::DeviceID(VENDOR_LOGITECH, 0xC00E)); // Wheel Mouse Optical
29	mouseList.push_back(USB::DeviceID(VENDOR_LOGITECH, 0xC012)); // MouseMan Dual Optical
30	mouseList.push_back(USB::DeviceID(VENDOR_LOGITECH, 0xC00F)); // MouseMan Traveler
31	mouseList.push_back(USB::DeviceID(VENDOR_LOGITECH, 0xC024)); // MX300 Optical
32	mouseList.push_back(USB::DeviceID(VENDOR_LOGITECH, 0xC025)); // MX500 Optical
33	mouseList.push_back(USB::DeviceID(VENDOR_LOGITECH, 0xC503)); // Logitech Dual receiver
34	mouseList.push_back(USB::DeviceID(VENDOR_LOGITECH, 0xC506)); // MX700 Optical Mouse
35	mouseList.push_back(USB::DeviceID(VENDOR_LOGITECH, 0xC031)); // iFeel Mouse (silver)
36
37
38	miceFound = buslist.match(mouseList);
39
40	for (iter = miceFound.begin(); iter != miceFound.end(); iter++) {
41		device = *iter;
42
43		cout << hex << setw(4) << setfill('0')
44			 << device->idVendor() << "  /  "
45			 << hex << setw(4) << setfill('0')
46			 << device->idProduct() << "  /  "
47			 << hex << setw(4) << setfill('0')
48			 << device->idRevision() << "       "
49			 << endl;
50	}
51
52	return 0;
53}
54