Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add model option to ssu, add -s (short) output for scripts to some op…
…tions
  • Loading branch information
Bernd Wachter committed Apr 10, 2013
1 parent 2f09bbf commit 0edb1e4
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
32 changes: 29 additions & 3 deletions rndssucli/rndssucli.cpp
Expand Up @@ -42,7 +42,10 @@ void RndSsuCli::handleResponse(){
void RndSsuCli::optFlavour(QStringList opt){
QTextStream qout(stdout);

if (opt.count() == 3){
if (opt.count() == 3 && opt.at(2) == "-s"){
qout << ssu.flavour();
state = Idle;
} else if (opt.count() == 3){
qout << "Changing flavour from " << ssu.flavour()
<< " to " << opt.at(2) << endl;
ssu.setFlavour(opt.at(2));
Expand Down Expand Up @@ -83,6 +86,9 @@ void RndSsuCli::optMode(QStringList opt){
(deviceMode & Ssu::ReleaseMode) == Ssu::ReleaseMode)
qout << "Both Release and RnD mode set, device is in RnD mode" << endl;

state = Idle;
} else if (opt.count() == 3 && opt.at(2) == "-s"){
qout << ssu.deviceMode();
state = Idle;
} else if (opt.count() == 3){
qout << "Setting device mode from " << ssu.deviceMode()
Expand All @@ -97,6 +103,19 @@ void RndSsuCli::optMode(QStringList opt){
}
}

void RndSsuCli::optModel(QStringList opt){
QTextStream qout(stdout);
SsuDeviceInfo deviceInfo;

if (opt.count() == 3 && opt.at(2) == "-s"){
qout << deviceInfo.deviceModel();
state = Idle;
} else if (opt.count() == 2){
qout << "Device model is: " << deviceInfo.deviceModel() << endl;
state = Idle;
}
}

void RndSsuCli::optModifyRepo(int action, QStringList opt){
SsuRepoManager repoManager;
QTextStream qout(stdout);
Expand Down Expand Up @@ -375,10 +394,14 @@ void RndSsuCli::optStatus(){
*/
qout << "Device registration status: "
<< (ssu.isRegistered() ? "registered" : "not registered") << endl;
qout << "Device family: " << deviceInfo.deviceFamily() << endl;
qout << "Device model: " << deviceInfo.deviceModel() << endl;
qout << "Device variant: " << deviceInfo.deviceVariant() << endl;
if (deviceInfo.deviceVariant() != "")
qout << "Device variant: " << deviceInfo.deviceVariant() << endl;
qout << "Device UID: " << deviceInfo.deviceUid() << endl;
if ((ssu.deviceMode() & Ssu::RndMode) == Ssu::RndMode)
qout << "Release (rnd): " << ssu.release(true) << " (" << ssu.flavour() << ")" << endl;
else
qout << "Release: " << ssu.release() << endl;
}

void RndSsuCli::optUpdateCredentials(QStringList opt){
Expand Down Expand Up @@ -456,6 +479,8 @@ void RndSsuCli::run(){
optFlavour(arguments);
else if (arguments.at(1) == "mode" || arguments.at(1) == "m")
optMode(arguments);
else if (arguments.at(1) == "model" || arguments.at(1) == "mo")
optModel(arguments);
else if (arguments.at(1) == "release" || arguments.at(1) == "re")
optRelease(arguments);
else if (arguments.at(1) == "update" || arguments.at(1) == "up")
Expand Down Expand Up @@ -510,6 +535,7 @@ void RndSsuCli::usage(){
<< "\tregister, r \tregister this device" << endl
<< "\tupdate, up \tupdate repository credentials" << endl
<< "\t [-f] \tforce update" << endl
<< "\tmodel, mo \tprint name of device model (like N9)" << endl
<< endl;
qout.flush();
QCoreApplication::exit(1);
Expand Down
1 change: 1 addition & 0 deletions rndssucli/rndssucli.h
Expand Up @@ -32,6 +32,7 @@ class RndSsuCli: public QObject {
void uidWarning(QString message="");
void optFlavour(QStringList opt);
void optMode(QStringList opt);
void optModel(QStringList opt);
void optModifyRepo(int action, QStringList opt);
void optRegister();
void optRelease(QStringList opt);
Expand Down
3 changes: 3 additions & 0 deletions rpm/ssu.changes
@@ -1,3 +1,6 @@
* Wed Apr 10 2013 Bernd Wachter <bernd.wachter@jollamobile.com> - 0.31.5
- Add model option to ssu, add -s (short) output for scripts to some options

* Wed Apr 10 2013 Bernd Wachter <bernd.wachter@jollamobile.com> - 0.31.4
- Allow arbitrary argument order for ssu ar

Expand Down
2 changes: 1 addition & 1 deletion rpm/ssu.spec
@@ -1,5 +1,5 @@
Name: ssu
Version: 0.31.4
Version: 0.31.5
Release: 1
Summary: SSU enabler for RND
Group: System/Base
Expand Down

0 comments on commit 0edb1e4

Please sign in to comment.