summaryrefslogtreecommitdiffstats
path: root/kcontrol/usbview/usbdevices.h
blob: 853df02b385721b02662bc52efef452884d97684 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/***************************************************************************
 *   Copyright (C) 2001 by Matthias Hoelzer-Kluepfel <mhk@caldera.de>      *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/


#ifndef __USB_DEVICES_H__
#define __USB_DEVICES_H__


#include <qstring.h>
#include <qptrlist.h>

#ifdef Q_OS_FREEBSD
#include <dev/usb/usb.h>
#endif

class USBDB;


class USBDevice
{
public:
  
  USBDevice();

  void parseLine(QString line);
  void parseSysDir(int bus, int parent, int level, QString line);

  int level() { return _level; };
  int device() { return _device; };
  int parent() { return _parent; };
  int bus() { return _bus; };
  QString product();

  QString dump();

  static QPtrList<USBDevice> &devices() { return _devices; };
  static USBDevice *find(int bus, int device);
  static bool parse(QString fname);
  static bool parseSys(QString fname);


private:

  static QPtrList<USBDevice> _devices;

  static USBDB *_db;

  int _bus, _level, _parent, _port, _count, _device, _channels, _power;
  float _speed;

  QString _manufacturer, _product, _serial;

  int _bwTotal, _bwUsed, _bwPercent, _bwIntr, _bwIso;
  bool _hasBW;

  unsigned int _verMajor, _verMinor, _class, _sub, _prot, _maxPacketSize, _configs;
  QString _className;

  unsigned int _vendorID, _prodID, _revMajor, _revMinor;

#ifdef Q_OS_FREEBSD
  void collectData( int fd, int level, usb_device_info &di, int parent );
  QStringList _devnodes;
#endif
};


#endif