~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kinfocenter/Modules/usbview/usbdevices.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2001 by Matthias Hoelzer-Kluepfel <mhk@caldera.de>      *
 
3
 *                                                                         *
 
4
 *   This program is free software; you can redistribute it and/or modify  *
 
5
 *   it under the terms of the GNU General Public License as published by  *
 
6
 *   the Free Software Foundation; either version 2 of the License, or     *
 
7
 *   (at your option) any later version.                                   *
 
8
 *                                                                         *
 
9
 ***************************************************************************/
 
10
 
 
11
#ifndef __USB_DEVICES_H__
 
12
#define __USB_DEVICES_H__
 
13
 
 
14
#include <QList>
 
15
#include <QString>
 
16
 
 
17
#if defined(__DragonFly__)
 
18
#include <bus/usb/usb.h>
 
19
#include <QStringList>
 
20
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)
 
21
#include <sys/param.h>
 
22
# if defined(__FreeBSD_version) && __FreeBSD_version >= 800100
 
23
#  define DISABLE_USBDEVICES_FREEBSD
 
24
#  warning "The USB subsystem has changed in 8.0. Disabling."
 
25
# else
 
26
#  include <dev/usb/usb.h>
 
27
#  include <QStringList>
 
28
# endif
 
29
#endif
 
30
 
 
31
class USBDB;
 
32
 
 
33
class USBDevice {
 
34
public:
 
35
 
 
36
        USBDevice();
 
37
        
 
38
        ~USBDevice();
 
39
 
 
40
        void parseLine(const QString &line);
 
41
        void parseSysDir(int bus, int parent, int level, const QString &line);
 
42
 
 
43
        int level() const {
 
44
                return _level;
 
45
        }
 
46
        int device() const {
 
47
                return _device;
 
48
        }
 
49
        int parent() const {
 
50
                return _parent;
 
51
        }
 
52
        int bus() const {
 
53
                return _bus;
 
54
        }
 
55
        QString product();
 
56
 
 
57
        QString dump();
 
58
 
 
59
        static QList<USBDevice*> &devices() {
 
60
                return _devices;
 
61
        }
 
62
        static USBDevice *find(int bus, int device);
 
63
        static bool parse(const QString& fname);
 
64
        static bool parseSys(const QString& fname);
 
65
 
 
66
private:
 
67
 
 
68
        static QList<USBDevice*> _devices;
 
69
 
 
70
        static USBDB *_db;
 
71
 
 
72
        int _bus, _level, _parent, _port, _count, _device, _channels, _power;
 
73
        float _speed;
 
74
 
 
75
        QString _manufacturer, _product, _serial;
 
76
 
 
77
        int _bwTotal, _bwUsed, _bwPercent, _bwIntr, _bwIso;
 
78
        bool _hasBW;
 
79
 
 
80
        unsigned int _verMajor, _verMinor, _class, _sub, _prot, _maxPacketSize, _configs;
 
81
        QString _className;
 
82
 
 
83
        unsigned int _vendorID, _prodID, _revMajor, _revMinor;
 
84
 
 
85
#if (defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)) && !defined(DISABLE_USBDEVICES_FREEBSD)
 
86
        void collectData( int fd, int level, usb_device_info &di, int parent );
 
87
        QStringList _devnodes;
 
88
#endif
 
89
};
 
90
 
 
91
#endif