YaST Commits
Threads by month
- ----- 2025 -----
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
October 2011
- 25 participants
- 461 discussions
![](https://seccdn.libravatar.org/avatar/1221572c74a1df78a3aa2625b979eb21.jpg?s=120&d=mm&r=g)
11 Oct '11
Author: gs
Date: Tue Oct 11 13:11:11 2011
New Revision: 66381
URL: http://svn.opensuse.org/viewcvs/yast?rev=66381&view=rev
Log:
Created tag stable-2_21_9 for fcoe-client
Added:
tags/stable-2_21_9/fcoe-client/
- copied from r66380, trunk/fcoe-client/
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
![](https://seccdn.libravatar.org/avatar/1221572c74a1df78a3aa2625b979eb21.jpg?s=120&d=mm&r=g)
[yast-commit] r66380 - in /trunk/fcoe-client: ./ agents/ package/ src/
by gs@svn2.opensuse.org 11 Oct '11
by gs@svn2.opensuse.org 11 Oct '11
11 Oct '11
Author: gs
Date: Tue Oct 11 13:09:59 2011
New Revision: 66380
URL: http://svn.opensuse.org/viewcvs/yast?rev=66380&view=rev
Log:
use ini agent, write sysconfig for underlying
interface, destroy FCoE before removing
Added:
trunk/fcoe-client/agents/fcoe_cfg-ethx.scr
Modified:
trunk/fcoe-client/VERSION
trunk/fcoe-client/agents/fcoe_config.scr
trunk/fcoe-client/package/yast2-fcoe-client.changes
trunk/fcoe-client/src/FcoeClient.ycp
trunk/fcoe-client/src/complex.ycp
trunk/fcoe-client/src/dialogs.ycp
trunk/fcoe-client/src/fcoe-client_auto.ycp
trunk/fcoe-client/src/fcoe-client_finish.ycp
trunk/fcoe-client/src/inst_fcoe-client.ycp
trunk/fcoe-client/src/wizards.ycp
Modified: trunk/fcoe-client/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/VERSION?rev=66380&r1…
==============================================================================
--- trunk/fcoe-client/VERSION (original)
+++ trunk/fcoe-client/VERSION Tue Oct 11 13:09:59 2011
@@ -1 +1 @@
-2.21.8
+2.21.9
Added: trunk/fcoe-client/agents/fcoe_cfg-ethx.scr
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/agents/fcoe_cfg-ethx…
==============================================================================
--- trunk/fcoe-client/agents/fcoe_cfg-ethx.scr (added)
+++ trunk/fcoe-client/agents/fcoe_cfg-ethx.scr Tue Oct 11 13:09:59 2011
@@ -0,0 +1,39 @@
+/**
+ * File: fcoe_cfg-ethx.scr
+ * Summary: Agent for /etc/fcoe/cfg-*
+ * Access: read / write
+ * See: sysconfig.rpm
+ *
+ * General syntax:
+ * # comment0
+ * VAR1=val1 # comment1
+ * VAR2="val 2 #blah" # comment2
+ * VAR3='val3 x #blah2' # comment3
+ *
+ *
+ * <p>Reads/writes <tt>/etc/fcoe/cfg-*</tt>.
+ */
+.fcoe.cfg-ethx
+
+`ag_ini(
+ `IniAgent( [ "/etc/fcoe/cfg-*" ],
+ $[
+ /* values at the top level, allow comments after value */
+ "options" : [ "global_values", "comments_last" ],
+ /* empty lines, comments after value and whole-line comments */
+ "comments" : [ "^[ \t]*$", "[ \t]*#.*$", "^[ \t]*#.*$" ],
+ /* matching rules */
+ "params" : [
+ /* VAR1="val1 'bal x" */
+ $[ "match" : [ "^[ \t]*([a-zA-Z_][a-zA-Z0-9_]*)=\"([^\"`\\$]*)\"", "%s='%s'" ] ],
+ /* VAR1='val1 xxx" xx' */
+ $[ "match" : [ "^[ \t]*([a-zA-Z_][a-zA-Z0-9_]*)='([^']*)'", "%s='%s'" ] ],
+ /* VAR1=val1 */
+ $[ "match" : [ "^[ \t]*([a-zA-Z_][a-zA-Z0-9_]*)=([^ \t\"$`'\\#]*)", "%s='%s'" ] ],
+ ],
+ /* matching rules */
+ "rewrite" : [
+ [ "/etc/fcoe/cfg-(.*)", "/etc/fcoe/cfg-%s" ],
+ ],
+ ]
+))
Modified: trunk/fcoe-client/agents/fcoe_config.scr
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/agents/fcoe_config.s…
==============================================================================
--- trunk/fcoe-client/agents/fcoe_config.scr (original)
+++ trunk/fcoe-client/agents/fcoe_config.scr Tue Oct 11 13:09:59 2011
@@ -3,26 +3,23 @@
* fcoe_config.scr
* Summary:
* SCR Agent for reading/writing /etc/fcoe/config
- * using the ini-agent
+ * using the sysconfig agent
* Access:
* read/write
* Authors:
* Gabriele Mohr <gs(a)suse.de>
- * See:
- * yast2-agent-ini/ini.html
- * libscr
* Example:
* Read(.fcoe.config.USE_SYSLOG)
* ("yes")
**
- * Write(.fcoe.cfg-ethx.USE_SYSLOG, "no")
+ * Write(.fcoe.config.USE_SYSLOG, "no")
* (true)
*
*
* Read/Sets the values defined in <tt>/etc/fcoe/config</tt>
* in an easy manner.
*/
-.fcoe
+.fcoe.config
`ag_ini(
`SysConfigFile("/etc/fcoe/config")
Modified: trunk/fcoe-client/package/yast2-fcoe-client.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/package/yast2-fcoe-c…
==============================================================================
--- trunk/fcoe-client/package/yast2-fcoe-client.changes (original)
+++ trunk/fcoe-client/package/yast2-fcoe-client.changes Tue Oct 11 13:09:59 2011
@@ -1,4 +1,13 @@
-------------------------------------------------------------------
+Tue Oct 11 13:04:16 CEST 2011 - gs(a)suse.de
+
+- Use ini agent to write /etc/fcoe/cfg-ethx files,
+ write /etc/sysconfig/network/ifcfg-file for underlying interface
+ (bnc #705610),
+ destroy FCoE interface before removing it (bnc #719443)
+- V 2.21.9
+
+-------------------------------------------------------------------
Thu Sep 29 10:13:01 CEST 2011 - visnov(a)suse.cz
- set dialog title
Modified: trunk/fcoe-client/src/FcoeClient.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/FcoeClient.ycp?r…
==============================================================================
--- trunk/fcoe-client/src/FcoeClient.ycp (original)
+++ trunk/fcoe-client/src/FcoeClient.ycp Tue Oct 11 13:09:59 2011
@@ -45,6 +45,7 @@
import "Service";
import "NetworkService";
import "String";
+import "FileUtils";
/**
* Prototypes
@@ -117,7 +118,7 @@
}
/**
- * Set write_only flag (for autoinstalation).
+ * Set write_only flag (for autoinstallation).
*/
global void SetWriteOnly(boolean value) {
write_only = value;
@@ -167,7 +168,6 @@
global boolean lldpad_started = false; // service fcoe was started
global boolean fcoe_started = false; // service lldpad was started
-global string ifcfg_file = "";
// Settings: Define all variables needed for configuration of fcoe-client
@@ -359,12 +359,12 @@
// if AUTO_VLAN is set to "yes"
if ( netcard["auto_vlan"]:"no" == "yes" )
{
- // set file name to cfg-<interface>, e.g. /etc/fcoe/eth3
+ // set file name to cfg-<interface>, e.g. /etc/fcoe/cfg-eth3
file_name = sformat( "/etc/fcoe/cfg-%1", netcard["dev_name"]:"" );
}
else
{
- // set file name to cfg-<vlan_device_name>, e.g. /etc/fcoe/eth3.200
+ // set file name to cfg-<vlan_device_name>, e.g. /etc/fcoe/cfg-eth3.200
file_name = sformat( "/etc/fcoe/cfg-%1", vlan_device_name );
}
@@ -396,7 +396,7 @@
}
});
content = mergestring( lines, "\n" );
- y2milestone( "Writing content: %1", content );
+ y2milestone( "Writing content: %1 to %2", content, file_name );
file_exists = SCR::Write( .target.string, file_name, content );
@@ -418,14 +418,15 @@
//
// Get status of FCoE config from /etc/fcoe/cfg-<if>.<vlan> or /etc/fcoe/cfg-<if>
//
-global map <string, string> GetFcoeStatus( string vlan_device_name, map netcard )
+global map <string, string> GetFcoeStatus( string vlan_device_name, string device_name )
{
map <string, string> status_map = $[];
string content = "";
boolean file_exists = false;
string file_name = "";
+ string device = vlan_device_name;
- if ( vlan_device_name == "" )
+ if ( vlan_device_name == "" || device_name == "" )
{
y2error( "Interface not valid" );
return $[];
@@ -434,39 +435,36 @@
y2milestone( "VLAN channel %1 found", vlan_device_name );
file_name = sformat( "/etc/fcoe/cfg-%1", vlan_device_name );
- y2milestone( "Reading %1", file_name );
- content = (string)SCR::Read(.target.string, file_name);
- if ( content == "" || content == nil )
+ if ( !FileUtils::Exists( file_name ) )
{
- // try to read /etc/fcoe/cfg-<interface> (interface was automatically created)
- file_name = sformat( "/etc/fcoe/cfg-%1", netcard["dev_name"]:"" );
- y2milestone( "Reading %1", file_name );
- content = (string)SCR::Read(.target.string, file_name);
+ file_name = sformat( "/etc/fcoe/cfg-%1", device_name );
+
+ if ( !FileUtils::Exists( file_name ) )
+ {
+ y2warning( "Cannot read config file for %1 in /etc/fcoe", vlan_device_name );
+ Popup::Warning( sformat(_("Cannot read config file for %1"), vlan_device_name) );
+ return status_map;
+ }
+ device = device_name;
}
+ // for debugging purpose, read only needed values later
+ list values = SCR::Dir( .fcoe.cfg-ethx.value + device );
+ y2milestone( "Available values in %1: %2", file_name, values );
+
+ foreach( string var, ["FCOE_ENABLE", "DCB_REQUIRED", "AUTO_VLAN"], {
+ string value = (string)SCR::Read(.fcoe.cfg-ethx.value + device + var);
+ if ( value == nil )
+ {
+ y2warning( "Cannot read %1", var );
+ continue;
+ }
+ status_map = add( status_map, var, value );
+ });
- if ( content != "" )
- {
- list <string> lines = splitstring( content, "\n" );
- foreach( string line, (list<string>)lines, {
- line = deletechars( line, " \t" );
- foreach( string var, ["FCOE_ENABLE", "DCB_REQUIRED", "AUTO_VLAN"], {
- if ( String::StartsWith(line, var) )
- {
- status_map = add( status_map, var,
- deletechars( substring(line, size(var) + 1), "\"") );
- }
- });
+ status_map = add( status_map, "cfg_device", device );
- });
- status_map = add( status_map, "Filename", file_name );
- y2milestone( "Returning: %1", status_map );
- }
- else
- {
- y2warning( "Cannot read /etc/fcoe/%1", file_name );
- Popup::Warning( sformat(_("Cannot read /etc/fcoe/cfg-file for %1"), vlan_device_name) );
- }
+ y2milestone( "Returning: %1", status_map );
return status_map;
}
@@ -613,16 +611,12 @@
//
// dev_name device fcoe_vlan fcoe_enable dcb_required auto_vlan dcb_capable vlan_interface cfg_file
-// eth3 Ethernet card ... eth3.200 yes/no yes/no yes/no yes/no 200 /etc/fcoe/cfg-eth3.200
+// eth3 Ethernet card ... eth3.200 yes/no yes/no yes/no yes/no 200 eth3.200
//
// Detect network interface cards (hardware probe) and get status
//
global boolean DetectNetworkCards()
{
- string vlan_interface = "";
- string fcoe_vlan_interface = "";
- string dcb_capable = "";
-
list <map> netcards = (list<map>)SCR::Read(.probe.netcard);
y2milestone( "Detected netcards: %1", netcards );
@@ -652,8 +646,11 @@
map state_map = card["resource", "link", 0]:$[];
map info_map = $[];
map <string, string> status_map = $[];
-
- // only call fipvlan <interface> for configured interfaces
+ string vlan_interface = "";
+ string fcoe_vlan_interface = "";
+ string dcb_capable = "";
+
+ // only call 'fipvlan <interface>' for configured interfaces
if ( state_map["state"]:false == true )
{
vlan_interface = GetVlanInterface( card["dev_name"]:"" );
@@ -669,7 +666,7 @@
if ( fcoe_vlan_interface != "" )
{
- status_map = GetFcoeStatus( fcoe_vlan_interface, card );
+ status_map = GetFcoeStatus( fcoe_vlan_interface, card["dev_name"]:"" );
}
else
{
@@ -703,7 +700,7 @@
}
info_map = add( info_map, "dcb_capable", dcb_capable ); // DCB capable
info_map = add( info_map, "vlan_interface", vlan_interface ); // VLAN interface, e.g. 200
- info_map = add( info_map, "cfg_file", status_map["Filename"]:"" ); // cfg file name, e.g. /etc/fcoe/cfg-eth3.200
+ info_map = add( info_map, "cfg_file", status_map["cfg_device"]:"" ); // part of cfg-file name, e.g. eth3.200
network_interfaces = add( network_interfaces, info_map );
} );
@@ -719,16 +716,16 @@
//
global boolean ReadFcoeConfig()
{
- list <string> options = (list<string>) SCR::Dir(.fcoe);
+ list <string> options = (list<string>) SCR::Dir(.fcoe.config);
y2milestone( "List of options in /etc/fcoe/config: %1", options );
if ( options == [] || options == nil )
return false;
- string debug_val = (string)SCR::Read(add(.fcoe, "DEBUG"));
+ string debug_val = (string)SCR::Read(add(.fcoe.config, "DEBUG"));
fcoe_general_config = add( fcoe_general_config, "DEBUG", debug_val );
- string syslog_val = (string)SCR::Read(add(.fcoe, "USE_SYSLOG"));
+ string syslog_val = (string)SCR::Read(add(.fcoe.config, "USE_SYSLOG"));
fcoe_general_config = add( fcoe_general_config, "USE_SYSLOG", syslog_val );
y2milestone( "/etc/fcoe/config read: DEBUG: %1, USE_SYSLOG: %2", debug_val, syslog_val );
@@ -737,82 +734,104 @@
}
//
-// Write /etc/fcoe/config using SCR agent
+// Write /etc/fcoe/config using fcoe_config.scr
//
global boolean WriteFcoeConfig()
{
- boolean ret = true;
-
- boolean success = (boolean)SCR::Write(add(.fcoe, "DEBUG"), GetFcoeConfig()["DEBUG"]:"" );
+ boolean success = (boolean)SCR::Write(add(.fcoe.config, "DEBUG"), GetFcoeConfig()["DEBUG"]:"" );
if ( !success )
- ret = false;
+ return false;
- success = (boolean)SCR::Write(add(.fcoe, "USE_SYSLOG"), GetFcoeConfig()["USE_SYSLOG"]:"" );
+ success = (boolean)SCR::Write(add(.fcoe.config, "USE_SYSLOG"), GetFcoeConfig()["USE_SYSLOG"]:"" );
if ( !success )
- ret = false;
+ return false;
// This is very important- it flushes the cache, and stores the configuration on the disk
- SCR::Write(.fcoe, nil);
+ success = SCR::Write(.fcoe.config, nil);
- return ret;
+ return success;
}
//
-// Write /etc/fcoe/cfg-ethx files
+// Write ifcfg-files in /etc/sysconfig/network (for FCoE VLAN interface and underlying interface)
+// using network.scr from yast2/library/network
//
-global boolean WriteCfgFiles()
+global boolean WriteSysconfigFiles( )
{
list <map> netcards = GetNetworkCards();
boolean success = true;
- string command = "";
- map output = $[];
-
- y2milestone( "Writing /etc/fcoe/cfg-ethx files" );
+
+ foreach ( map card, (list<map>)netcards, {
+ if ( card["fcoe_vlan"]:"" != FcoeClient::NOT_AVAILABLE && // FCoE VLAN is configured
+ card["fcoe_vlan"]:"" != FcoeClient::NOT_CONFIGURED )
+ {
+ y2milestone( "Writing /etc/sysconfig/network/ifcfg-%1", card["fcoe_vlan"]:"" );
+ // write /etc/sysconfig/network/ifcfg-<fcoe-vlan-interface>, e.g. ifcfg-eth3.200
+ SCR::Write(.network.value + card["fcoe_vlan"]:"" + "BOOTPROTO", "static" );
+ SCR::Write(.network.value + card["fcoe_vlan"]:"" + "STARTMODE", "nfsroot" );
+ SCR::Write(.network.value + card["fcoe_vlan"]:"" + "ETHERDEVICE", card["dev_name"]:"" );
+ SCR::Write(.network.value + card["fcoe_vlan"]:"" + "USERCONTROL", "no" );
+ y2milestone( "Writing /etc/sysconfig/network/ifcfg-%1", card["dev_name"]:"" );
+ // write /etc/sysconfig/network/ifcfg-<interface> (underlying interface), e.g. ifcfg-eth3
+ SCR::Write(.network.value + card["dev_name"]:"" + "BOOTPROTO", "static" );
+ SCR::Write(.network.value + card["dev_name"]:"" + "STARTMODE", "nfsroot" );
+ SCR::Write(.network.value + card["dev_name"]:"" + "NAME", card["device"]:"" );
+ }
+ } );
+ // This is very important- it flushes the cache, and stores the configuration on the disk
+ success = SCR::Write( .network, nil );
+ if ( !success )
+ {
+ y2error( "Error writing /etc/sysconfig/network/ifcfg-<fcoe-interface>" );
+ }
+ return success;
+}
+
+//
+// Write /etc/fcoe/cfg-ethx files using fcoe_cfg-ethx.scr
+//
+global boolean WriteCfgFiles()
+{
+ list <map> netcards = GetNetworkCards();
+
+ boolean success = false;
foreach ( map card, (list<map>)netcards, {
if ( card["fcoe_vlan"]:"" != FcoeClient::NOT_AVAILABLE && // FCoE VLAN is configured
- card["fcoe_vlan"]:"" != FcoeClient::NOT_CONFIGURED && Modified() ) // and data are modified
+ card["fcoe_vlan"]:"" != FcoeClient::NOT_CONFIGURED )
{
- string content = (string)SCR::Read( .target.string, card["cfg_file"]:"" );
- y2debug( "Original content of %1: %2", card["cfg_file"]:"", content );
-
- list <string> lines = (list<string>)splitstring( content, "\n" );
- lines = maplist( string line, lines, {
- if ( !String::StartsWith( line, "#" ) ) line = deletechars( line, " \t" );
-
- if ( String::StartsWith( line, "FCOE_ENABLE" ) )
- {
- return sformat( "FCOE_ENABLE=\"%1\"", card["fcoe_enable"]:"no" );
- }
- else if ( String::StartsWith( line, "DCB_REQUIRED" ) )
- {
- return sformat( "DCB_REQUIRED=\"%1\"", card["dcb_required"]:"no" );
- }
- else if ( String::StartsWith( line, "AUTO_VLAN" ) )
- {
- return sformat( "AUTO_VLAN=\"%1\"", card["auto_vlan"]:"no" );
- }
- else
- {
- return line;
- }
- });
- content = mergestring( lines, "\n" );
- y2milestone( "Writing content: %1", content );
+ string command = "";
+ map output = $[];
- boolean ret = SCR::Write( .target.string, card["cfg_file"]:"", content );
- if ( !ret )
+ y2milestone( "Writing /etc/fcoe/cfg-%1", card["cfg_file"]:"" );
+ success = SCR::Write(.fcoe.cfg-ethx.value + card["cfg_file"]:"" + "FCOE_ENABLE", card[ "fcoe_enable"]:"no" );
+ if ( !success )
{
- success = ret;
- y2error( "Cannot write %1", card["cfg_file"]:"" );
+ y2error( "Writing FCOE_ENABLE=%1 failed", card[ "fcoe_enable"]:"no" );
}
- else
+ success = SCR::Write(.fcoe.cfg-ethx.value + card["cfg_file"]:"" + "DCB_REQUIRED", card["dcb_required"]:"no" );
+ if ( !success )
+ {
+ y2error( "Writing DCB_REQUIRED=%1 failed", card["dcb_required"]:"no" );
+ }
+ success = SCR::Write(.fcoe.cfg-ethx.value + card["cfg_file"]:"" + "AUTO_VLAN", card["auto_vlan"]:"no" );
+ if ( !success )
{
- y2milestone( "%1 written", card["cfg_file"]:"" );
+ y2error( "Writing AUTO_VLAN=%1 failed", card["auto_vlan"]:"no" );
}
- // enable DCB app fcoe (app:0)
- if ( card["dcb_required"]:"no" == "yes" )
+ if ( card["dcb_required"]:"no" == "yes" )
{
+ // enable DCB on the interface
+ command = sformat( "dcbtool sc %1 dcb on", card["dev_name"]:"" );
+ y2milestone( "Executing command: %1", command );
+ output = (map)SCR::Execute( .target.bash_output, command );
+ y2milestone( "Output: %1", output );
+ if ( output["exit"]:255 != 0 )
+ {
+ Popup::Error( sformat( _("Command: %1 failed"), command ) );
+ y2error( "Command: %1 failed", command);
+ }
+ // enable App:FCoE on the interface
command = sformat( "dcbtool sc %1 app:0 e:1 a:1 w:1", card["dev_name"]:"" );
y2milestone( "Executing command: %1", command );
@@ -826,18 +845,20 @@
}
}
} );
+ // This is very important- it flushes the cache, and stores the configuration on the disk
+ success = SCR::Write( .fcoe.cfg-ethx, nil );
return success;
}
+// restart service fcoe
global boolean RestartServiceFcoe()
{
boolean ret = true;
- if ( FcoeClient::Modified() )
- {
- y2milestone( "Restarting fcoe");
- ret = Service::Restart("boot.fcoe");
- }
+
+ y2milestone( "Restarting fcoe");
+ ret = Service::Restart("boot.fcoe");
+
return ret;
}
@@ -994,13 +1015,19 @@
if( !success ) Report::Error (_("Cannot write settings for FCoE interfaces.
For details see /var/log/YaST2/y2log") );
- // restart fcoe to enable changes
if(PollAbort()) return false;
Progress::NextStage();
+ // restart fcoe to enable changes
success = RestartServiceFcoe();
/* Error message */
- if( !success ) Report::Error (_("/etc/init.d/fcoe restart failed."));
+ if( !success ) Report::Error (_("Restarting of service fcoe failed."));
+ sleep(sl);
+
+ // write ifcfg-files in /etc/sysconfig/network
+ success = WriteSysconfigFiles();
+ /* Error message */
+ if( !success ) Report::Error (_("Cannot write /etc/sysconfig/network/ifcfg-files."));
sleep(sl);
// adjust service start of lldpad and fcoe
Modified: trunk/fcoe-client/src/complex.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/complex.ycp?rev=…
==============================================================================
--- trunk/fcoe-client/src/complex.ycp (original)
+++ trunk/fcoe-client/src/complex.ycp Tue Oct 11 13:09:59 2011
@@ -33,6 +33,7 @@
import "Label";
import "Popup";
import "Wizard";
+import "Wizard_hw";
import "Confirm";
import "FcoeClient";
import "Service";
@@ -283,22 +284,20 @@
string vlan_interface = "";
string fcoe_vlan_interface = "";
map status_map = $[];
- boolean create_ifcfg = true;
- FcoeClient::ifcfg_file = sformat( "/etc/sysconfig/network/ifcfg-%1\.%2", dev_name, card["vlan_interface"]:"" );
-
- if ( Stage::initial() ) // first stage of installation - create and start FCoE VLAN interface
- {
- // headline of a popup: creating and starting Fibre Channel over Ethernet
- boolean ret = Popup::YesNoHeadline( _("Creating and starting FCoE on detected VLAN device"),
- // question to the user: really create and start FCoE
- sformat( _("Do you really want to create a FCoE network
+ string ifcfg_file = sformat( "/etc/sysconfig/network/ifcfg-%1\.%2", dev_name, card["vlan_interface"]:"" );
+
+ // headline of a popup: creating and starting Fibre Channel over Ethernet
+ boolean ret = Popup::YesNoHeadline( _("Creating and starting FCoE on detected VLAN device"),
+ // question to the user: really create and start FCoE
+ sformat( _("Do you really want to create a FCoE network
interface for discovered FCoE VLAN interface
on %1 and start the FCoE initiator?"), dev_name ) );
- if ( ret == true )
+ if ( ret == true )
+ {
+ if ( Stage::initial() ) // first stage of installation - create and start FCoE VLAN interface
{
- // create and start FCoE e.g. with 'fipvlan -c -s eth3'
- // revert this (in case of 'Abort') with 'vconfig rem eth3.200'
+ // create and start FCoE e.g. 'fipvlan -c -s eth3'
command = sformat( "fipvlan -c -s %1", dev_name );
y2milestone( "Executing command: %1", command );
output = (map)SCR::Execute( .target.bash_output, command );
@@ -311,43 +310,25 @@
return nil;
}
}
- else
- {
- y2milestone( "Creating FCoE VLAN interface canceled" );
- return nil;
- }
- }
- else // installed system - if VLAN already exists only start FCoE
- {
- // headline of a popup: starting Fibre Channel over Ethernet
- boolean ret = Popup::YesNoHeadline( _("Starting FCoE on detected VLAN device"),
- // question to the user: really start FCoE
- sformat( _("Do you really want to start FCoE initiator
-on discovered FCoE VLAN interface on %1?"), dev_name ) );
- if ( ret == true )
+ else // installed system - if VLAN already exists only start FCoE
{
- // if /etc/sysconfig/network/ifcfg-<vlan-interface> already exists
- // call 'ifup' for the interface (creates /proc/net/vlan/<vlan-interface>)
- if ( FileUtils::Exists( FcoeClient::ifcfg_file ) )
+ // create and start FCoE
+ command = sformat( "fipvlan -c -s %1", dev_name );
+
+ // if /etc/sysconfig/network/ifcfg-<if>.<vlan> already exists
+ // call 'ifup' for the interface (creates /proc/net/vlan/<if>.<vlan>)
+ if ( FileUtils::Exists( ifcfg_file ) )
{
- command = sformat( "ifup %1\.%2", dev_name, card["vlan_interface"]:"" );
- y2milestone( "Executing command: %1", command );
- output = (map)SCR::Execute( .target.bash_output, command );
+ string cmd_ifup = sformat( "ifup %1\.%2", dev_name, card["vlan_interface"]:"" );
+ y2milestone( "Executing command: %1", cmd_ifup );
+ output = (map)SCR::Execute( .target.bash_output, cmd_ifup );
y2milestone( "Output: %1", output );
if ( output["exit"]:255 == 0 )
{
- // start FCoE
+ // only start FCoE
command = sformat( "fipvlan -s %1", dev_name );
}
- else
- {
- command = sformat( "fipvlan -c -s %1", dev_name ); // create and start FCoE
- }
- }
- else
- {
- command = sformat( "fipvlan -c -s %1", dev_name );
}
y2milestone( "Executing command: %1", command );
@@ -360,45 +341,29 @@
return nil;
}
}
- else
- {
- y2milestone( "Starting FCoE canceled" );
- return nil;
- }
}
+ else
+ {
+ y2milestone( "Starting FCoE canceled" );
+ return nil;
+ }
+
+ // Get values and exchange list (table) entry
+ fcoe_vlan_interface = FcoeClient::GetFcoeVlanInterface( card["dev_name"]:"", card["vlan_interface"]:"" );
- // Get new status and exchange list (table) entry
- vlan_interface = FcoeClient::GetVlanInterface( card["dev_name"]:"" );
- if ( vlan_interface == "" )
+ if ( fcoe_vlan_interface != "" )
{
- fcoe_vlan_interface = FcoeClient::NOT_AVAILABLE;
+ y2milestone( "FCoE VLAN interface %1 created/started", fcoe_vlan_interface );
+ // write config for FCoE VLAN interface
+ FcoeClient::CreateFcoeConfig( fcoe_vlan_interface, card );
+ status_map = FcoeClient::GetFcoeStatus ( fcoe_vlan_interface, card["dev_name"]:"" );
+
+ // command to be able to revert the creation of FCoE VLAN interface in case of 'Cancel'
+ FcoeClient::AddRevertCommand( sformat("fcoeadm -d %1 && vconfig rem %1", fcoe_vlan_interface ) );
}
else
{
- fcoe_vlan_interface = FcoeClient::GetFcoeVlanInterface( card["dev_name"]:"", vlan_interface );
-
- if ( fcoe_vlan_interface != "" )
- {
- y2milestone( "FCoE VLAN interface %1 created/started", fcoe_vlan_interface );
- FcoeClient::CreateFcoeConfig( fcoe_vlan_interface, card );
- status_map = FcoeClient::GetFcoeStatus ( fcoe_vlan_interface, card );
- // store command to be able to revert the creation of FCoE VLAN interface in case of 'Abort'
- // (also if only 'fipvlan -s <interface>' is called)
- FcoeClient::AddRevertCommand( sformat("vconfig rem %1", fcoe_vlan_interface ) );
- if ( create_ifcfg )
- {
- string config = sformat( "BOOTPROTO=\"static\"\nSTARTMODE=\"nfsroot\"
-ETHERDEVICE=\"%1\"\nUSERCONTROL=\"no\"\n", dev_name );
- FcoeClient::ifcfg_file = sformat( "/etc/sysconfig/network/ifcfg-%1", fcoe_vlan_interface );
- SCR::Write(.target.string, FcoeClient::ifcfg_file, config);
- y2milestone( "Writing config: %1 to %2", config, FcoeClient::ifcfg_file );
- FcoeClient::AddRevertCommand( sformat( "rm %1", FcoeClient::ifcfg_file ) );
- }
- }
- else
- {
- fcoe_vlan_interface = FcoeClient::NOT_CONFIGURED;
- }
+ fcoe_vlan_interface = FcoeClient::NOT_CONFIGURED;
}
// set new values in global map network_interfaces
@@ -406,7 +371,7 @@
card["fcoe_enable"] = status_map["FCOE_ENABLE"]:"";
card["dcb_required"] = status_map["DCB_REQUIRED"]:"";
card["auto_vlan"] = status_map["AUTO_VLAN"]:"";
- card["cfg_file"] = status_map["Filename"]:"";
+ card["cfg_file"] = status_map["cfg_device"]:"";
FcoeClient::SetModified( true );
FcoeClient::SetNetworkCardsValue( FcoeClient::current_card, card );
@@ -441,45 +406,59 @@
if ( ret == true )
{
y2milestone( "Removing %1", card["fcoe_vlan"]:"" );
-
- command = sformat( "vconfig rem %1", card["fcoe_vlan"]:"") ;
+
+ // call fcoeadm -d <fcoe_vlan> first (bnc #719443)
+ command = sformat( "fcoeadm -d %1", card["fcoe_vlan"]:"") ;
y2milestone( "Calling %1", command );
output = (map)SCR::Execute( .target.bash_output, command );
y2milestone( "Output: %1", output );
if ( output["exit"]:255 == 0 )
{
- command = sformat( "rm %1", card["cfg_file"]:"" );
- y2milestone( "Calling %1", command );
- output = (map)SCR::Execute( .target.bash_output, command );
- y2milestone( "Output: %1", output );
- command = sformat( "rm /etc/sysconfig/network/ifcfg-%1", card["fcoe_vlan"]:"" );
+ command = sformat( "vconfig rem %1", card["fcoe_vlan"]:"") ;
y2milestone( "Calling %1", command );
output = (map)SCR::Execute( .target.bash_output, command );
y2milestone( "Output: %1", output );
+
+ if ( output["exit"]:255 == 0 )
+ {
+ command = sformat( "rm /etc/fcoe/cfg-%1", card["cfg_file"]:"" );
+ y2milestone( "Calling %1", command );
+ output = (map)SCR::Execute( .target.bash_output, command );
+ y2milestone( "Output: %1", output );
+ command = sformat( "rm /etc/sysconfig/network/ifcfg-%1", card["fcoe_vlan"]:"" );
+ y2milestone( "Calling %1", command );
+ output = (map)SCR::Execute( .target.bash_output, command );
+ y2milestone( "Output: %1", output );
- // set new values in global map network_interfaces
- card["fcoe_vlan"] = FcoeClient::NOT_CONFIGURED;
- card["fcoe_enable"] = "";
- card["dcb_required"] = "";
- card["auto_vlan"] = "";
- card["cfg_file"] = "";
- FcoeClient::SetModified( true );
+ // set new values in global map network_interfaces
+ card["fcoe_vlan"] = FcoeClient::NOT_CONFIGURED;
+ card["fcoe_enable"] = "";
+ card["dcb_required"] = "";
+ card["auto_vlan"] = "";
+ card["cfg_file"] = "";
+ FcoeClient::SetModified( true );
- FcoeClient::SetNetworkCardsValue( FcoeClient::current_card, card );
- y2milestone( "Current network interfaces: %1", FcoeClient::GetNetworkCards() );
+ FcoeClient::SetNetworkCardsValue( FcoeClient::current_card, card );
+ y2milestone( "Current network interfaces: %1", FcoeClient::GetNetworkCards() );
- // replace values in table
- UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 2), card["fcoe_vlan"]:"" );
- UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 3), card["fcoe_enable"]:"" );
- UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 4), card["dcb_required"]:"" );
- UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 5), card["auto_vlan"]:"" );
- AdjustButtons();
+ // replace values in table
+ UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 2), card["fcoe_vlan"]:"" );
+ UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 3), card["fcoe_enable"]:"" );
+ UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 4), card["dcb_required"]:"" );
+ UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 5), card["auto_vlan"]:"" );
+ AdjustButtons();
+ }
+ else
+ {
+ Popup::Error( sformat( _("Removing of interface %1 failed"), card["fcoe_vlan"]:"") );
+ y2error( "Removing of interface %1 failed", card["fcoe_vlan"]:"" );
+ }
}
else
{
- Popup::Error( sformat( _("Removing of interface %1 failed"), card["fcoe_vlan"]:"") );
- y2error( "Removing of interface %1 failed", card["fcoe_vlan"]:"" );
+ Popup::Error( sformat( _("Destroying interface %1 failed."), card["fcoe_vlan"]:"") );
+ y2error( "Destroying interface %1 failed", card["fcoe_vlan"]:"" );
}
}
}
Modified: trunk/fcoe-client/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/dialogs.ycp?rev=…
==============================================================================
--- trunk/fcoe-client/src/dialogs.ycp (original)
+++ trunk/fcoe-client/src/dialogs.ycp Tue Oct 11 13:09:59 2011
@@ -42,9 +42,11 @@
term items_fcoe = `VBox(
`VSpacing (0.4),
`Left (`RadioButton (`id ("fcoe_startup_auto"), `opt (`notify),
- "When Booting")),
+ // radio button: start service on boot
+ _("When Booting"))),
`Left (`RadioButton (`id ("fcoe_startup_manual"), `opt (`notify),
- "Manually")
+ // radio button: start service manually
+ _("Manually"))
),
`VSpacing (0.4)
);
@@ -52,9 +54,11 @@
term items_lldpad = `VBox(
`VSpacing (0.4),
`Left (`RadioButton (`id ("lldpad_startup_auto"), `opt (`notify),
- "When Booting")),
+ // radio button: start service on boot
+ _("When Booting"))),
`Left (`RadioButton (`id ("lldpad_startup_manual"), `opt (`notify),
- "Manually")
+ // radio button: start service manually
+ _("Manually"))
),
`VSpacing (0.4)
);
@@ -71,17 +75,20 @@
`Frame( (""),
`MarginBox( 10, 2,
`VBox(
- `ComboBox( `id(`fcoe), _("FCoE Enable"),
+ // combo box label: enable FCoE (yes/no)
+ `ComboBox( `id(`fcoe), _("&FCoE Enable"),
[`item(`id("yes"), "yes" ),
`item(`id("no"), "no", true ) ]
),
`VSpacing (1),
- `ComboBox( `id(`dcb), `opt (`notify, `immediate), _("DCB Required"),
+ // combo box label: require DCB (yes/no)
+ `ComboBox( `id(`dcb), `opt (`notify), _("&DCB Required"),
[`item(`id("yes"), "yes" ),
`item(`id("no"), "no", true ) ]
),
`VSpacing (1),
- `ComboBox( `id(`auto), _("AUTO_VLAN"),
+ // combo box label: AUTO_VLAN setting (yes/no)
+ `ComboBox( `id(`auto), _("&AUTO_VLAN"),
[`item(`id("yes"), "yes" ),
`item(`id("no"), "no", true ) ]
)
@@ -150,16 +157,16 @@
`VBox(
`VSpacing(2.0),
`Frame (
- // Frame label - configuration settings of FCoE
+ // frame label - configuration settings of FCoE
_("Configuration Settings"),
`VBox (
- // ComboBox label
+ // combo box label
`Left(`ComboBox(`id("debug"), _("&Debug"),
[`item(`id("yes"), "yes" ),
`item(`id("no"), "no", true )
])
),
- // ComboBox label
+ // combo box label
`Left(`ComboBox(`id("syslog"), _("&Use syslog"),
[`item(`id("yes"), "yes", true ),
`item(`id("no"), "no" )
Modified: trunk/fcoe-client/src/fcoe-client_auto.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/fcoe-client_auto…
==============================================================================
--- trunk/fcoe-client/src/fcoe-client_auto.ycp (original)
+++ trunk/fcoe-client/src/fcoe-client_auto.ycp Tue Oct 11 13:09:59 2011
@@ -160,15 +160,16 @@
if ( card["fcoe_vlan"]:"" == FcoeClient::NOT_CONFIGURED )
{
+ command = sformat( "fipvlan -c -s %1", card["dev_name"]:"" );
ifcfg_file = sformat( "/etc/sysconfig/network/ifcfg-%1\.%2", card["dev_name"]:"",
card["vlan_interface"]:"" );
// if /etc/sysconfig/network/ifcfg-<vlan-interface> already exists
// call 'ifup' for the interface (creates /proc/net/vlan/<vlan-interface>)
if ( FileUtils::Exists( ifcfg_file ) )
{
- command = sformat( "ifup %1\.%2", card["dev_name"]:"", card["vlan_interface"]:"" );
- y2milestone( "Executing command: %1", command );
- output = (map)SCR::Execute( .target.bash_output, command );
+ string cmd_ifup = sformat( "ifup %1\.%2", card["dev_name"]:"", card["vlan_interface"]:"" );
+ y2milestone( "Executing command: %1", cmd_ifup );
+ output = (map)SCR::Execute( .target.bash_output, cmd_ifup );
y2milestone( "Output: %1", output );
if ( output["exit"]:255 == 0 )
@@ -177,13 +178,10 @@
command = sformat( "fipvlan -s %1", card["dev_name"]:"" );
}
}
- else // create VLAN interface and start FCoE
- {
- command = sformat( "fipvlan -c -s %1", card["dev_name"]:"" );
- y2milestone( "Executing command: %1", command );
- output = (map)SCR::Execute( .target.bash_output, command );
- y2milestone( "Output: %1", output );
- }
+
+ y2milestone( "Executing command: %1", command );
+ output = (map)SCR::Execute( .target.bash_output, command );
+ y2milestone( "Output: %1", output );
if ( output["exit"]:255 != 0 )
{
@@ -191,32 +189,25 @@
}
else // get FCoE VLAN interface
{
- vlan_interface = FcoeClient::GetVlanInterface( card["dev_name"]:"" );
- if ( vlan_interface == "" )
+ fcoe_vlan_interface = FcoeClient::GetFcoeVlanInterface( card["dev_name"]:"",
+ card["vlan_interface"]:"" );
+ if ( fcoe_vlan_interface != "" )
{
- y2error( "VLAN interface not available for %1.", card["dev_name"]:"" );
+ y2milestone( "FCoE VLAN interface %1 created/started", fcoe_vlan_interface );
+ // create /etc/fcoe/ethx file and get values
+ FcoeClient::CreateFcoeConfig( fcoe_vlan_interface, card );
+ status_map = FcoeClient::GetFcoeStatus( fcoe_vlan_interface, card["dev_name"]:"" );
+ // apply modified data
+ detected_netcards[ index, "fcoe_vlan"] = fcoe_vlan_interface;
+ detected_netcards[ index, "cfg_file"] = status_map["cfg_device"]:"";
+ detected_netcards[ index, "fcoe_enable"] = status_map["FCOE_ENABLE"]:"";
+ detected_netcards[ index, "dcb_required"] = status_map["DCB_REQUIRED"]:"";
}
else
- {
- fcoe_vlan_interface = FcoeClient::GetFcoeVlanInterface( card["dev_name"]:"",
- vlan_interface );
- if ( fcoe_vlan_interface != "" )
- {
- y2milestone( "FCoE VLAN interface %1 created/started", fcoe_vlan_interface );
- // create /etc/fcoe/ethx file and get values
- FcoeClient::CreateFcoeConfig( fcoe_vlan_interface, card );
- status_map = FcoeClient::GetFcoeStatus( fcoe_vlan_interface, card );
- // apply modified data
- detected_netcards[ index, "fcoe_vlan"] = fcoe_vlan_interface;
- detected_netcards[ index, "cfg_file"] = status_map["Filename"]:"";
- detected_netcards[ index, "fcoe_enable"] = status_map["FCOE_ENABLE"]:"";
- detected_netcards[ index, "dcb_required"] = status_map["DCB_REQUIRED"]:"";
- }
- else
- {
- y2error( "FCoE VLAN interface not configured for %1", card["dev_name"]:"" );
- }
+ {
+ y2error( "FCoE VLAN interface not configured for %1", card["dev_name"]:"" );
}
+
}
}
index = index + 1;
Modified: trunk/fcoe-client/src/fcoe-client_finish.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/fcoe-client_fini…
==============================================================================
--- trunk/fcoe-client/src/fcoe-client_finish.ycp (original)
+++ trunk/fcoe-client/src/fcoe-client_finish.ycp Tue Oct 11 13:09:59 2011
@@ -48,27 +48,41 @@
{
boolean start_services = false;
string command = "";
- y2milestone( "Copying files /etc/fcoe/* to destination" );
-
- // copy fcoe config files to destdir
- WFM::Execute (.local.bash,"test -d /etc/fcoe/ && mkdir -p '" + String::Quote(Installation::destdir) + "/etc/fcoe' && cp -a /etc/fcoe/* '" + String::Quote(Installation::destdir) + "/etc/fcoe/'");
-
- // copy sysconfig file
- command = sformat ( "cp -a %1 '%2/etc/sysconfig/network'", FcoeClient::ifcfg_file,
- String::Quote(Installation::destdir) );
- y2milestone( "Executing command: %1", command );
-
- WFM::Execute (.local.bash, command );
-
- // only enable services if any FCoE VLAN interface is enabled
list <map> netcards = FcoeClient::GetNetworkCards();
+ if ( netcards != [] )
+ {
+ y2milestone( "Copying files /etc/fcoe/* to destination" );
+ // copy fcoe config files to destdir
+ WFM::Execute (.local.bash,"test -d /etc/fcoe/ && mkdir -p '" + String::Quote(Installation::destdir) + "/etc/fcoe' && cp -a /etc/fcoe/* '" + String::Quote(Installation::destdir) + "/etc/fcoe/'");
+ }
+ else
+ {
+ y2milestone( "Nothing to do" );
+ }
+
foreach ( map card, netcards, {
+ string command = "";
+ string file_name = "";
if ( card["fcoe_vlan"]:"" != FcoeClient::NOT_AVAILABLE &&
card["fcoe_vlan"]:"" != FcoeClient::NOT_CONFIGURED )
{
// FCoE VLAN interface is configured -> start services
start_services = true;
+
+ // copy sysconfig files
+ file_name = sformat( "/etc/sysconfig/network/ifcfg-%1\.%2",
+ card["dev_name"]:"", card["vlan_interface"]:"" );
+ command = sformat ( "cp -a %1 '%2/etc/sysconfig/network'", file_name,
+ String::Quote(Installation::destdir) );
+ y2milestone( "Executing command: %1", command );
+ WFM::Execute (.local.bash, command );
+
+ file_name = sformat( "/etc/sysconfig/network/ifcfg-%1", card["dev_name"]:"" );
+ command = sformat ( "cp -a %1 '%2/etc/sysconfig/network'", file_name,
+ String::Quote(Installation::destdir) );
+ y2milestone( "Executing command: %1", command );
+ WFM::Execute (.local.bash, command );
}
} );
Modified: trunk/fcoe-client/src/inst_fcoe-client.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/inst_fcoe-client…
==============================================================================
--- trunk/fcoe-client/src/inst_fcoe-client.ycp (original)
+++ trunk/fcoe-client/src/inst_fcoe-client.ycp Tue Oct 11 13:09:59 2011
@@ -85,12 +85,14 @@
y2milestone( "Adding package open-fcoe to pool" );
PackagesProposal::AddResolvables( "fcoe", `package, ["open-fcoe"] );
// write changes to config files
- y2milestone( "Writing config files");
+ y2milestone( "Writing FCoE config files");
FcoeClient::WriteFcoeConfig();
FcoeClient::WriteCfgFiles();
// restart fcoemon
y2milestone( "Restarting FCoE" );
FcoeClient::RestartServiceFcoe();
+ y2milestone( "Writing sysconfig files" );
+ FcoeClient::WriteSysconfigFiles();
// enable start of services
y2milestone( "Enabling service start of fcoe and lldpad" );
FcoeClient::SetStartStatus( "fcoe", true );
Modified: trunk/fcoe-client/src/wizards.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/wizards.ycp?rev=…
==============================================================================
--- trunk/fcoe-client/src/wizards.ycp (original)
+++ trunk/fcoe-client/src/wizards.ycp Tue Oct 11 13:09:59 2011
@@ -30,7 +30,6 @@
textdomain "fcoe-client";
- import "Mode";
import "Sequencer";
import "Wizard";
import "CWM";
@@ -173,10 +172,7 @@
Wizard::HideBackButton();
// TODO: rename icon to yast2-fcoe-client (yast2-theme package)
- if (Mode::normal ())
- Wizard::SetDesktopTitleAndIcon("fcoe-client");
- else
- Wizard::SetTitleIcon("fcoe");
+ Wizard::SetTitleIcon("fcoe");
return CWM::Run (w, $[`abort : ReallyAbort]);
}
@@ -235,10 +231,6 @@
];
Wizard::CreateDialog();
- if (Mode::normal ())
- Wizard::SetDesktopTitleAndIcon("fcoe-client");
- else
- Wizard::SetTitleIcon("fcoe");
any ret = Sequencer::Run(aliases, sequence);
@@ -275,10 +267,6 @@
];
Wizard::CreateDialog();
- if (Mode::normal ())
- Wizard::SetDesktopTitleAndIcon("fcoe-client");
- else
- Wizard::SetTitleIcon("fcoe");
any ret = Sequencer::Run(aliases, sequence);
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
![](https://seccdn.libravatar.org/avatar/1221572c74a1df78a3aa2625b979eb21.jpg?s=120&d=mm&r=g)
[yast-commit] r66379 - /trunk/fcoe-client/yast2-fcoe-client.spec.in
by gs@svn2.opensuse.org 11 Oct '11
by gs@svn2.opensuse.org 11 Oct '11
11 Oct '11
Author: gs
Date: Tue Oct 11 12:59:05 2011
New Revision: 66379
URL: http://svn.opensuse.org/viewcvs/yast?rev=66379&view=rev
Log:
better summary
Modified:
trunk/fcoe-client/yast2-fcoe-client.spec.in
Modified: trunk/fcoe-client/yast2-fcoe-client.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/yast2-fcoe-client.sp…
==============================================================================
--- trunk/fcoe-client/yast2-fcoe-client.spec.in (original)
+++ trunk/fcoe-client/yast2-fcoe-client.spec.in Tue Oct 11 12:59:05 2011
@@ -8,7 +8,7 @@
BuildArchitectures: noarch
-Summary: Configuration of fcoe-client
+Summary: YaST2 - Configuration of Fibre Channel over Ethernet
%description
This package contains the YaST2 component for the Fibre Channel over
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
![](https://seccdn.libravatar.org/avatar/1221572c74a1df78a3aa2625b979eb21.jpg?s=120&d=mm&r=g)
[yast-commit] r66378 - /trunk/fcoe-client/yast2-fcoe-client.spec.in
by gs@svn2.opensuse.org 11 Oct '11
by gs@svn2.opensuse.org 11 Oct '11
11 Oct '11
Author: gs
Date: Tue Oct 11 12:56:25 2011
New Revision: 66378
URL: http://svn.opensuse.org/viewcvs/yast?rev=66378&view=rev
Log:
Group and License added
Modified:
trunk/fcoe-client/yast2-fcoe-client.spec.in
Modified: trunk/fcoe-client/yast2-fcoe-client.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/yast2-fcoe-client.sp…
==============================================================================
--- trunk/fcoe-client/yast2-fcoe-client.spec.in (original)
+++ trunk/fcoe-client/yast2-fcoe-client.spec.in Tue Oct 11 12:56:25 2011
@@ -1,6 +1,8 @@
@HEADER-COMMENT@
@HEADER@
+Group: System/YaST
+License: GPL-2.0
Requires: yast2 >= 2.21.22
BuildRequires: perl-XML-Writer update-desktop-files yast2 yast2-devtools yast2-testsuite
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
![](https://seccdn.libravatar.org/avatar/8ea7e9df6cc79a33898e71283aa37a3c.jpg?s=120&d=mm&r=g)
[yast-commit] r66377 - in /trunk/theme: ./ SLE/icons/22x22/apps/ SLE/icons/32x32/apps/ SLE/icons/48x48/apps/ SLE/icons/64x64/apps/ openSUSE/icons/22x22/apps/ openSUSE/icons/32x32/apps/ openSUSE/icons/48x48/apps/...
by tgoettlicher@svn2.opensuse.org 11 Oct '11
by tgoettlicher@svn2.opensuse.org 11 Oct '11
11 Oct '11
Author: tgoettlicher
Date: Tue Oct 11 12:45:42 2011
New Revision: 66377
URL: http://svn.opensuse.org/viewcvs/yast?rev=66377&view=rev
Log:
renamed icons
Added:
trunk/theme/SLE/icons/22x22/apps/yast-onpanic.png
- copied unchanged from r66237, trunk/theme/SLE/icons/22x22/apps/yast-dumpconf.png
trunk/theme/SLE/icons/32x32/apps/yast-onpanic.png
- copied unchanged from r66237, trunk/theme/SLE/icons/32x32/apps/yast-dumpconf.png
trunk/theme/SLE/icons/48x48/apps/yast-onpanic.png
- copied unchanged from r66237, trunk/theme/SLE/icons/48x48/apps/yast-dumpconf.png
trunk/theme/SLE/icons/64x64/apps/yast-dump.png
- copied unchanged from r66237, trunk/theme/SLE/icons/64x64/apps/yast-dumpdevice.png
trunk/theme/SLE/icons/64x64/apps/yast-onpanic.png
- copied unchanged from r66237, trunk/theme/SLE/icons/64x64/apps/yast-dumpconf.png
trunk/theme/SLE/icons/64x64/apps/yast-xpram.png
- copied unchanged from r66237, trunk/theme/SLE/icons/64x64/apps/yast-ramdisk.png
trunk/theme/openSUSE/icons/22x22/apps/yast-onpanic.png
- copied unchanged from r66237, trunk/theme/openSUSE/icons/22x22/apps/yast-dumpconf.png
trunk/theme/openSUSE/icons/32x32/apps/yast-onpanic.png
- copied unchanged from r66237, trunk/theme/openSUSE/icons/32x32/apps/yast-dumpconf.png
trunk/theme/openSUSE/icons/48x48/apps/yast-onpanic.png
- copied unchanged from r66237, trunk/theme/openSUSE/icons/48x48/apps/yast-dumpconf.png
trunk/theme/openSUSE/icons/64x64/apps/yast-dump.png
- copied unchanged from r66237, trunk/theme/openSUSE/icons/64x64/apps/yast-dumpdevice.png
trunk/theme/openSUSE/icons/64x64/apps/yast-onpanic.png
- copied unchanged from r66237, trunk/theme/openSUSE/icons/64x64/apps/yast-dumpconf.png
trunk/theme/openSUSE/icons/scalable/apps/yast-dump.svg
- copied unchanged from r66237, trunk/theme/openSUSE/icons/scalable/apps/yast-dumpdevice.svg
trunk/theme/openSUSE/icons/scalable/apps/yast-onpanic.svg
- copied unchanged from r66237, trunk/theme/openSUSE/icons/scalable/apps/yast-dumpconf.svg
Removed:
trunk/theme/SLE/icons/22x22/apps/yast-dumpconf.png
trunk/theme/SLE/icons/32x32/apps/yast-dumpconf.png
trunk/theme/SLE/icons/48x48/apps/yast-dumpconf.png
trunk/theme/SLE/icons/64x64/apps/yast-dumpconf.png
trunk/theme/SLE/icons/64x64/apps/yast-dumpdevice.png
trunk/theme/SLE/icons/64x64/apps/yast-ramdisk.png
trunk/theme/openSUSE/icons/22x22/apps/yast-dumpconf.png
trunk/theme/openSUSE/icons/32x32/apps/yast-dumpconf.png
trunk/theme/openSUSE/icons/48x48/apps/yast-dumpconf.png
trunk/theme/openSUSE/icons/64x64/apps/yast-dumpconf.png
trunk/theme/openSUSE/icons/64x64/apps/yast-dumpdevice.png
trunk/theme/openSUSE/icons/scalable/apps/yast-dumpconf.svg
trunk/theme/openSUSE/icons/scalable/apps/yast-dumpdevice.svg
Modified:
trunk/theme/VERSION
trunk/theme/package/yast2-theme.changes
Modified: trunk/theme/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/theme/VERSION?rev=66377&r1=66376…
==============================================================================
--- trunk/theme/VERSION (original)
+++ trunk/theme/VERSION Tue Oct 11 12:45:42 2011
@@ -1 +1 @@
-2.21.14
+2.21.15
Modified: trunk/theme/package/yast2-theme.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/theme/package/yast2-theme.change…
==============================================================================
--- trunk/theme/package/yast2-theme.changes (original)
+++ trunk/theme/package/yast2-theme.changes Tue Oct 11 12:45:42 2011
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Mon Oct 10 16:57:16 CEST 2011 - tgoettlicher(a)suse.de
+
+- renamed icons
+- 2.21.15
+
+-------------------------------------------------------------------
Fri Oct 7 10:38:45 CEST 2011 - tgoettlicher(a)suse.de
- updated oxygen icons provided by Martin Schlander a 2nd time
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
![](https://seccdn.libravatar.org/avatar/ff2cb327bf0a83604a58d72935bcf7ff.jpg?s=120&d=mm&r=g)
11 Oct '11
Author: lslezak
Date: Tue Oct 11 11:58:03 2011
New Revision: 66376
URL: http://svn.opensuse.org/viewcvs/yast?rev=66376&view=rev
Log:
Created tag stable-2_21_3 for sound
Added:
tags/stable-2_21_3/sound/ (props changed)
- copied from r66375, trunk/sound/
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
![](https://seccdn.libravatar.org/avatar/ff2cb327bf0a83604a58d72935bcf7ff.jpg?s=120&d=mm&r=g)
[yast-commit] r66375 - in /trunk/sound: VERSION package/yast2-sound.changes
by lslezak@svn2.opensuse.org 11 Oct '11
by lslezak@svn2.opensuse.org 11 Oct '11
11 Oct '11
Author: lslezak
Date: Tue Oct 11 11:54:53 2011
New Revision: 66375
URL: http://svn.opensuse.org/viewcvs/yast?rev=66375&view=rev
Log:
-2.21.3
Modified:
trunk/sound/VERSION
trunk/sound/package/yast2-sound.changes
Modified: trunk/sound/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/sound/VERSION?rev=66375&r1=66374…
==============================================================================
--- trunk/sound/VERSION (original)
+++ trunk/sound/VERSION Tue Oct 11 11:54:53 2011
@@ -1 +1 @@
-2.21.2
+2.21.3
Modified: trunk/sound/package/yast2-sound.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/sound/package/yast2-sound.change…
==============================================================================
--- trunk/sound/package/yast2-sound.changes (original)
+++ trunk/sound/package/yast2-sound.changes Tue Oct 11 11:54:53 2011
@@ -1,4 +1,13 @@
-------------------------------------------------------------------
+Tue Oct 11 07:50:58 UTC 2011 - lslezak(a)suse.cz
+
+- added support for USB joysticks, redesigned the main dialog
+ to support both USB and Gameport joysticks, updated the test
+ dialog (use sliders, fixed button and axes detection)
+ (bnc#695323)
+- 2.21.3
+
+-------------------------------------------------------------------
Thu Sep 29 13:51:50 CEST 2011 - visnov(a)suse.cz
- set dialog title
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
![](https://seccdn.libravatar.org/avatar/ff2cb327bf0a83604a58d72935bcf7ff.jpg?s=120&d=mm&r=g)
[yast-commit] r66374 - /trunk/sound/sound/src/joy_dialog.ycp
by lslezak@svn2.opensuse.org 11 Oct '11
by lslezak@svn2.opensuse.org 11 Oct '11
11 Oct '11
Author: lslezak
Date: Tue Oct 11 10:42:04 2011
New Revision: 66374
URL: http://svn.opensuse.org/viewcvs/yast?rev=66374&view=rev
Log:
- use more constants
- display joystick name in the test popup
Modified:
trunk/sound/sound/src/joy_dialog.ycp
Modified: trunk/sound/sound/src/joy_dialog.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/sound/sound/src/joy_dialog.ycp?r…
==============================================================================
--- trunk/sound/sound/src/joy_dialog.ycp (original)
+++ trunk/sound/sound/src/joy_dialog.ycp Tue Oct 11 10:42:04 2011
@@ -28,7 +28,9 @@
include "sound/routines.ycp";
// notice about USB devices, used at several places
- string usb_notice = _("USB joysticks do not need any configuration, just connect them.");
+ const string usb_notice = _("USB joysticks do not need any configuration, just connect them.");
+
+ const string gameport = "Gameport";
/**
* Update the sound card configuration of joystick
@@ -289,6 +291,32 @@
}
/*
+ * Get details about the joustick bus
+ * @param js Joystick device map
+ * @param soundcards List of detected soundcards
+ * @return string Bus description
+ */
+ string joystick_bus_details(map js, list<map> soundcards)
+ {
+ string ret = js["bus"]:"";
+
+ if (ret == gameport)
+ {
+ string unique_key = js["parent_unique_key"]:"";
+
+ map card = find(map c, soundcards, {return c["unique_key"]:"" == unique_key;});
+
+ if (card != nil)
+ {
+ // joystick details, %1 is the sound card name to which is the joystick connected
+ ret = sformat(_("%1 (%2)"), ret, card["model"]:"");
+ }
+ }
+
+ return ret;
+ }
+
+ /*
* Create content for the joystick overview table
* @return list<map<string,any>> content for WizardHW::SetContents() function
*/
@@ -318,18 +346,11 @@
string bus = js["bus"]:"";
// add the sound card name for gameport joysticks
- if (bus == "Gameport" && size(js["parent_unique_key"]:"") > 0)
+ if (bus == gameport && size(js["parent_unique_key"]:"") > 0)
{
+ bus = joystick_bus_details(js, soundcards);
string unique_key = js["parent_unique_key"]:"";
- map card = find(map c, soundcards, {return c["unique_key"]:"" == unique_key;});
-
- if (card != nil)
- {
- // joystick details, %1 is the sound card name to which is the joystick connected
- bus = sformat("%1 (%2)", bus, card["model"]:"");
- }
-
integer i = 0;
integer joy_index = nil;
@@ -381,7 +402,7 @@
y2milestone("Found inactive joystick configuration at index %1: %2", i, js);
string model = js["model"]:_("Unknown joystick model");
string unique_key = js["attached_to"]:"";
- string bus = "Gameport";
+ string bus = gameport;
map card = find(map c, soundcards, {return c["unique_key"]:"" == unique_key;});
@@ -482,10 +503,15 @@
`VSpacing(18),
`VBox(
`HSpacing(50),
- `VSpacing(1),
+ `VSpacing(0.5),
// Popup label
`Heading(_("Joystick Test")),
- `VSpacing(1),
+ `VSpacing(0.5),
+ // label - joystick details (%1 is model name, %2 is bus name)
+ `Left(`Label(sformat(_("Joystick: %1, attached to: %2"), js["model"]:"",
+ joystick_bus_details(js, (list<map>)SCR::Read(.probe.sound)))
+ )),
+ //`VSpacing(0.5),
joy_attrib,
`VSpacing(1),
`PushButton(`id(`done), `opt(`default), Label::OKButton()),
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
![](https://seccdn.libravatar.org/avatar/ff2cb327bf0a83604a58d72935bcf7ff.jpg?s=120&d=mm&r=g)
[yast-commit] r66373 - in /trunk/sound: ./ sound/src/Joystick.ycp sound/src/Sound.ycp sound/src/card_wizard.ycp sound/src/joy_dialog.ycp sound/src/joystick.ycp sound/src/ui.ycp sound/src/volume.ycp
by lslezak@svn2.opensuse.org 11 Oct '11
by lslezak@svn2.opensuse.org 11 Oct '11
11 Oct '11
Author: lslezak
Date: Tue Oct 11 09:43:49 2011
New Revision: 66373
URL: http://svn.opensuse.org/viewcvs/yast?rev=66373&view=rev
Log:
merged changes from tmp/lslezak/sound branch
(hackweek project - USB joystick support)
Modified:
trunk/sound/ (props changed)
trunk/sound/sound/src/Joystick.ycp
trunk/sound/sound/src/Sound.ycp
trunk/sound/sound/src/card_wizard.ycp
trunk/sound/sound/src/joy_dialog.ycp
trunk/sound/sound/src/joystick.ycp
trunk/sound/sound/src/ui.ycp
trunk/sound/sound/src/volume.ycp
Modified: trunk/sound/sound/src/Joystick.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/sound/sound/src/Joystick.ycp?rev…
==============================================================================
--- trunk/sound/sound/src/Joystick.ycp (original)
+++ trunk/sound/sound/src/Joystick.ycp Tue Oct 11 09:43:49 2011
@@ -39,6 +39,27 @@
// database entry
global string generic_joystick_translated = _("Generic Analog Joystick");
+ list<map> detected_joysticks = [];
+
+ global list<map> Detected()
+ {
+ return detected_joysticks;
+ }
+
+ global void Detect()
+ {
+ detected_joysticks = (list<map>)SCR::Read(.probe.joystick);
+ }
+
+ /* Reverts the internal joystick configuration to the original state
+ * read by Read() function
+ */
+ global void Revert()
+ {
+ y2milestone("Reverting the joystick config back to: %1", joystick_backup);
+ joystick = joystick_backup;
+ }
+
/**
* Get list of all required joystick kernel modules
* @return list list of modules
@@ -70,6 +91,26 @@
return ret;
}
+ string format_model_line(string model, string attached_to)
+ {
+ return sformat("# Model: %1, Attached to: %2\n", model, attached_to);
+ }
+
+ list<string> parse_model_line(string line)
+ {
+ string regexp = "^#[ \t]*Model: (.*),[ \t]*Attached to:[ \t]*(.*)$";
+
+ string model = regexpsub(line, regexp, "\\1");
+ string attached_to = regexpsub(line, regexp, "\\2");
+
+ if (model == nil) model = "";
+ if (attached_to == nil) attached_to = "";
+
+ y2milestone("Parsed model line: %1 -> model: %2, attached_to: %3", line, model, attached_to);
+
+ return [model, attached_to];
+ }
+
/**
* Read all joystick settings from the SCR
* @param abort A block that can be called by Read to find
@@ -107,6 +148,7 @@
// read model comment
string model = (string) SCR::Read(topath(
sformat(".sysconfig.joystick.JOYSTICK_MODULE_%1.comment",pos)));
+ string attached_to = "";
y2debug("Read model comment: %1", model);
@@ -144,28 +186,14 @@
}
else
{
- // remove comment char
- if (substring(model, 0, 1) == "#")
- {
- if (size(model) > 1)
- {
- model = substring(model, 1);
- }
- else
- {
- model = "";
- }
- }
+ list<string> info = parse_model_line(model);
- // remove new line char
- if (size(model) > 1 &&
- substring(model, size(model) - 1, 1) == "\n")
- {
- model = substring(model, 0, size(model) - 1);
- }
+ model = info[0]:"";
+ attached_to = info[1]:"";
}
- j = add(j, "model", model);
+ j["model"] = model;
+ j["attached_to"] = attached_to;
joystick = add(joystick, j);
@@ -173,6 +201,8 @@
}
joystick_backup = joystick;
+
+ Detect();
return true;
}
@@ -215,13 +245,14 @@
// write model comment
string model = j["model"]:"";
+ string attached_to = j["attached_to"]:"";
// add comment before first model
if (pos == 0)
{
if (size(model) > 0)
{
- model = module_comment + "\n#" + model + "\n";
+ model = module_comment + "\n" + format_model_line(model, attached_to);
}
else
{
@@ -232,7 +263,7 @@
{
if (size(model) > 0)
{
- model = "#" + model + "\n";
+ model = format_model_line(model, attached_to);
}
}
Modified: trunk/sound/sound/src/Sound.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/sound/sound/src/Sound.ycp?rev=66…
==============================================================================
--- trunk/sound/sound/src/Sound.ycp (original)
+++ trunk/sound/sound/src/Sound.ycp Tue Oct 11 09:43:49 2011
@@ -138,9 +138,6 @@
*/
global string curr_model = "";
- // if joystick dialog should be started after sound card config
- global boolean conf_joystick = true;
-
/**
* default value of volume for new card
*/
Modified: trunk/sound/sound/src/card_wizard.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/sound/sound/src/card_wizard.ycp?…
==============================================================================
--- trunk/sound/sound/src/card_wizard.ycp (original)
+++ trunk/sound/sound/src/card_wizard.ycp Tue Oct 11 09:43:49 2011
@@ -33,15 +33,8 @@
string modelname = Sound::save_entry["model"]:"";
string modname = Sound::save_entry["module"]:"";
- boolean has_joy = false;
- if (Sound::db_modules[modname, "joystick"]:$[] != $[])
- {
- has_joy = true;
- }
-
- map res = DisplayName (
- modelname, Sound::save_entry["alias"]:"", card_id, flags, has_joy);
+ map res = DisplayName (modelname, Sound::save_entry["alias"]:"", card_id, flags);
symbol ui = res["ui"]:`back;
Modified: trunk/sound/sound/src/joy_dialog.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/sound/sound/src/joy_dialog.ycp?r…
==============================================================================
--- trunk/sound/sound/src/joy_dialog.ycp (original)
+++ trunk/sound/sound/src/joy_dialog.ycp Tue Oct 11 09:43:49 2011
@@ -14,18 +14,21 @@
textdomain "sound";
import "Wizard";
+ import "WizardHW";
import "Joystick";
import "Sound";
- import "Joystick";
import "Package";
import "Label";
import "Popup";
+ import "String";
include "sound/joysticks.ycp";
include "sound/ui.ycp";
include "sound/volume_routines.ycp";
+ include "sound/routines.ycp";
- list joylist = [];
+ // notice about USB devices, used at several places
+ string usb_notice = _("USB joysticks do not need any configuration, just connect them.");
/**
* Update the sound card configuration of joystick
@@ -61,380 +64,60 @@
return false;
}
-/**
- * Dialog for joystick testing.
- * @param card_id Sound card card_id
- * @param joymodidx model id
- * @param joymod joystick module
- * @return boolean false when Abort was pressed or some problems occurred
- */
-define boolean joy_test_popup (integer card_id, integer joymodidx,
- string joymod) ``{
- any ret = nil;
- UI::OpenDialog(`opt(`decorated), `HBox(`HSpacing(1.5),
- `VBox(
- `VSpacing(1),
- // Wait text label
- `Label(_("Initializing joystick -- please wait...")),
- `VSpacing(1),
- `PushButton(`id(`done), `opt(`default), Label::AbortButton()),
- `VSpacing(1)
- ),
- `HSpacing(1.5)
- ));
-
- // store old joystick configuration:
- list current_conf = (list) eval (Joystick::joystick);
-
- // if new joystick type was selected:
- boolean testing_new = false;
-
- string modname = Sound::modules_conf [card_id, "module"]:"";
- map joy_entry = Sound::GetJoystickSettings(modname);
- string model = joylist [joymodidx, 1]:"";
-
- // do not translate model in /etc/sysconfig/joystick
- if (model == Joystick::generic_joystick_translated)
- {
- model = Joystick::generic_joystick;
- }
- joy_entry = add(joy_entry, "JOYSTICK_MODULE", joymod);
- joy_entry = add(joy_entry, "model", model);
-
- if (model != current_conf [card_id, "model"]:"")
- testing_new = true;
-
- Joystick::joystick[card_id] = joy_entry;
- y2milestone("Tested joystick configuration: %1", joy_entry);
-
- // unload old and load new modules if necessary:
- if (testing_new)
- {
- Joystick::Stop();
- Joystick::SaveOneJoystick(card_id);
- Joystick::WriteConfig();
- Joystick::StartAndEnable();
- }
-
- // sound card configuration must be changed...
- if (update_sound_card_joy_config (card_id, true))
- {
- // popup text (yes/no)
- if (Popup::YesNo (_("For proper joystick initialization,
-a restart of the sound system is necessary.
-Proceed?")))
- {
- sound_stop ();
- sound_start_tmp(true);
- }
- }
-
- integer js_id = card_id; // default number of device
- list joysticks = [];
- integer i = 0;
-
- sleep (100);
- while (i < 4)
- {
- if (SCR::Execute(.target.bash,
- sformat("echo 2>/dev/null < /dev/input/js%1",i)) == 0)
- {
- joysticks = add (joysticks, i);
- y2milestone("existing device: /dev/input/js%1", i);
- }
- i = i + 1;
- }
- i = 0;
-
- if (size (joysticks) == 0)
- {
- // popup message
- Popup::Message(_("No joystick is connected."));
- if (testing_new)
- {
- Joystick::joystick = current_conf;
- Joystick::Stop();
- Joystick::SaveOneJoystick(card_id);
- Joystick::WriteConfig();
- Joystick::StartAndEnable();
- }
- UI::CloseDialog();
- return false;
- }
-
- if (size (joysticks) > 1)
- {
- UI::CloseDialog ();
- UI::OpenDialog (`opt(`decorated), `HBox(`HSpacing(1.5), `VBox(
- `VSpacing(1),
- // text label
- `Label(_("More than one joystick is connected.
-Select the one to test
-and press some of its buttons several times.
-")),
- `VSpacing(1),
- `PushButton(`id(`abort), `opt(`default), Label::AbortButton()),
- `VSpacing(1)),
- `HSpacing(1.5)
- ));
-
- // more joysticks are connected: run jstest alternately for all ones,
- // until user pushs some button of joystick he want to test
- while (ret == nil)
- {
- ret = UI::PollInput();
- js_id = joysticks [i]:0;
-
- SCR::Execute (.background.run_output,
- sformat("/usr/bin/jstest --event /dev/input/js%1", js_id));
- sleep (500);
-
- if ((boolean) SCR::Read(.background.output_open) &&
- (integer) SCR::Read(.background.newlines)>0)
- {
- list test_output = (list)SCR::Read(.background.newout);
- string last_output = test_output [size (test_output)-1]:"";
- last_output = deletechars (last_output, ",");
- list listed_output = splitstring (last_output," ");
- integer event_type = tointeger (listed_output[2]:"0");
- integer value = tointeger (listed_output [8]:"0");
- if (event_type == 1)
- {
- y2debug ("output from /dev/js%1: %2", js_id, listed_output);
- ret = `found;
- }
- }
- SCR::Execute(.background.kill);
- if (ret != `found)
+ /*
+ * Find index of the sound card in Sound::modules_conf
+ * @param sound card map (as returned from .probe.sound)
+ * @return integer index in Sound::modules_conf
+ */
+ integer find_sound_card_id(map sound_card)
+ {
+ integer i = 0;
+ integer ret = nil;
+
+ foreach(map card, Sound::modules_conf, {
+ if (card["unique_key"]:"" == sound_card["unique_key"]:"")
{
- if (i == size (joysticks))
- i = 0;
- else
- i = i + 1;
+ ret = i;
}
- }
- }
- if (ret == `abort)
- {
- y2debug ("Abort pressed");
- if (testing_new)
- {
- Joystick::joystick = current_conf;
- Joystick::Stop();
- Joystick::SaveOneJoystick(card_id);
- Joystick::WriteConfig();
- Joystick::StartAndEnable();
- }
- UI::CloseDialog();
- return false;
- }
-
- // number of device could be different from card number...
- js_id = joysticks [i]:0;
- SCR::Execute(.background.run_output,
- sformat("/usr/bin/jstest --event /dev/input/js%1",js_id));
-
- // read the output of joystick initialization
- while ((boolean)SCR::Read(.background.output_open) &&
- (integer)SCR::Read(.background.newlines) == 0)
- {
- ret = UI::PollInput();
- if (ret != nil)
- {
- SCR::Execute(.background.kill);
- if (testing_new)
- {
- Joystick::joystick = current_conf;
- Joystick::Stop();
- Joystick::SaveOneJoystick(card_id);
- Joystick::WriteConfig();
- Joystick::StartAndEnable();
- }
- UI::CloseDialog();
- return false;
- }
- }
- // get the number of axes and buttons from the initial jstest output line
- list test_output = (list)SCR::Read(.background.newout);
- string last_output = test_output[0]:"";
- list<string> listed_output = splitstring (last_output," ");
- integer axes = 2;
- integer buttons = 2;
- i = 0;
-
- while (i < size(listed_output))
- {
- // all text parts ("has") depend on output of jstest!
- if (listed_output[i]:"" == "has" && listed_output[i+2]:"" == "axes" )
- axes = tointeger (listed_output[i+1]:"2");
-
- if (listed_output[i]:"" == "and" && listed_output[i+2]:"" == "buttons.")
- buttons = tointeger (listed_output[i+1]:"2");
- i = i + 1;
- }
-
- // generate appropriate dialog for the joystick
- term joy_attrib = `VBox();
- string widget_name = "";
- string widget_id = "";
- integer min = -32767; // see js_event.value in linux/joystick.h
- integer max = 32767;
- i = 0;
-
- while (i < axes)
- {
- // progress bar label
- widget_name = sformat(_("Axis %1"), i);
- widget_id = sformat("Axis %1", i);
- joy_attrib = add (joy_attrib, `ProgressBar(`id(widget_id),
- `opt(`autoShortcut), widget_name, 2*max, max));
- joy_attrib = add (joy_attrib, `VSpacing(1));
- i = i + 1;
- }
-
- i = 0;
- term joy_buttons = `HBox();
- string not_pressed = " ";
- string pressed = UI::Glyph(`CheckMark);
- while (i < buttons)
- {
- // label
- widget_name = sformat(_("Button %1"), i);
- widget_id = sformat ("Button %1", i);
- joy_buttons = add (joy_buttons,
- `Label (`id(widget_id), widget_name + " " + not_pressed));
- joy_buttons = add (joy_buttons, `HSpacing(2));
- i = i + 1;
- }
- joy_attrib = add (joy_attrib, joy_buttons);
-
- UI::CloseDialog();
- UI::OpenDialog(`opt(`decorated), `HBox(`HSpacing(1.5),
- `VSpacing(18),
- `VBox(
- `HSpacing(50),
- `VSpacing(1),
- // Popup label
- `Label(_("Joystick Test")),
- `VSpacing(1),
- joy_attrib,
- `VSpacing(1),
- `PushButton(`id(`done), `opt(`default), Label::OKButton()),
- `VSpacing(1)
- ),
- `HSpacing(1.5)
- ));
-
- // read the jstest output until "OK" button is pushed
- do
- {
- if ((boolean)SCR::Read(.background.output_open) &&
- (integer)SCR::Read(.background.newlines)>0)
- {
- // read the output line from jstest:
- test_output = (list)SCR::Read(.background.newout);
- // select the last item of the list:
- last_output = test_output [ size(test_output) - 1 ]:"";
- last_output = deletechars (last_output, ",");
-
- listed_output = splitstring (last_output," ");
- listed_output = filter (string l, listed_output, ``(l != ""));
-
- // positions in list depend on jstest output!
- integer type = tointeger (listed_output[2]:"0");
- integer number = tointeger (listed_output[6]:"0");
- integer val = tointeger (listed_output[8]:"0");
-
- if (type == 1)
- {
- // button pressed
- if (val == 1)
- UI::ChangeWidget(`id(sformat("Button %1", number)), `Value,
- // label text ("Button" is joystick's button no. %1)
- sformat(_("Button %1"), number) + " " + pressed);
- else
- UI::ChangeWidget(`id(sformat("Button %1", number)), `Value,
- sformat(_("Button %1"), number) + " " + not_pressed);
- }
- else if (type == 2)
- {
- // change in some axis
- UI::ChangeWidget(`id(sformat ("Axis %1", number)), `Value, max + val) ;
- }
- }
- ret = UI::PollInput();
- }
- while (ret == nil);
-
- SCR::Execute(.background.kill);
-
- // back to the old values
- Joystick::joystick = current_conf;
- if (testing_new)
- {
- Joystick::Stop();
- Joystick::SaveOneJoystick(card_id);
- Joystick::WriteConfig();
- Joystick::StartAndEnable();
+
+ i = i + 1;
+ });
+
+ return ret;
}
- UI::CloseDialog();
- return true;
-}
/**
* Joystick configuration dialog.
* Configuration of joystick attached to specified sound card.
- * @param card_id Sound card card_id
+ * @param joy_id Joystick index (in the sysconfig file)
* @param button Label for `next button: `finish, `ok or `next
* @return symbol Id of pressed button in the dialog
*/
- define symbol joy_dialog (integer card_id, symbol button) ``{
-
- // item in joystick types
- string nonejoy = _("No joystick");
-
- if (card_id == nil)
+ define symbol joy_dialog (integer joy_id, symbol button, map sound_card) ``{
+ if (joy_id == nil)
{
return `back;
}
- list jcards = Sound::GetSoundCardListWithJoy();
-
// find card name
- string cardname = "";
- foreach (map<string,any> card, (list<map<string,any> >)jcards, ``{
- if (card["card_no"]:-1 == card_id)
- cardname = card["name"]:"";
- });
+ string cardname = sound_card["model"]:"";
- // dialog header - %1: card name (e.g "Soundblaster 16"), %2: card ID (a number)
- string caption = sformat(_("Joystick Configuration - %1 (snd-card-%2)"), cardname, card_id);
+ // dialog header - %1: card name (e.g "Soundblaster 16")
+ string caption = sformat(_("Joystick Configuration - %1"), cardname);
string helptext =
// help text for joystick configuration 1/4
_("<P>In this dialog, specify your joystick type. If your
joystick type is not in the list, select <B>Generic Analog Joystick</B>.</p>
<p>You will not find any USB joysticks here. If you have a USB device, just plug in the joystick and start using it.</P>
-") +
-
- // help text for joystick configuration 2/4
-_("<P>To remove the configured joystick from the system
-or if you do not have a joystick, select <B>No joystick</B>.</P>
-") +
-
- // help text for joystick configuration 3/4
-_("<P>Press <B>Test</B> to test the functionality of the selected joystick type.</P>") +
-
- // help text for joystick configuration 4/4
-_("<P><B>Note:</B> Connect your joystick to your computer
-before pressing <B>Test</B> or <B>Next</B>.</P>");
+");
- map joy = Joystick::joystick[card_id]:$[];
+ map joy = Joystick::joystick[joy_id]:$[];
string mod = joy["model"]:"";
- y2milestone("Joystick configuration of snd-card-%1 started", card_id);
+ y2milestone("Joystick configuration started, index: %1", joy_id);
// translate model from /etc/sysconfig/joystick
if (mod == Joystick::generic_joystick)
@@ -442,13 +125,8 @@
mod = Joystick::generic_joystick_translated;
}
- // set none joystick
- if (mod == "")
- {
- mod = nonejoy;
- }
-
- joylist = maplist(string modname, list<string> models, JoystickDB, ``(
+ // list of joystick drivers and models
+ list joylist = maplist(string modname, list<string> models, JoystickDB, ``(
maplist(string model, models, ``([modname, model]))
));
joylist = flatten ((list<list>)joylist);
@@ -458,8 +136,6 @@
joylist = prepend (joylist,
["analog", Joystick::generic_joystick_translated]);
- joylist = prepend(joylist, ["", nonejoy]);
-
y2debug("joylist: %1", joylist);
integer index = 0;
@@ -489,9 +165,6 @@
// label above list of joystick types
`SelectionBox(`id(`os), _("&Select your joystick type:"),
boxitems),
- `HSpacing(3),
- // button label
- `PushButton(`id(`test), `opt(`key_F6), _("&Test")),
`HSpacing(3)
),
`VSpacing(3)
@@ -503,6 +176,7 @@
`next : Label::NextButton()
];
+ Wizard::OpenNextBackDialog();
Wizard::SetContents (caption, contents, helptext, true, true);
Wizard::SetNextButton(`next, nextbutton[button]:Label::NextButton() );
if (!Mode::installation()) Wizard::HideBackButton();
@@ -526,22 +200,11 @@
"));
s = `skip;
}
-
- if (s == `test)
- {
- integer idx = (integer) UI::QueryWidget(`id(`os), `CurrentItem);
- string joymod = joylist[idx,0]:"";
- if (joymod == "")
- // error message (no joystick selected)
- Popup::Message(_("Select the joystick to test."));
- else if (Package::InstallAll(["input-utils"]))
- joy_test_popup (card_id, idx, joymod);
- }
-
} while (!contains([`next, `back, `abort, `cancel], s));
if (s == `next)
{
+ integer card_id = find_sound_card_id(sound_card);
string modname = Sound::modules_conf[card_id, "module"]:"";
map joy_entry = Sound::GetJoystickSettings (modname);
integer joymodidx = (integer)UI::QueryWidget(`id(`os),`CurrentItem);
@@ -564,13 +227,13 @@
y2debug("selected joy module: %1, model: %2", joymod, model);
- joy_entry = add (joy_entry, "JOYSTICK_MODULE", joymod);
- joy_entry = add (joy_entry, "model", model);
-
+ joy_entry["JOYSTICK_MODULE"] = joymod;
+ joy_entry["model"] = model;
+ joy_entry["attached_to"] = sound_card["unique_key"]:"";
}
update_sound_card_joy_config (card_id, joymod != "");
- Joystick::joystick[card_id] = joy_entry;
+ Joystick::joystick[joy_id] = joy_entry;
Joystick::modified = true;
y2milestone("New joystick configuration: %1", joy_entry);
@@ -583,9 +246,697 @@
}
if (!Mode::installation()) Wizard::RestoreBackButton();
+ Wizard::CloseDialog();
return s;
}
+ /*
+ * Create unique widget id for a broken joystick config
+ * @param index index of non-working joystick configuration
+ * @return string the ID
+ */
+ define string broken_id(integer index)
+ {
+ return sformat("broken_%1", index);
+ }
+
+ /*
+ * Belogs the ID to a broken joystick?
+ * @param id
+ * @return boolean true if the ID belongs to a broken configuration
+ */
+ define boolean is_broken(string id)
+ {
+ return regexpmatch(id, "broken_[0-9]+");
+ }
+
+ /*
+ * Get the joystick index from broken ID string
+ * @param id
+ * @return integer the ID or nil if the ID do not belong to a broken configuration
+ */
+ define integer broken_index(string id)
+ {
+ string num = regexpsub(id, "broken_([0-9]+)", "\\1");
+
+ if (num == nil)
+ {
+ return nil;
+ }
+
+ return tointeger(num);
+ }
+
+ /*
+ * Create content for the joystick overview table
+ * @return list<map<string,any>> content for WizardHW::SetContents() function
+ */
+ define list<map<string,any> > joystick_table()
+ {
+ list<map<string,any> > content = [];
+ list<map> soundcards = (list<map>)SCR::Read(.probe.sound);
+ list<integer> found_joysticks = [];
+
+ foreach(map js, Joystick::Detected(),
+ {
+ y2milestone("Adding joystick to table: %1", js);
+ string device = js["dev_name2"]:"";
+ string model = js["model"]:"";
+ list<string> descr = [];
+
+ if (js["detail","axes"]:0 > 0)
+ {
+ descr = add(descr, sformat(_("Number of axes: %1"), js["detail","axes"]:0));
+ }
+
+ if (js["detail","buttons"]:0 > 0)
+ {
+ descr = add(descr, sformat(_("Number of buttons: %1"), js["detail","buttons"]:0));
+ }
+
+ string bus = js["bus"]:"";
+
+ // add the sound card name for gameport joysticks
+ if (bus == "Gameport" && size(js["parent_unique_key"]:"") > 0)
+ {
+ string unique_key = js["parent_unique_key"]:"";
+
+ map card = find(map c, soundcards, {return c["unique_key"]:"" == unique_key;});
+
+ if (card != nil)
+ {
+ // joystick details, %1 is the sound card name to which is the joystick connected
+ bus = sformat("%1 (%2)", bus, card["model"]:"");
+ }
+
+ integer i = 0;
+ integer joy_index = nil;
+
+ while(i < 4)
+ {
+ map jconf = Joystick::joystick[i]:$[];
+
+ if (jconf["attached_to"]:"" == unique_key)
+ {
+ joy_index = i;
+ break;
+ }
+
+ i = i + 1;
+ }
+
+ if (joy_index != nil)
+ {
+ map j_config = find(map j, (list<map>)Joystick::joystick, {return j["attached_to"]:"" == unique_key;});
+ string config_model = j_config["model"]:"";
+
+ if (config_model != nil && config_model != "")
+ {
+ y2milestone("Adding joystick model: %1", config_model);
+
+ model = sformat("%1 (%2)", model, config_model);
+ }
+
+ found_joysticks = add(found_joysticks, joy_index);
+ }
+ }
+
+ map<string,any> j = $[
+ "id" : device,
+ "table_descr" : [ model, device, bus ],
+ "rich_descr" : WizardHW::CreateRichTextDescription(model, descr)
+ ];
+
+ content = add(content, j);
+ });
+
+ y2milestone("Found joysticks at indices: %1", found_joysticks);
+
+ integer i = 0;
+ // check non-working joystick configurations
+ foreach(map js, (list<map>)Joystick::joystick, {
+ if (!contains(found_joysticks, i) && js["JOYSTICK_MODULE"]:"" != "")
+ {
+ y2milestone("Found inactive joystick configuration at index %1: %2", i, js);
+ string model = js["model"]:_("Unknown joystick model");
+ string unique_key = js["attached_to"]:"";
+ string bus = "Gameport";
+
+ map card = find(map c, soundcards, {return c["unique_key"]:"" == unique_key;});
+
+ if (card != nil)
+ {
+ // joystick details, %1 is the sound card name to which is the joystick connected
+ bus = sformat("%1 (%2)", bus, card["model"]:"");
+ }
+
+ map<string,any> j = $[
+ "id" : broken_id(i),
+ // the joystick device was not found (the joystick is probably disconnected)
+ "table_descr" : [ model, _("<not found>"), bus ],
+ // add red warning about invalid configuration to the model name (%1)
+ "rich_descr" : WizardHW::CreateRichTextDescription(sformat(_("%1 - <font color=\"red\">Invalid configuration<font>"), model), [
+ // help text
+ _("The configuration is not active - either the joystick is not connected or a wrong driver is used"),
+ // help text
+ _("Press <b>Edit</b> to change the joystick driver or <b>Delete</b> to remove the configuration")
+ ])
+ ];
+
+ content = add(content, j);
+ }
+
+ i = i + 1;
+ });
+
+ return content;
+ }
+
+ /*
+ * Find detected joystick with requested device name
+ * @param device joystick device name (e.g. "/dev/input/js0")
+ * @return map joystick map returned from .probe.joystick agent
+ */
+ map find_joystick(string device)
+ {
+ return find(map j, Joystick::Detected(), {return j["dev_name2"]:"" == device;});
+ }
+
+ /*
+ * Display and run the joystick test dialog
+ * @param device device name of the joystick to test (e.g. "/dev/input/js0")
+ */
+ void test_joystick(string device)
+ {
+ map js = find_joystick(device);
+ if (js == nil)
+ {
+ y2error("Cannot find joystick %1", device);
+ return;
+ }
+
+ // generate appropriate dialog for the joystick
+ term joy_attrib = `VBox();
+ integer min = -32767; // see js_event.value in linux/joystick.h
+ integer max = 32767;
+ integer i = 0;
+
+ while (i < js["detail","axes"]:0)
+ {
+ // progress bar label
+ string widget_name = sformat(_("Axis %1"), i);
+ string widget_id = sformat("Axis %1", i);
+
+ if (UI::HasSpecialWidget(`Slider))
+ {
+ joy_attrib = add(joy_attrib, `Slider(`id(widget_id), `opt(`disabled), widget_name, min, max, 0));
+ }
+ else
+ {
+ joy_attrib = add(joy_attrib, `IntField(`id(widget_id), `opt(`disabled), widget_name, min, max, 0));
+ }
+
+ joy_attrib = add(joy_attrib, `VSpacing(0.3));
+ i = i + 1;
+ }
+
+ term joy_buttons = `HBox();
+ string not_pressed = " ";
+ string pressed = UI::Glyph(`CheckMark);
+
+ i = 0;
+ while (i < js["detail","buttons"]:0)
+ {
+ // label
+ string widget_name = sformat(_("Button %1"), i);
+ string widget_id = sformat ("Button %1", i);
+ joy_buttons = add (joy_buttons,
+ `Label (`id(widget_id), widget_name + " " + not_pressed));
+ joy_buttons = add (joy_buttons, `HSpacing(2));
+ i = i + 1;
+ }
+ joy_attrib = add (joy_attrib, joy_buttons);
+
+ UI::OpenDialog(`opt(`decorated), `HBox(`HSpacing(1.5),
+ `VSpacing(18),
+ `VBox(
+ `HSpacing(50),
+ `VSpacing(1),
+ // Popup label
+ `Heading(_("Joystick Test")),
+ `VSpacing(1),
+ joy_attrib,
+ `VSpacing(1),
+ `PushButton(`id(`done), `opt(`default), Label::OKButton()),
+ `VSpacing(1)
+ ),
+ `HSpacing(1.5)
+ ));
+
+ string command = sformat("/usr/bin/jstest --event '%1'", String::Quote(device));
+ integer process = (integer)SCR::Execute(.process.start_shell, command);
+
+ symbol ret = nil;
+
+ // read the jstest output until "OK" button is pushed
+ do
+ {
+ if (SCR::Read(.process.running, process) == false)
+ {
+ y2error("Unexpected exit");
+ break;
+ }
+
+ string out = (string)SCR::Read(.process.read_line, process);
+
+ if (out != nil)
+ {
+ y2debug("jstest output: %1", out);
+
+ // the output is like "Event: type 2, time 26263500, number 0, value 0"
+ string type_str = regexpsub(out, "type ([0-9]+)", "\\1");
+ string number_str = regexpsub(out, "number ([0-9]+)", "\\1");
+ string value_str = regexpsub(out, "value ([-]{0,1}[0-9]+)", "\\1");
+
+ if (type_str != nil && number_str != nil && value_str != nil)
+ {
+ integer type = tointeger(type_str);
+ integer number = tointeger(number_str);
+ integer value = tointeger(value_str);
+
+ if (type == 1)
+ {
+ // button state changed
+ UI::ChangeWidget(`id(sformat("Button %1", number)), `Value,
+ // label text ("Button" is joystick's button no. %1)
+ sformat(_("Button %1"), number) + " " + (value == 1 ? pressed : not_pressed));
+ }
+ else if (type == 2)
+ {
+ // change in some axis
+ UI::ChangeWidget(`id(sformat ("Axis %1", number)), `Value, value) ;
+ }
+ }
+ }
+ ret = (symbol)UI::PollInput();
+ }
+ while (ret == nil);
+
+ y2milestone ("killing");
+ SCR::Execute(.process.kill, process);
+
+ // release the process from the agent
+ SCR::Execute(.process.release, process);
+
+ UI::CloseDialog();
+ }
+
+ /*
+ * Return list of sound cards with gameport that do not have any joystick configured
+ * @param gameport_cards list of all cards with gameport
+ * @return list list of cards from gameport_cards that don't have any joystick configured
+ */
+ list unconfigured_sound_cards(list gameport_cards)
+ {
+ list ret = filter(map card, (list<map>) gameport_cards, {
+ return find(map j, (list<map>)Joystick::joystick, {return j["attached_to"]:"" == card["unique_key"]:"";}) == nil;
+ });
+
+ y2milestone("Unconfigured gameport cards: %1", ret);
+ return ret;
+ }
+
+ /*
+ * Display dialog for selecting sound card to configure
+ * @param gameport_cards available sound cards with gameport
+ * @returen map the selected card (one from gameport_cards) or nil if [Cancel] was pressed
+ */
+ map select_sound_card(list gameport_cards)
+ {
+ integer i = -1;
+ list tcont = maplist (map card, (list<map>) gameport_cards, {
+ i = i + 1;
+ return `item(
+ `id(i),
+ card["model"]:"Sound card"
+ );
+ });
+
+ term dialog = `HBox(
+ `VSpacing(10),
+ `VBox(
+ `Heading(_("Sound Cards with Joystick Support")),
+ `Table(`id(`cards), `header(
+ // table header (card name)
+ _("Sound card")
+ ),
+ tcont
+ ),
+ `Label(_("To add an USB joystick close this dialog and just connect it.")),
+ `ButtonBox(
+ // button label
+ `PushButton(`id(`ok), _("&Configure joystick")),
+ `PushButton(`id(`cancel), Label::CancelButton())
+ )
+ )
+ );
+
+ UI::OpenDialog(`opt(`decorated), dialog);
+
+ // preselect the first card
+ UI::ChangeWidget(`id(`cards), `CurrentItem, 0);
+
+ symbol ret = (symbol) UI::UserInput();
+
+ integer joy_card = (integer) UI::QueryWidget(`id(`cards), `CurrentItem);
+ y2milestone("Selected sound card: %1", joy_card);
+
+ UI::CloseDialog();
+
+ if (ret == `cancel || ret == `abort) {
+ y2milestone("Sound card selection canceled");
+ return nil;
+ }
+
+ return gameport_cards[joy_card]:$[];
+ }
+
+ /*
+ * Is the selected joystick connected via USB?
+ * @param device joystick device name (e.g. "/dev/input/js0")
+ * @reurn boolean true if the device is an USB joystick
+ */
+ boolean is_usb(string device)
+ {
+ map js = find_joystick(device);
+ if (js == nil) return false;
+
+ return js["bus"]:"" == "USB";
+ }
+
+ /*
+ * Find joystick index which is attached to a sound card
+ * @param parent_id the unique key of the sound card
+ * @return the index or nil if the sound card was not found
+ */
+ integer find_joystick_number(string parent_id)
+ {
+ integer i = 0;
+ boolean found = false;
+
+ foreach(map j, (list<map>)Joystick::joystick, {
+ if (j["attached_to"]:"" == parent_id)
+ {
+ found = true;
+ break;
+ }
+ i = i + 1;
+ });
+
+ integer ret = i;
+
+ if (!found)
+ {
+ ret = nil;
+ }
+ y2milestone("Joystick index with parent id %1: %2", parent_id, ret);
+
+ return ret;
+ }
+
+ /*
+ * Find the index of the first unused joystick configuration
+ * @return integer the index or nil when all configs are already used
+ */
+ integer find_free_number()
+ {
+ integer i = 0;
+ boolean found = false;
+
+ foreach(map j, (list<map>)Joystick::joystick, {
+ if (j["JOYSTICK_MODULE"]:"" == "")
+ {
+ found = true;
+ break;
+ }
+ i = i + 1;
+ });
+
+ integer ret = i;
+
+ if (!found)
+ {
+ ret = nil;
+ }
+ y2milestone("Unconfigured joystick at index: %1", ret);
+
+ return ret;
+ }
+
+ /*
+ * Save one joystick configuration and restart the joystick service to reload drivers
+ * @param num index of the joystick configuration to change
+ */
+ define void restart_joystick(integer num)
+ {
+ // restart joystick service to reload the driver
+ Joystick::Stop();
+ Joystick::SaveOneJoystick(num);
+ Joystick::WriteConfig();
+ Joystick::StartAndEnable();
+
+ // re-detect attached joysticks
+ Joystick::Detect();
+ }
+
+ /*
+ * Refresh the joystick table in the main configuration dialog
+ */
+ define void refresh_table()
+ {
+ list<map<string,any> > items = joystick_table();
+ WizardHW::SetContents(items);
+ }
+
+ /*
+ * Return the list of detected sound cards that support gameport
+ * @return list<map> list of devices (as returned by .probe.sound agent)
+ */
+ list<map> sound_cards_with_joystick()
+ {
+ list<map> sound_cards = (list<map>)SCR::Read(.probe.sound);
+
+ sound_cards = filter(map sound_card, sound_cards, {
+ string driver = get_module(sound_card)["name"]:"";
+
+ if (driver == nil || driver == "")
+ {
+ driver = String::Replace(sound_card["driver_module"]:"", "_", "-");
+ }
+
+ return Sound::db_modules[driver, "joystick"]:$[] != $[];
+ });
+
+ return sound_cards;
+ }
+
+ /*
+ * Return modification time of /dev/input directory
+ * @return integer mtime in seconds
+ */
+ integer input_mtime()
+ {
+ return ((map)SCR::Read(.target.stat, "/dev/input"))["mtime"]:0;
+ }
+
+ /*
+ * Display and run the main joystick dialog
+ * @return symbol the final user input
+ */
+ define symbol joystick_overview()
+ {
+ list<list> extra_buttons = [
+ // menu item
+ [`test, _("&Test selected joystick...")],
+ ];
+
+ // dialog title
+ WizardHW::CreateHWDialog(_("Joysticks"),
+ // help text
+ _("<p><big><b>Joysticks</b></big></p>")
+ + _("<p>Here is an overview of the detected joysticks.</p>")
+ + _("<p>To configure a new joystick connected to a Gameport press <b>Add</b> button.</p>")
+ + "<p>" + usb_notice + "</p>",
+ // table header
+ [_("Model"), _("Device name"), _("Attached to")],
+ extra_buttons
+ );
+
+ // create description for WizardHW
+ list<map<string,any> > items = joystick_table();
+ y2debug("items: %1", items);
+
+ WizardHW::SetContents(items);
+
+ Wizard::SetNextButton(`next, Label::FinishButton());
+
+ symbol ret = `dummy;
+ integer mtime = input_mtime();
+
+ while (!contains([`abort, `back, `next],ret))
+ {
+ ret = (symbol)UI::TimeoutUserInput(2000);
+
+ // no user input, check for hotplug changes
+ if (ret == `timeout)
+ {
+ integer current_mtime = input_mtime();
+
+ if (current_mtime != mtime)
+ {
+ // /dev/input has changed - rescan joysticks and refresh the table
+ y2milestone("/dev/input has been changed, rescanning devices...");
+
+ Joystick::Detect();
+ refresh_table();
+
+ mtime = current_mtime;
+ }
+
+ continue;
+ }
+
+ if (ret == `cancel) ret = `abort;
+
+ string device = WizardHW::SelectedItem();
+
+ if (ret == `add)
+ {
+ list<map> jcards = sound_cards_with_joystick();
+ y2milestone("Sound cards with gameport: %1", jcards);
+
+ // no sound card with gameport
+ if (size(jcards) == 0)
+ {
+ string message = _("There is no soundcard with joystick support (gameport).")
+ + "\n" + usb_notice;
+
+ Popup::Message(message);
+ }
+ else
+ {
+ // remove configured cards with joystick
+ list unconfigured = unconfigured_sound_cards(jcards);
+ y2milestone("Gamport sound cards without joystick: %1", unconfigured);
+
+ if (size(unconfigured) == 0)
+ {
+ string message = _("There is no soundcard with unconfigured joystick.")
+ + "\n" + usb_notice;
+
+ Popup::Message(message);
+ }
+ else
+ {
+ // if there is just one card just use it otherwise ask user
+ map card = (size(unconfigured) == 1) ? unconfigured[0]:$[] : select_sound_card(unconfigured);
+ integer joy_index = find_free_number();
+
+ // selection canceled?
+ if (card != nil)
+ {
+ joy_dialog(joy_index, `ok, card);
+
+ restart_joystick(joy_index);
+
+ refresh_table();
+ }
+ }
+ }
+ }
+ else if (ret == `edit)
+ {
+ if (is_usb(device))
+ {
+ // popup message - pressed [Edit] when an USB joystick is selected
+ Popup::Message("USB joysticks do not need any configuration.");
+ }
+ else
+ {
+ integer num = nil;
+ string key = "";
+
+ if (is_broken(device))
+ {
+ num = broken_index(device);
+ map j = Joystick::joystick[num]:$[];
+ key = j["attached_to"]:"";
+ }
+ else
+ {
+ key = find_joystick(device)["parent_unique_key"]:"";
+ num = find_joystick_number(key);
+ }
+
+ list<map> soundcards = (list<map>)SCR::Read(.probe.sound);
+ map card = find(map c, soundcards, {return c["unique_key"]:"" == key;});
+ symbol ui = joy_dialog(num, `ok, card);
+
+ if (ui == `next || ui == `finish)
+ {
+ // restart joystick service to reload the driver
+ restart_joystick(num);
+
+ // refresh table content
+ refresh_table();
+ }
+ }
+ }
+ else if (ret == `delete)
+ {
+ if (is_usb(device))
+ {
+ // popup message - pressed [Delete] when an USB joystick is selected
+ Popup::Message("USB joysticks cannot be deleted, just unplug them.");
+ }
+ else
+ {
+ integer num = is_broken(device) ? broken_index(device)
+ : find_joystick_number(find_joystick(device)["parent_unique_key"]:"");
+
+ y2milestone("Deleting joystick %1 (index %2)", device, num);
+
+ // modify joystick config
+ Joystick::joystick[num] = $[];
+ Joystick::modified = true;
+
+ // restart joystick service to reload the driver
+ restart_joystick(num);
+
+ // refresh table content
+ refresh_table();
+ }
+ }
+ else if (ret == `test)
+ {
+ if (is_broken(device))
+ {
+ // error popup
+ Popup::Error(_("The selected joystick configuration is not active.\n\nThe joystick cannot be tested."));
+ }
+ else
+ {
+ test_joystick(device);
+ }
+ }
+ }
+
+ y2milestone("Final joystick config: %1", Joystick::joystick);
+ y2milestone("Joystick overview result: %1", ret);
+
+ return ret;
+ }
+
/* EOF */
}
Modified: trunk/sound/sound/src/joystick.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/sound/sound/src/joystick.ycp?rev…
==============================================================================
--- trunk/sound/sound/src/joystick.ycp (original)
+++ trunk/sound/sound/src/joystick.ycp Tue Oct 11 09:43:49 2011
@@ -33,12 +33,6 @@
include "sound/joy_dialog.ycp";
include "sound/write_routines.ycp";
- // selected soundcard id
- integer selected_card = nil;
-
- // label for `next button in joystick configuration dialog
- symbol label = `next;
-
// abort block for read/write dialogs
block<boolean> abort_block = ``{ return false; };
@@ -53,133 +47,11 @@
}
/**
- * First cofiguration dialog - if more than one sound card which support
- * joystick is found display them, if there is exactly one card skip to
- * joystick selection, if no card was found ask user to start
- * sound configuration module.
+ * Display joystick configuration - the main dialog
* @return symbol Symbol of pressed button
*/
define symbol joystick_configuration() ``{
-
- // helptext
- string helptext = _("<P>Two or more sound cards in your system support joysticks.</P>
-<P>To configure a joystick, select the sound card and press <B>Configure Joystick</B>.</P>
-");
-
- if (label == `ok)
- {
- // one joystick already configured - end
- return `next;
- }
-
- // get list of installed sound cards
- list cards = Sound::GetSoundCardList();
-
- // cards which support joysticks
- list filtered = Sound::GetSoundCardListWithJoy();
-
- y2milestone("Configured sound cards: %1", cards);
- y2milestone("Cards with joystick support: %1", filtered);
-
- if (Mode::test() == true)
- {
- cards = [
- $["card_no":0, "name":"VIA 82C686A/B"],
- $["card_no":1, "name":"Sound Blaster Live!"]];
- filtered = [
- $["card_no":0, "name":"VIA 82C686A/B"],
- $["card_no":1, "name":"Sound Blaster Live!"]];
- }
- if (size(filtered) == 1) // one sound card
- {
- selected_card = filtered[0, "card_no"]:0;
- label = `ok;
-
- // skip to configuration dialog if exactly one card was found
- return `config;
- }
- else if (size(filtered) == 0) // no sound card
- {
- // dialog label
- Wizard::SetContents(_("Joystick Configuration"), `Empty(), "",
- false, false);
-
- string message = (size(cards) > 0) ?
- // popup message text
- _("The configured cards do not support the joystick.") :
- // popup message text
- _("No configured sound card was found.");
-
- // yesno popup message text
- message = message + "\n" + _("Start sound card configuration?");
-
- if (Popup::YesNoHeadline(
- // popup message headline
- _("No joystick port to configure was found."), message))
- {
- // start sound module - joystick can be configured there
- // so after sound config abort this module
- WFM::CallFunction("sound", []);
- }
- return `abort;
- }
- else // more sound cards
- {
- list tcont = maplist (map card, (list<map>) filtered, ``{
- map jconf = Joystick::joystick[ card["card_no"]:0 ]:$[];
- string jmodel = jconf["model"]:"";
-
- // translate generic joystick
- if (jmodel == Joystick::generic_joystick)
- jmodel = Joystick::generic_joystick_translated;
-
- return `item(
- `id(card["card_no"]:0),
- sformat("%1", card["card_no"]:0),
- card["name"]:"Sound card",
- jmodel
- );
- });
-
- term dialog = `VBox(
- `Table(`id(`cards), `header(
- // table header (number)
- _("No."),
- // table header (card name)
- _("Sound card"),
- // table header (joystick type)
- _("Joystick")), tcont
- ),
- // button label
- `PushButton(`id(`config), _("&Configure joystick"))
- );
-
- Wizard::SetContents(
- // dialog caption
- _("Configured Sound Cards with Joystick Support"),
- dialog, helptext, true, true);
-
- Wizard::SetNextButton(`next, Label::NextButton() );
-
- // preselect first card
- UI::ChangeWidget (`id(`cards),`CurrentItem,filtered[0,"card_no"]:0);
- }
- symbol ret = nil;
-
- do
- {
- ret = (symbol) UI::UserInput();
- }
- while (ret != `next && ret != `abort && ret != `back &&
- ret != `cancel && ret != `config);
-
- if (ret == `cancel)
- {
- ret = `abort;
- }
- selected_card = (integer) UI::QueryWidget(`id(`cards), `CurrentItem);
-
- return ret;
+ return joystick_overview();
}
/**
@@ -198,43 +70,54 @@
return `next;
}
+ // revert the joystick configuration back to the original state after pressing Abort
+ symbol revert_config()
+ {
+ if (Joystick::Changed())
+ {
+ y2milestone("Reverting joystick configuration");
+ Joystick::Revert();
+
+ saveconfig();
+ }
+
+ // the Abort button has been pressed, just pass it further
+ return `abort;
+ }
+
/********************** MAIN ************************/
symbol StartGUI()
{
// sequence of dialogs
map sequence = $[
- "ws_start" : "detect",
+ "ws_start" : "config",
- "detect" : $[
+ "config" : $[
`next : "save",
- `abort : `abort,
- `config : "joystick"
- ],
-
- "joystick" : $[
- `abort : `abort,
- `next : "detect"
+ `abort : "revert",
],
"save" : $[
`next : `ws_finish
+ ],
+
+ "revert" : $[
+ `abort : `abort
]
];
// aliases for dialogs
map aliases = $[
- "detect" : ``(joystick_configuration()),
- "joystick" : [ ``(joy_dialog(selected_card, label)), true ],
- "save" : ``(saveconfig())
+ "config" : ``(joystick_configuration()),
+ "save" : ``(saveconfig()),
+ "revert" : ``(revert_config())
];
// create wizard dialog
Wizard::CreateDialog();
Wizard::SetDesktopTitleAndIcon("joystick");
- Wizard::SetAbortButton(`abort, Label::CancelButton());
-
// read sound card configuration
boolean progress_orig = Progress::set(false);
Modified: trunk/sound/sound/src/ui.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/sound/sound/src/ui.ycp?rev=66373…
==============================================================================
--- trunk/sound/sound/src/ui.ycp (original)
+++ trunk/sound/sound/src/ui.ycp Tue Oct 11 09:43:49 2011
@@ -47,11 +47,9 @@
* @param name card model
* @param cname alias for modules conf
* @param cpos position of the card
- * @param has_joy If true checkbox for joystick configuration is added
* @return term with widget
*/
- define term AutoconfDlg (string name, string cname, integer cpos,
- boolean has_joy) ``{
+ define term AutoconfDlg (string name, string cname, integer cpos) {
string clab = "";
if (cpos < 3)
{
@@ -63,10 +61,6 @@
cpos + 1);
}
- term jcheckbox = (!has_joy) ? `Empty() :
- // push button label
- `Left (`CheckBox(`id(`joystick), _("&Configure joystick")));
-
term con = `VBox (
`VSpacing (1),
// this is the first part of message "The sound card 'cardname'
@@ -87,11 +81,9 @@
`VSpacing (0.3),
`RadioButton (`id (`options), `opt (`hstretch, `notify),
// radio button label - type of setup
- _("Advanced setup with possibility to change &options")),
- `VSpacing (3),
- jcheckbox
+ _("Advanced setup with possibility to change &options"))
))
- ),
+ ),
`VStretch ()
);
return con;
@@ -104,14 +96,12 @@
* @param cname sound card alias for modules conf
* @param cpos cards position
* @param flags enable/disable radiobuttons accordingly
- * @param has_joy sound card supports joystick
* @return map symbol of next dialog
*/
- define map DisplayName (string name, string cname, integer cpos,
- integer flags, boolean has_joy) ``{
+ define map DisplayName (string name, string cname, integer cpos, integer flags) {
string helptext = Sound::STRINGS["DisplayName"]:"";
- term con = AutoconfDlg (name, cname, cpos, has_joy);
+ term con = AutoconfDlg (name, cname, cpos);
// dialog header
Wizard::SetContents (_("Sound Card Configuration"), con,
helptext, true, true);
@@ -165,122 +155,8 @@
{
output = `next;
}
- if (has_joy == true)
- {
- Sound::conf_joystick =
- (boolean)UI::QueryWidget(`id(`joystick), `Value);
- }
- else
- {
- Sound::conf_joystick = false;
- }
}
return $["ui" : output];
}
- /**
- * quick conf dialog widget
- * @param name card model
- * @param cname card alias for module.conf
- * @param cpos card position
- * @param has_joy If true checkbox for joystick configuration is added
- * @return term widget
- */
- define term QuickconfDlg (string name, string cname, integer cpos,
- boolean has_joy) ``{
- string clab = "";
- if (cpos < 3)
- {
- clab = "\n" + sformat(Sound::STRINGS["soundCount", cpos]:"", cname);
- }
- else
- {
- clab = "\n" + sformat(Sound::STRINGS["soundCount", 3]:"", cname, cpos + 1);
- }
-
- term jcheckbox = (!has_joy) ? `Empty() :
- // push button label
- `Left (`CheckBox(`id(`joystick), _("&Configure joystick")));
-
- term con = `VBox (
- `VSpacing (1),
- // this is the first part of message "The sound card 'cardname'
- // will be configured as the first snd card"
- `Label (`opt (`hstretch), _("The sound card\n")),
- `HBox (`HSpacing (5), `Label (`opt (`hstretch), name)),
- `Label (`opt (`hstretch), clab),
- `VSpacing (1),
- `HBox (`HSpacing (5),
- `RadioButtonGroup (`id (`action),`VBox (
- `RadioButton (`id (`quick), `opt (`hstretch, `notify),
- // radio button label - type of setup
- _("&Quick automatic setup"), true),
- `VSpacing (0.3),
- `RadioButton (`id (`normal), `opt (`hstretch, `notify),
- // radio button label - type of setup
- _("Normal &setup")),
- `VSpacing (0.3),
- `RadioButton (`id (`intro), `opt (`hstretch, `notify),
- // radio button label - type of setup
- _("&More detailed installation of sound cards")),
- `VSpacing(3),
- jcheckbox
- ))
- ),
- `VStretch ()
- );
- return con;
- }
-
-
- /**
- * quick config dialog (is shown when only one card has been detected0
- * @param name card model
- * @param cname alias for modules conf
- * @param cpos position of the soud card
- * @param has_joy set to true if configured card supports joystick
- * @return map symbol for next dialog
- */
- define map quickConfig(string name, string cname, integer cpos,
- boolean has_joy) ``{
-
- string helptext = Sound::STRINGS["quickConfig"]:"";
- term con = QuickconfDlg (name, cname, cpos, has_joy);
- // dialog header
- Wizard::SetContents (_("Sound Card Configuration"), con,
- helptext, true, true);
- Wizard::RestoreNextButton();
-
- symbol input = `quick;
-
- do {
- if (input == `cancel || input == `abort)
- {
- if (ReallyAbort())
- {
- return $["ui" : `abort];
- }
- }
- input = (symbol) UI::UserInput();
-
- } while (input != `next && input != `back);
-
- symbol output = input;
- if (input == `next)
- {
- if (has_joy == true)
- {
- Sound::conf_joystick =
- (boolean) UI::QueryWidget(`id(`joystick), `Value);
- }
- else
- {
- Sound::conf_joystick = false;
- }
- output = (symbol) UI::QueryWidget(`id(`action), `CurrentButton);
- }
- return $["ui" : output];
- }
-
-
}//EOF
Modified: trunk/sound/sound/src/volume.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/sound/sound/src/volume.ycp?rev=6…
==============================================================================
--- trunk/sound/sound/src/volume.ycp (original)
+++ trunk/sound/sound/src/volume.ycp Tue Oct 11 09:43:49 2011
@@ -174,23 +174,6 @@
}
}
}
- else if (ui == `next && Sound::conf_joystick && !Mode::config())
- {
- symbol ret = joy_dialog(card_id, `next);
- if (ret == `back)
- {
- con = VolumeCon(save_entry, vol);
- // dialog header
- Wizard::SetContents (_("Sound Card Volume"), con,
- help_text, true, true);
- continue;
- }
- else
- {
- ui = ret;
- break;
- }
- }
else if (ui == `abort || ui == `cancel)
{
if (ReallyAbort())
@@ -350,20 +333,7 @@
}
if (!quick)
{
- while (true)
- {
- ui = VolumeDialog (save_entry, finish, card_id);
- if (ui != `joystick)
- {
- break;
- }
- symbol s = joy_dialog (card_id, `next);
- if (s == `abort || s == `cancel)
- {
- ui = `abort;
- break;
- }
- }
+ ui = VolumeDialog (save_entry, finish, card_id);
}
else
{
@@ -393,11 +363,6 @@
setVolume ("Speaker", card_id, devs["Speaker"]:Sound::default_volume);
}
-
- if (Sound::conf_joystick == true && Sound::use_ui)
- {
- joy_dialog(card_id, `next);
- }
ui = `next;
}
if (!Mode::config() && !Mode::autoinst())
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
![](https://seccdn.libravatar.org/avatar/60813f3f932f58dedcb16c313b400a2e.jpg?s=120&d=mm&r=g)
[yast-commit] r66372 - /trunk/installation/src/inst_finish/copy_logs_finish.ycp
by jsuchome@svn2.opensuse.org 11 Oct '11
by jsuchome@svn2.opensuse.org 11 Oct '11
11 Oct '11
Author: jsuchome
Date: Tue Oct 11 09:04:05 2011
New Revision: 66372
URL: http://svn.opensuse.org/viewcvs/yast?rev=66372&view=rev
Log:
extra char
Modified:
trunk/installation/src/inst_finish/copy_logs_finish.ycp
Modified: trunk/installation/src/inst_finish/copy_logs_finish.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/inst_finish/cop…
==============================================================================
--- trunk/installation/src/inst_finish/copy_logs_finish.ycp (original)
+++ trunk/installation/src/inst_finish/copy_logs_finish.ycp Tue Oct 11 09:04:05 2011
@@ -61,7 +61,7 @@
string target_basename = sformat( "y2log-%1", target_no );
InjectRenamedFile( Directory::logdir, file, target_basename );
- string compress_cmd = sformat("gzip %1/%2/%3", Installation::destdir, Directory::logdir, target_basename));
+ string compress_cmd = sformat("gzip %1/%2/%3", Installation::destdir, Directory::logdir, target_basename);
WFM::Execute (.local.bash, compress_cmd);
}
else if ( regexpmatch (file, "^y2log-[0-9]+\\.gz$"))
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0