Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
mhwd
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
30
Issues
30
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
2
Merge Requests
2
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Applications
mhwd
Commits
11a33d4d
Commit
11a33d4d
authored
May 14, 2015
by
Filipe Marques
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/development'
parents
6517c1bd
9a822c85
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
402 additions
and
402 deletions
+402
-402
src/CMakeLists.txt
src/CMakeLists.txt
+8
-8
src/Config.cpp
src/Config.cpp
+1
-1
src/ConsoleWriter.cpp
src/ConsoleWriter.cpp
+45
-45
src/ConsoleWriter.hpp
src/ConsoleWriter.hpp
+1
-1
src/Data.cpp
src/Data.cpp
+18
-18
src/Mhwd.cpp
src/Mhwd.cpp
+314
-314
src/Mhwd.hpp
src/Mhwd.hpp
+7
-7
src/Transaction.hpp
src/Transaction.hpp
+2
-2
src/main.cpp
src/main.cpp
+6
-6
No files found.
src/CMakeLists.txt
View file @
11a33d4d
...
...
@@ -5,22 +5,22 @@ include_directories(. ${mhwd_SOURCE_DIR}/libmhwd)
###
set
(
HEADERS
Config.hpp
Data
.hpp
Device
.hpp
Enums
.hpp
Mhwd
.hpp
Printer
.hpp
Transaction.hpp
Config.hpp
ConsoleWriter
.hpp
Data
.hpp
Device
.hpp
Enums
.hpp
Mhwd
.hpp
Transaction.hpp
)
set
(
SOURCES
Config.cpp
ConsoleWriter.cpp
Data.cpp
Device.cpp
main.cpp
Mhwd.cpp
Printer.cpp
Transaction.cpp
)
...
...
src/Config.cpp
View file @
11a33d4d
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
...
...
src/
Prin
ter.cpp
→
src/
ConsoleWri
ter.cpp
View file @
11a33d4d
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
...
...
@@ -22,7 +22,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "
Prin
ter.hpp"
#include "
ConsoleWri
ter.hpp"
#include <hd.h>
...
...
@@ -32,56 +32,56 @@
#include <string>
#include <vector>
void
Prin
ter
::
printStatus
(
std
::
string
statusMsg
)
const
void
ConsoleWri
ter
::
printStatus
(
std
::
string
statusMsg
)
const
{
std
::
cout
<<
CONSOLE_RED_MESSAGE_COLOR
<<
"> "
<<
CONSOLE_COLOR_RESET
<<
statusMsg
<<
std
::
endl
;
}
void
Prin
ter
::
printError
(
std
::
string
errorMsg
)
const
void
ConsoleWri
ter
::
printError
(
std
::
string
errorMsg
)
const
{
std
::
cout
<<
CONSOLE_RED_MESSAGE_COLOR
<<
"Error: "
<<
CONSOLE_COLOR_RESET
<<
errorMsg
<<
std
::
endl
;
}
void
Prin
ter
::
printWarning
(
std
::
string
warningMsg
)
const
void
ConsoleWri
ter
::
printWarning
(
std
::
string
warningMsg
)
const
{
std
::
cout
<<
CONSOLE_RED_MESSAGE_COLOR
<<
"Warning: "
<<
CONSOLE_COLOR_RESET
<<
warningMsg
<<
std
::
endl
;
}
void
Prin
ter
::
printMessage
(
MHWD
::
MESSAGETYPE
type
,
std
::
string
msg
)
const
void
ConsoleWri
ter
::
printMessage
(
MHWD
::
MESSAGETYPE
type
,
std
::
string
msg
)
const
{
switch
(
type
)
{
case
MHWD
::
MESSAGETYPE
::
CONSOLE_OUTPUT
:
std
::
cout
<<
CONSOLE_TEXT_OUTPUT_COLOR
<<
msg
<<
CONSOLE_COLOR_RESET
;
break
;
case
MHWD
::
MESSAGETYPE
::
INSTALLDEPENDENCY_START
:
printStatus
(
"Installing dependency "
+
msg
+
"..."
);
break
;
case
MHWD
::
MESSAGETYPE
::
INSTALLDEPENDENCY_END
:
printStatus
(
"Successfully installed dependency "
+
msg
);
break
;
case
MHWD
::
MESSAGETYPE
::
INSTALL_START
:
printStatus
(
"Installing "
+
msg
+
"..."
);
break
;
case
MHWD
::
MESSAGETYPE
::
INSTALL_END
:
printStatus
(
"Successfully installed "
+
msg
);
break
;
case
MHWD
::
MESSAGETYPE
::
REMOVE_START
:
printStatus
(
"Removing "
+
msg
+
"..."
);
break
;
case
MHWD
::
MESSAGETYPE
::
REMOVE_END
:
printStatus
(
"Successfully removed "
+
msg
);
break
;
default:
printError
(
"You shouldn't see this?! Unknown message type!"
);
break
;
}
switch
(
type
)
{
case
MHWD
::
MESSAGETYPE
::
CONSOLE_OUTPUT
:
std
::
cout
<<
CONSOLE_TEXT_OUTPUT_COLOR
<<
msg
<<
CONSOLE_COLOR_RESET
;
break
;
case
MHWD
::
MESSAGETYPE
::
INSTALLDEPENDENCY_START
:
printStatus
(
"Installing dependency "
+
msg
+
"..."
);
break
;
case
MHWD
::
MESSAGETYPE
::
INSTALLDEPENDENCY_END
:
printStatus
(
"Successfully installed dependency "
+
msg
);
break
;
case
MHWD
::
MESSAGETYPE
::
INSTALL_START
:
printStatus
(
"Installing "
+
msg
+
"..."
);
break
;
case
MHWD
::
MESSAGETYPE
::
INSTALL_END
:
printStatus
(
"Successfully installed "
+
msg
);
break
;
case
MHWD
::
MESSAGETYPE
::
REMOVE_START
:
printStatus
(
"Removing "
+
msg
+
"..."
);
break
;
case
MHWD
::
MESSAGETYPE
::
REMOVE_END
:
printStatus
(
"Successfully removed "
+
msg
);
break
;
default:
printError
(
"You shouldn't see this?! Unknown message type!"
);
break
;
}
}
void
Prin
ter
::
printHelp
()
const
void
ConsoleWri
ter
::
printHelp
()
const
{
std
::
cout
<<
"Usage: mhwd [OPTIONS] <config(s)>
\n\n
"
<<
" --pci
\t\t\t\t\t
list only pci devices and driver configs
\n
"
...
...
@@ -103,16 +103,16 @@ void Printer::printHelp() const
<<
" --pmroot <path>
\t\t\t
set package manager root
\n
"
<<
std
::
endl
;
}
void
Prin
ter
::
printVersion
(
std
::
string
versionMhwd
,
std
::
string
yearCopy
)
const
void
ConsoleWri
ter
::
printVersion
(
std
::
string
versionMhwd
,
std
::
string
yearCopy
)
const
{
std
::
cout
<<
"Manjaro Hardware Detection v"
<<
versionMhwd
<<
"
\n\n
"
std
::
cout
<<
"Manjaro Hardware Detection v"
<<
versionMhwd
<<
"
\n\n
"
<<
"Copyright (C) "
<<
yearCopy
<<
" Manjaro Linux Developers
\n
"
<<
"This is free software licensed under GNU GPL v3.0
\n
"
<<
"FITNESS FOR A PARTICULAR PURPOSE.
\n
"
<<
"FITNESS FOR A PARTICULAR PURPOSE.
\n
"
<<
std
::
endl
;
}
void
Prin
ter
::
listDevices
(
const
std
::
vector
<
std
::
shared_ptr
<
Device
>>&
devices
,
std
::
string
type
)
const
void
ConsoleWri
ter
::
listDevices
(
const
std
::
vector
<
std
::
shared_ptr
<
Device
>>&
devices
,
std
::
string
type
)
const
{
if
(
devices
.
empty
())
{
...
...
@@ -142,7 +142,7 @@ void Printer::listDevices(const std::vector<std::shared_ptr<Device>>& devices, s
}
}
void
Prin
ter
::
listConfigs
(
const
std
::
vector
<
std
::
shared_ptr
<
Config
>>&
configs
,
std
::
string
header
)
const
void
ConsoleWri
ter
::
listConfigs
(
const
std
::
vector
<
std
::
shared_ptr
<
Config
>>&
configs
,
std
::
string
header
)
const
{
printStatus
(
header
);
printLine
();
...
...
@@ -161,7 +161,7 @@ void Printer::listConfigs(const std::vector<std::shared_ptr<Config>>& configs, s
std
::
cout
<<
std
::
endl
<<
std
::
endl
;
}
void
Prin
ter
::
printAvailableConfigsInDetail
(
const
std
::
string
&
deviceType
,
void
ConsoleWri
ter
::
printAvailableConfigsInDetail
(
const
std
::
string
&
deviceType
,
const
std
::
vector
<
std
::
shared_ptr
<
Device
>>&
devices
)
const
{
bool
configFound
=
false
;
...
...
@@ -211,7 +211,7 @@ void Printer::printAvailableConfigsInDetail(const std::string& deviceType,
}
}
void
Prin
ter
::
printInstalledConfigs
(
const
std
::
string
&
deviceType
,
void
ConsoleWri
ter
::
printInstalledConfigs
(
const
std
::
string
&
deviceType
,
const
std
::
vector
<
std
::
shared_ptr
<
Config
>>&
installedConfigs
)
const
{
if
(
installedConfigs
.
empty
())
...
...
@@ -228,7 +228,7 @@ void Printer::printInstalledConfigs(const std::string& deviceType,
}
}
void
Prin
ter
::
printConfigDetails
(
const
Config
&
config
)
const
void
ConsoleWri
ter
::
printConfigDetails
(
const
Config
&
config
)
const
{
std
::
string
classids
;
std
::
string
vendorids
;
...
...
@@ -267,12 +267,12 @@ void Printer::printConfigDetails(const Config& config) const
<<
"
\n
VENDORIDS:
\t
"
<<
vendorids
<<
"
\n
"
<<
std
::
endl
;
}
void
Prin
ter
::
printLine
()
const
void
ConsoleWri
ter
::
printLine
()
const
{
std
::
cout
<<
std
::
s
etfill
(
'-'
)
<<
std
::
setw
(
80
)
<<
"-"
<<
std
::
setfill
(
'
'
)
<<
std
::
endl
;
std
::
cout
<<
std
::
s
tring
(
80
,
'-
'
)
<<
std
::
endl
;
}
void
Prin
ter
::
printDeviceDetails
(
hw_item
hw
,
FILE
*
f
)
const
void
ConsoleWri
ter
::
printDeviceDetails
(
hw_item
hw
,
FILE
*
f
)
const
{
std
::
unique_ptr
<
hd_data_t
>
hd_data
{
new
hd_data_t
()};
hd_t
*
hd
=
hd_list
(
hd_data
.
get
(),
hw
,
1
,
nullptr
);
...
...
src/
Prin
ter.hpp
→
src/
ConsoleWri
ter.hpp
View file @
11a33d4d
...
...
@@ -34,7 +34,7 @@
#include "Device.hpp"
#include "Enums.hpp"
class
Prin
ter
class
ConsoleWri
ter
{
public:
void
printStatus
(
std
::
string
statusMsg
)
const
;
...
...
src/Data.cpp
View file @
11a33d4d
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
...
...
@@ -131,8 +131,8 @@ void Data::getAllDevicesOfConfig(const std::vector<std::shared_ptr<Device>>& dev
{
// Check class ids
bool
found
=
std
::
find_if
(
hwdID
->
classIDs
.
begin
(),
hwdID
->
classIDs
.
end
(),
[
i_device
](
const
std
::
string
&
classID
){
return
((
"*"
==
classID
)
||
(
classID
==
(
*
i_device
)
->
classID_
));
})
!=
hwdID
->
classIDs
.
end
();
return
((
"*"
==
classID
)
||
(
classID
==
(
*
i_device
)
->
classID_
));
})
!=
hwdID
->
classIDs
.
end
();
if
(
!
found
)
{
...
...
@@ -142,8 +142,8 @@ void Data::getAllDevicesOfConfig(const std::vector<std::shared_ptr<Device>>& dev
{
// Check blacklisted class ids
found
=
std
::
find_if
(
hwdID
->
blacklistedClassIDs
.
begin
(),
hwdID
->
blacklistedClassIDs
.
end
(),
[
i_device
](
const
std
::
string
&
blacklistedClassID
){
return
(
blacklistedClassID
==
(
*
i_device
)
->
classID_
);
})
!=
hwdID
->
blacklistedClassIDs
.
end
();
return
(
blacklistedClassID
==
(
*
i_device
)
->
classID_
);
})
!=
hwdID
->
blacklistedClassIDs
.
end
();
if
(
found
)
{
...
...
@@ -152,9 +152,9 @@ void Data::getAllDevicesOfConfig(const std::vector<std::shared_ptr<Device>>& dev
else
{
// Check vendor ids
found
=
std
::
find_if
(
hwdID
->
vendorIDs
.
begin
(),
hwdID
->
vendorIDs
.
end
(),
[
i_device
](
const
std
::
string
&
vendorID
){
return
((
"*"
==
vendorID
)
||
(
vendorID
==
(
*
i_device
)
->
vendorID_
));
})
!=
hwdID
->
vendorIDs
.
end
();
found
=
std
::
find_if
(
hwdID
->
vendorIDs
.
begin
(),
hwdID
->
vendorIDs
.
end
(),
[
i_device
](
const
std
::
string
&
vendorID
){
return
((
"*"
==
vendorID
)
||
(
vendorID
==
(
*
i_device
)
->
vendorID_
));
})
!=
hwdID
->
vendorIDs
.
end
();
if
(
!
found
)
{
...
...
@@ -164,8 +164,8 @@ void Data::getAllDevicesOfConfig(const std::vector<std::shared_ptr<Device>>& dev
{
// Check blacklisted vendor ids
found
=
std
::
find_if
(
hwdID
->
blacklistedVendorIDs
.
begin
(),
hwdID
->
blacklistedVendorIDs
.
end
(),
[
i_device
](
const
std
::
string
&
blacklistedVendorID
){
return
(
blacklistedVendorID
==
(
*
i_device
)
->
vendorID_
);
})
!=
hwdID
->
blacklistedVendorIDs
.
end
();
return
(
blacklistedVendorID
==
(
*
i_device
)
->
vendorID_
);
})
!=
hwdID
->
blacklistedVendorIDs
.
end
();
if
(
found
)
{
...
...
@@ -174,9 +174,9 @@ void Data::getAllDevicesOfConfig(const std::vector<std::shared_ptr<Device>>& dev
else
{
// Check device ids
found
=
std
::
find_if
(
hwdID
->
deviceIDs
.
begin
(),
hwdID
->
deviceIDs
.
end
(),
[
i_device
](
const
std
::
string
&
deviceID
){
return
((
"*"
==
deviceID
)
||
(
deviceID
==
(
*
i_device
)
->
deviceID_
));
})
!=
hwdID
->
deviceIDs
.
end
();
found
=
std
::
find_if
(
hwdID
->
deviceIDs
.
begin
(),
hwdID
->
deviceIDs
.
end
(),
[
i_device
](
const
std
::
string
&
deviceID
){
return
((
"*"
==
deviceID
)
||
(
deviceID
==
(
*
i_device
)
->
deviceID_
));
})
!=
hwdID
->
deviceIDs
.
end
();
if
(
!
found
)
{
...
...
@@ -186,8 +186,8 @@ void Data::getAllDevicesOfConfig(const std::vector<std::shared_ptr<Device>>& dev
{
// Check blacklisted device ids
found
=
std
::
find_if
(
hwdID
->
blacklistedDeviceIDs
.
begin
(),
hwdID
->
blacklistedDeviceIDs
.
end
(),
[
i_device
](
const
std
::
string
&
blacklistedDeviceID
){
return
(
blacklistedDeviceID
==
(
*
i_device
)
->
deviceID_
);
})
!=
hwdID
->
blacklistedDeviceIDs
.
end
();
return
(
blacklistedDeviceID
==
(
*
i_device
)
->
deviceID_
);
})
!=
hwdID
->
blacklistedDeviceIDs
.
end
();
if
(
found
)
{
continue
;
...
...
@@ -265,7 +265,7 @@ void Data::getAllDependenciesToInstall(std::shared_ptr<Config> config,
{
// Add to vector and check for further subdepends...
std
::
shared_ptr
<
Config
>
dependconfig
{
getDatabaseConfig
((
*
configDependency
),
config
->
type_
)};
getDatabaseConfig
((
*
configDependency
),
config
->
type_
)};
if
(
nullptr
==
dependconfig
)
{
continue
;
...
...
@@ -596,7 +596,7 @@ void Data::setMatchingConfigs(const std::vector<std::shared_ptr<Device>>& device
}
void
Data
::
setMatchingConfig
(
std
::
shared_ptr
<
Config
>
config
,
const
std
::
vector
<
std
::
shared_ptr
<
Device
>>&
devices
,
bool
setAsInstalled
)
const
std
::
vector
<
std
::
shared_ptr
<
Device
>>&
devices
,
bool
setAsInstalled
)
{
std
::
vector
<
std
::
shared_ptr
<
Device
>>
foundDevices
;
...
...
@@ -618,7 +618,7 @@ void Data::setMatchingConfig(std::shared_ptr<Config> config,
}
void
Data
::
addConfigSorted
(
std
::
vector
<
std
::
shared_ptr
<
Config
>>&
configs
,
std
::
shared_ptr
<
Config
>
config
)
std
::
shared_ptr
<
Config
>
config
)
{
for
(
auto
&&
iterator
=
configs
.
begin
();
iterator
!=
configs
.
end
();
iterator
++
)
...
...
src/Mhwd.cpp
View file @
11a33d4d
This diff is collapsed.
Click to expand it.
src/Mhwd.hpp
View file @
11a33d4d
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
...
...
@@ -38,10 +38,10 @@
#include "Config.hpp"
#include "const.h"
#include "ConsoleWriter.hpp"
#include "Data.hpp"
#include "Device.hpp"
#include "Enums.hpp"
#include "Printer.hpp"
#include "vita/string.hpp"
#include "Transaction.hpp"
...
...
@@ -71,10 +71,10 @@ private:
}
arguments_
;
std
::
shared_ptr
<
Config
>
config_
;
Data
data_
;
Printer
prin
ter_
;
ConsoleWriter
consoleWri
ter_
;
std
::
vector
<
std
::
string
>
configs_
;
std
::
string
version_
,
year_
;
bool
performTransaction
(
std
::
shared_ptr
<
Config
>
config
,
MHWD
::
TRANSACTIONTYPE
type
);
bool
isUserRoot
()
const
;
std
::
vector
<
std
::
string
>
checkEnvironment
()
const
;
...
...
@@ -99,9 +99,9 @@ private:
MHWD
::
STATUS
installConfig
(
std
::
shared_ptr
<
Config
>
config
);
MHWD
::
STATUS
uninstallConfig
(
Config
*
config
);
bool
runScript
(
std
::
shared_ptr
<
Config
>
config
,
MHWD
::
TRANSACTIONTYPE
operationType
);
void
tryToParseCmdLineOptions
(
int
argc
,
char
*
argv
[],
bool
&
autoConfigureNonFreeDriver
,
std
::
string
&
operationType
,
std
::
string
&
autoConfigureClassID
);
bool
optionsDontInterfereWithEachOther
()
const
;
void
tryToParseCmdLineOptions
(
int
argc
,
char
*
argv
[],
bool
&
autoConfigureNonFreeDriver
,
std
::
string
&
operationType
,
std
::
string
&
autoConfigureClassID
);
bool
optionsDontInterfereWithEachOther
()
const
;
};
#endif
/* MHWD_HPP_ */
src/Transaction.hpp
View file @
11a33d4d
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
...
...
@@ -36,7 +36,7 @@ class Transaction
public:
Transaction
()
=
delete
;
Transaction
(
Data
data
,
std
::
shared_ptr
<
Config
>
config
,
MHWD
::
TRANSACTIONTYPE
type
,
bool
allowReinstallation
);
bool
allowReinstallation
);
bool
isAllowedToReinstall
()
const
;
std
::
shared_ptr
<
Config
>
config_
;
...
...
src/main.cpp
View file @
11a33d4d
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
...
...
@@ -30,13 +30,13 @@ int main(int argc, char *argv[])
{
try
{
Mhwd
mhwd
;
mhwd
.
setVersionMhwd
(
"0.5.4
"
,
"2012-2015"
);
return
mhwd
.
launch
(
argc
,
argv
);
Mhwd
mhwd
;
mhwd
.
setVersionMhwd
(
"0.5.5
"
,
"2012-2015"
);
return
mhwd
.
launch
(
argc
,
argv
);
}
catch
(...)
{
std
::
cerr
<<
"Unknown errors occured..."
;
return
-
1
;
std
::
cerr
<<
"Unknown errors occured..."
;
return
-
1
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment