1 | #include <Application.h>
|
---|
2 | #include <USBKit.h>
|
---|
3 |
|
---|
4 | #include <stdio.h>
|
---|
5 |
|
---|
6 |
|
---|
7 | class Watcher : public BUSBRoster {
|
---|
8 | public:
|
---|
9 |
|
---|
10 | ~Watcher() {}
|
---|
11 |
|
---|
12 | status_t DeviceAdded(BUSBDevice *device) {
|
---|
13 | printf("ADD\n");
|
---|
14 | //return !B_OK; // This is no problem
|
---|
15 | return B_OK;
|
---|
16 | }
|
---|
17 |
|
---|
18 | void DeviceRemoved(BUSBDevice *device) {
|
---|
19 | printf("REMOVE\n");
|
---|
20 | return;
|
---|
21 | }
|
---|
22 |
|
---|
23 | };
|
---|
24 |
|
---|
25 | class WatcherApp : public BApplication {
|
---|
26 | public:
|
---|
27 |
|
---|
28 | WatcherApp() : BApplication("application/x-vnd.MCR.test.USBwatch") {
|
---|
29 | }
|
---|
30 |
|
---|
31 | void ReadyToRun() {
|
---|
32 | w.Start();
|
---|
33 | }
|
---|
34 |
|
---|
35 | private:
|
---|
36 |
|
---|
37 | Watcher w;
|
---|
38 | };
|
---|
39 |
|
---|
40 | main() {
|
---|
41 | WatcherApp app;
|
---|
42 | app.Run();
|
---|
43 | return 0;
|
---|
44 | }
|
---|