Skip to content

Commit 786b188

Browse files
committed
Rename class and files.
1 parent e63eee1 commit 786b188

File tree

7 files changed

+49
-41
lines changed

7 files changed

+49
-41
lines changed

configure.ac

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ AC_ARG_ENABLE( [debug-gkdbus],
8383
[enable_gkdbus_debugging=$enableval], [enable_gkdbus_debugging=no])
8484

8585
AC_ARG_ENABLE( [debug-libusb],
86-
AC_HELP_STRING( [--enable-debug-libusb], [Enable LibUSB extra debugging, default: no]),
86+
AC_HELP_STRING( [--enable-debug-libusb], [Enable libusb extra debugging, default: no]),
8787
[enable_libusb_extra_debugging=$enableval], [enable_libusb_extra_debugging=no])
8888

8989
AC_ARG_ENABLE( [debug-pbmfont],
@@ -198,7 +198,7 @@ GDT_DEBUG_FLAG( [$enable_gkdbus_debugging],
198198

199199
GDT_DEBUG_FLAG( [$enable_libusb_extra_debugging],
200200
[DEBUG_LIBUSB_EXTRA],
201-
[LibUSB extra debugging])
201+
[libusb extra debugging])
202202

203203
GDT_DEBUG_FLAG( [$enable_pbmfont_debugging],
204204
[DEBUG_PBMFONT],
@@ -423,7 +423,7 @@ AC_MSG_NOTICE([
423423
Global debugging : ${enable_debugging}
424424
keys : ${enable_keys_debugging}
425425
GKDBus : ${enable_gkdbus_debugging}
426-
LibUSB : ${enable_libusb_extra_debugging}
426+
libusb : ${enable_libusb_extra_debugging}
427427
PBMFont : ${enable_pbmfont_debugging}
428428
LCD plugins : ${enable_lcd_plugins_debugging}
429429
debug dir : ${DEBUG_DIR}

src/bin/daemon/Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ GLogiKd_LDADD += \
5555
@LIBUSB_LIBS@
5656

5757
GLogiKd_SOURCES += \
58-
%D%/libUSB.cpp \
59-
%D%/libUSB.hpp
58+
%D%/libusb.cpp \
59+
%D%/libusb.hpp
6060
endif
6161

6262
if WITH_HIDAPI

src/bin/daemon/USBDevice.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class USBDevice
6666

6767
#if GKLIBUSB
6868
private:
69-
friend class LibUSB;
69+
friend class libusb;
7070

7171
std::mutex _libUSBMutex;
7272
#endif

src/bin/daemon/devicesManager.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#include "devicesManager.hpp"
4242

4343
#if GKLIBUSB
44-
#include "libUSB.hpp"
44+
#include "libusb.hpp"
4545
#elif GKHIDAPI
4646
#include "hidapi.hpp"
4747
#endif
@@ -871,7 +871,7 @@ void DevicesManager::resetDevicesStates(void) {
871871

872872
/*
873873
* Throws GLogiKExcept in many ways on udev related functions failures.
874-
* LibUSB failures on devices start/stop are catched internally.
874+
* USB library failures on devices start/stop are catched internally.
875875
*/
876876
void DevicesManager::startMonitoring(void) {
877877
#if DEBUGGING_ON
@@ -909,7 +909,7 @@ void DevicesManager::startMonitoring(void) {
909909
#endif
910910
try {
911911
#if GKLIBUSB
912-
_drivers.push_back( new LogitechG510<LibUSB>() );
912+
_drivers.push_back( new LogitechG510<libusb>() );
913913
#elif GKHIDAPI
914914
_drivers.push_back( new LogitechG510<hidapi>() );
915915
#endif

src/bin/daemon/libUSB.cpp renamed to src/bin/daemon/libusb.cpp

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@
3030

3131
#include "lib/utils/utils.hpp"
3232

33-
#include "libUSB.hpp"
33+
#include "libusb.hpp"
3434

3535
namespace GLogiK
3636
{
3737

3838
using namespace NSGKUtils;
3939

40-
libusb_context * LibUSB::pContext = nullptr;
41-
uint8_t LibUSB::counter = 0;
42-
bool LibUSB::status = false;
40+
libusb_context * libusb::pContext = nullptr;
41+
uint8_t libusb::counter = 0;
42+
bool libusb::status = false;
4343

4444
/*
4545
* --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
@@ -51,38 +51,40 @@ bool LibUSB::status = false;
5151
* --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
5252
*/
5353

54-
LibUSB::LibUSB(void)
54+
libusb::libusb(void)
5555
{
56-
LibUSB::counter++;
56+
libusb::counter++;
5757

58-
if( ! LibUSB::status ) {
58+
if( ! libusb::status ) {
5959
#if DEBUGGING_ON
6060
LOG(DEBUG3) << "initializing libusb";
6161
#endif
62-
int ret = libusb_init( &(LibUSB::pContext) );
62+
int ret = libusb_init( &(libusb::pContext) );
6363
if ( this->USBError(ret) ) {
6464
throw GLogiKExcept("libusb initialization failure");
6565
}
6666

67-
LibUSB::status = true;
67+
libusb::status = true;
6868
}
6969
}
7070

71-
LibUSB::~LibUSB() {
72-
LibUSB::counter--;
71+
libusb::~libusb()
72+
{
73+
libusb::counter--;
7374

74-
if (LibUSB::status and LibUSB::counter == 0) {
75+
if (libusb::status and libusb::counter == 0) {
7576
#if DEBUGGING_ON
7677
LOG(DEBUG3) << "closing libusb";
7778
#endif
78-
libusb_exit(LibUSB::pContext);
79-
LibUSB::status = false;
79+
libusb_exit(libusb::pContext);
80+
libusb::status = false;
8081
}
8182
}
8283

83-
void LibUSB::openUSBDevice(USBDevice & device) {
84+
void libusb::openUSBDevice(USBDevice & device)
85+
{
8486
libusb_device **list;
85-
int numDevices = libusb_get_device_list(LibUSB::pContext, &(list));
87+
int numDevices = libusb_get_device_list(libusb::pContext, &(list));
8688
if( numDevices < 0 ) {
8789
this->USBError(numDevices);
8890
throw GLogiKExcept("error getting USB devices list");
@@ -127,7 +129,8 @@ void LibUSB::openUSBDevice(USBDevice & device) {
127129
}
128130
}
129131

130-
void LibUSB::closeUSBDevice(USBDevice & device) noexcept {
132+
void libusb::closeUSBDevice(USBDevice & device) noexcept
133+
{
131134
if( device.runDeviceUSBRequests() ) {
132135
/* if we ever claimed or detached some interfaces, set them back
133136
* to the same state in which we found them */
@@ -144,7 +147,7 @@ void LibUSB::closeUSBDevice(USBDevice & device) noexcept {
144147
#endif
145148
}
146149

147-
void LibUSB::sendControlRequest(
150+
void libusb::sendControlRequest(
148151
USBDevice & device,
149152
const unsigned char * data,
150153
uint16_t wLength)
@@ -194,7 +197,7 @@ void LibUSB::sendControlRequest(
194197
}
195198
}
196199

197-
int LibUSB::performKeysInterruptTransfer(
200+
int libusb::performKeysInterruptTransfer(
198201
USBDevice & device,
199202
unsigned int timeout)
200203
{
@@ -225,7 +228,7 @@ int LibUSB::performKeysInterruptTransfer(
225228
return ret;
226229
}
227230

228-
int LibUSB::performLCDScreenInterruptTransfer(
231+
int libusb::performLCDScreenInterruptTransfer(
229232
USBDevice & device,
230233
const unsigned char * buffer,
231234
int bufferLength,
@@ -272,7 +275,8 @@ int LibUSB::performLCDScreenInterruptTransfer(
272275
* --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
273276
*/
274277

275-
int LibUSB::USBError(int errorCode) noexcept {
278+
int libusb::USBError(int errorCode) noexcept
279+
{
276280
switch(errorCode) {
277281
case LIBUSB_SUCCESS:
278282
break;
@@ -287,7 +291,8 @@ int LibUSB::USBError(int errorCode) noexcept {
287291
return errorCode;
288292
}
289293

290-
void LibUSB::releaseUSBDeviceInterfaces(USBDevice & device) noexcept {
294+
void libusb::releaseUSBDeviceInterfaces(USBDevice & device) noexcept
295+
{
291296
int ret = 0;
292297
for(auto it = device._toRelease.begin(); it != device._toRelease.end();) {
293298
int numInt = (*it);
@@ -322,7 +327,8 @@ void LibUSB::releaseUSBDeviceInterfaces(USBDevice & device) noexcept {
322327
* libusb_set_configuration() may succeed.
323328
*
324329
*/
325-
void LibUSB::setUSBDeviceActiveConfiguration(USBDevice & device) {
330+
void libusb::setUSBDeviceActiveConfiguration(USBDevice & device)
331+
{
326332
int ret = 0;
327333

328334
#if DEBUGGING_ON
@@ -407,7 +413,7 @@ void LibUSB::setUSBDeviceActiveConfiguration(USBDevice & device) {
407413
this->attachUSBDeviceInterfacesToKernelDrivers(device);
408414
}
409415

410-
void LibUSB::findUSBDeviceInterface(USBDevice & device) {
416+
void libusb::findUSBDeviceInterface(USBDevice & device) {
411417
int ret = 0;
412418

413419
#if DEBUGGING_ON
@@ -684,9 +690,10 @@ void LibUSB::findUSBDeviceInterface(USBDevice & device) {
684690

685691
libusb_free_config_descriptor( configDescriptor ); /* free */
686692
} /* for .bNumConfigurations */
687-
688693
}
689-
void LibUSB::attachUSBDeviceInterfacesToKernelDrivers(USBDevice & device) noexcept {
694+
695+
void libusb::attachUSBDeviceInterfacesToKernelDrivers(USBDevice & device) noexcept
696+
{
690697
int ret = 0;
691698
for(auto it = device._toAttach.begin(); it != device._toAttach.end();) {
692699
int numInt = (*it);
@@ -704,7 +711,8 @@ void LibUSB::attachUSBDeviceInterfacesToKernelDrivers(USBDevice & device) noexce
704711
device._toAttach.clear();
705712
}
706713

707-
void LibUSB::detachKernelDriverFromUSBDeviceInterface(USBDevice & device, int numInt) {
714+
void libusb::detachKernelDriverFromUSBDeviceInterface(USBDevice & device, int numInt)
715+
{
708716
int ret = libusb_kernel_driver_active(device._pUSBDeviceHandle, numInt);
709717
if( ret < 0 ) {
710718
this->USBError(ret);

src/bin/daemon/libUSB.hpp renamed to src/bin/daemon/libusb.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131
namespace GLogiK
3232
{
3333

34-
class LibUSB
34+
class libusb
3535
{
3636
public:
3737

3838
protected:
39-
LibUSB(void);
40-
~LibUSB(void);
39+
libusb(void);
40+
~libusb(void);
4141

4242
void openUSBDevice(USBDevice & device);
4343
void closeUSBDevice(USBDevice & device) noexcept;

tools/vim.project

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ GLogiK=$PWD/.. CD=. {
128128
LCDScreenPluginsManager.hpp
129129
hidapi.cpp
130130
hidapi.hpp
131-
libUSB.cpp
132-
libUSB.hpp
131+
libusb.cpp
132+
libusb.hpp
133133
logitechG510.cpp
134134
logitechG510.hpp
135135
macrosManager.cpp

0 commit comments

Comments
 (0)