Make the option -DWITH_USBIDS more visible for packagers.

Look for installed usb.ids file, if not found, default to the one provided in source.
usb.ids file has been updated to Version 2021.03.31

Signed-off-by: gregory guy <gregory-tde@laposte.net>
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 1389e29696)
r14.0.x
gregory guy 3 years ago committed by Slávek Banko
parent 865e107718
commit 9bdd3a0e47
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -24,6 +24,27 @@ find_package( TQt )
find_package( TDE )
##### look for the usb.ids file, Its location can be set EG: -DWITH_USBIDS="/opt/share/misc/usb.ids"
if( WITH_USBIDS )
set( USBIDS_FILE "${WITH_USBIDS}" )
message( STATUS "Using specified usb.ids file: ${USBIDS_FILE}" )
else()
find_file( PATH_USBIDS usb.ids
HINTS /usr/share/misc
/var/lib/usbutils
/usr/share/hwdata
)
if( PATH_USBIDS )
set( USBIDS_FILE "${PATH_USBIDS}" )
message( STATUS "Using system usb.ids file: ${PATH_USBIDS}" )
else()
set( USE_BUILTIN_USBIDS 1 )
message( STATUS "File usb.ids (hwdata) was not found on the system, using builtin" )
endif()
endif( WITH_USBIDS )
##### check for libdl ###########################
set( DL_LIBRARIES dl )

@ -7,6 +7,9 @@
significant byte first (like Motorola and SPARC, unlike Intel). */
#cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@
/* Define the path for the usb.ids file */
#define USBIDS_FILE "@USBIDS_FILE@"
// Defined if compiler supports long long type.
#cmakedefine HAVE_LONG_LONG 1

@ -28,11 +28,12 @@ tde_create_translated_desktop(
PO_DIR kcontrol-desktops
)
if( WITH_USBIDS )
set_property( SOURCE usbdb.cpp APPEND PROPERTY COMPILE_DEFINITIONS USBIDS_FILE="${WITH_USBIDS}" )
else( )
install( FILES usb.ids DESTINATION ${DATA_INSTALL_DIR} )
endif( )
if( USE_BUILTIN_USBIDS )
install(
FILES usb.ids
DESTINATION ${DATA_INSTALL_DIR}
)
endif( USE_BUILTIN_USBIDS )
##### kcm_usb (module) ##########################

File diff suppressed because it is too large Load Diff

@ -22,16 +22,13 @@
#include "usbdb.h"
USBDB::USBDB()
{
#ifndef USBIDS_FILE
TQString db = "/usr/share/hwdata/usb.ids"; /* on Fedora */
if (!TQFile::exists(db))
db = locate("data", "kcmusb/usb.ids");
#else
TQString db = USBIDS_FILE;
#endif
if (!TQFile::exists(db))
TQString db = locate("data", "kcmusb/usb.ids");
if (db.isEmpty())
return;

Loading…
Cancel
Save