You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

Main Files (Present in directory mentioned next to them)

[1] ajaxkeys.js : /usr/share/cloudstack-common/systemvm/js/

[2] ajaxkviewer.js : /usr/share/cloudstack-common/systemvm/js/

[3] consoleKeyboardOptions.jsp : /usr/share/cloudstack-management/webapps/client/

References

[1] Support for non-US keyboards in Console Proxy


Note : Bold Italic designates added/modified values

 

After the framework changes as mentioned in [1], It is easier to add support for non-US keyboard for console proxy. To do so one has to just add the mappings for their locale keyboard in one designated file.

Glossary:

RAW keyboard

    Primarily translates KeyDown/KeyUp event, either as is (if there is no mapping entry) or through mapped result.
For KeyPress event, it translates it only if there exist a mapping entry in jsX11KeysymMap map and the entry meets the condition 

Example of this kind of keyboard are JP


COOKED keyboard 

       Primarily translates KeyPress event, either as is or through mapped result.
       It translates KeyDown/KeyUp only there exists a mapping entry,
       or if there is no mapping entry, translate when certain modifier key is pressed (i.e., CTRL or ALT key)

Example for this type of keyboard are US, UK, FR


Mapping entry types
direct : will be directly mapped into the entry value with the same event type
boolean : only valid for jsX11KeysymMap, existence of this type, no matter true or false
in value, corresponding KeyDown/KeyUp event will be masked
array : contains a set of conditional mapping entry

Conditional mapping entry

{
type: <event type>, code: <mapped key code>, modifiers: <modifiers>,
shift : <shift state match condition>, -- match on shift state
guestos : <guest os match condition>, -- match on guestos type
browser: <browser type match condition>, -- match on browser
browserVersion: <brower version match condition> -- match on browser version
guestosDisplayName: <guest os display name condition> -- matches on specific version of guest os
provide the guest os display name substring to uniquely identify version
for example if guestosDisplayName CentOS 5.2 (32-bit), then to match this condition
give unique substring to identify like 5.2 or CentOS 5.2 etc.
hypervisor: <hypervisor match condition> --match on hypervisor
hypervisorVersion: <hypervisor version match condition> --match on hypervisor version
}

 

Changes needs to be done in consoleKeyboardOptions.jsp

To add new keyboard for console proxy add the corresponding parameters in  file [3] consoleKeyboardOptions.jsp. Option added here will be displayed while deploying VM.

for example say  file [3] consoleKeyboardOptions.jsp is looking like below

 <option value="us"><fmt:message key="label.standard.us.keyboard" /></option>
 <option value="uk"><fmt:message key="label.uk.keyboard" /></option>
 <option value="jp"><fmt:message key="label.japanese.keyboard" /></option>
 <option value="fr">French AZERTY keyboard</option>

Then to add keyboard for simplified chinese add the line as follows

 <option value="us"><fmt:message key="label.standard.us.keyboard" /></option>
 <option value="uk"><fmt:message key="label.uk.keyboard" /></option>
 <option value="jp"><fmt:message key="label.japanese.keyboard" /></option>
 <option value="fr">French AZERTY keyboard</option>
<option value="sc"><fmt:message key="label.simplified.chinese.keyboard" /></option>

 

Changes needs to be done in ajaxkeys.js

Add the keyboard in  file [1] ajaxkeys.js also. Where to add the keyboard option in file [1] ajaxkeys.js will depend upon your keyboard layout.

We divide the keyboard layout into two categories cooked keyboard and raw keyboard as mentioned in glossary

To add the cooked keyboard type, add in below section in ajakeys.js

var cookedKeyboardTypes = {"us":"Standard (US) keyboard",

                                                                 "uk":"UK keyboard",

                                              "fr":"French AZERTY keyboard"}

and to add the raw keyboard type add in section 

 var rawKeyboardTypes = {"jp":"Japanese keyboard"}

Make sure key is same as value in consoleKeyboardOptions.jsp

Say if you consider simplified Chinese of type raw keyboard then add it as follow

var rawKeyboardTypes = {"jp":"Japanese keyboard",

                                          "sc":"Simplified Chinese keyboard"}

Make a note "sc" key is same as value in file [3] consoleKeyboardOptions.jsp

It will be good practice to add the constant for your keyboard. To do so add constant in below section. For example to add constant for simplified Chinese add it as shown below

 

Add the constant for your keyboard type in section.

KEYBOARD_TYPE_COOKED = "us";

KEYBOARD_TYPE_JP = "jp";

KEYBOARD_TYPE_UK = "uk";

KEYBOARD_TYPE_FR = "fr";

KEYBOARD_TYPE_SC = "sc";


After the adding keyboard in one of above categories its time to define the key mappings. Focus should be on those keys which are not working by default.

To do so create index for your keyboard as shown below

Say your ajaxkeys.js looks like as shown below,

 

var keyboardTables = [
{tindex: 0, keyboardType: KEYBOARD_TYPE_COOKED, mappingTable:
{X11: [ .............
],
keyPress: [ ...........
]
}
},
{tindex: 1, keyboardType: KEYBOARD_TYPE_UK, mappingTable:
{X11: [ .............
],
keyPress: [ ...........
]
}
},
{tindex: 2, keyboardType: KEYBOARD_TYPE_JP, mappingTable:
{X11: [ .............
],
keyPress: [ ...........
]
}
}

Then after modification it will look like

 

var keyboardTables = [
{tindex: 0, keyboardType: KEYBOARD_TYPE_COOKED, mappingTable:
{X11: [ .............
],
keyPress: [ ...........
]
}
},
{tindex: 1, keyboardType: KEYBOARD_TYPE_UK, mappingTable:
{X11: [ .............
],
keyPress: [ ...........
]
}
},
{tindex: 2, keyboardType: KEYBOARD_TYPE_JP, mappingTable:
{X11: [ .............
],
keyPress: [ ...........
]
}
},

{tindex: 3, keyboardType: KEYBOARD_TYPE_SC, mappingTable:

               {X11: [ .............

                     ],

                keyPress: [ ...........

                        ]

               }

           }

]

Here KEYBOARD_TYPE_SC is constant "sc" as defined above.

After creating index its time to add the conditional map entries into X11 and keyPress array. It will depend on your keyboard in which you want to put your conditional entries.

Conditional map entries looks like

{keycode: 34,      entry: 0x40,   guestos: "windows"},
{keycode: 160,  entry : 0x5e,  guestos: "windows",    browser: "Firefox"},

Here keycode is input keycode and entry is output which will determine the key shown on VM console. This entry will only applied if it matches condition which are mentioned next to it.

Here in first entry condition is guestos: "windows" i.e. match only if guestos is windows while in second conditional map entry one more condition is added that match only if guestos is windows and browser is firefox. 

Conditional mapping entries can be defined on the conditions which are mentioned in glossary conditional mapping entry.

 

Possible values for conditional mapping entry conditions

These values are taken from guest_os_category table in cloud DB of CloudStack.

guestos : CentOS, Debian, Oracle, RedHat, SUSE, Windows, Other, Novel, Unix, Ubuntu, None

 

Possible Value for guestOsDisplayName

These values are taken from display_name column in guest_os table. To see current list of guest os available refer the CloudStack documents. Or this can be seen from os Type in template details or while registering template

CentOS 4.5 (32-bit) 
CentOS 4.6 (32-bit)
CentOS 4.7 (32-bit)
CentOS 4.8 (32-bit)
CentOS 5.0 (32-bit)
CentOS 5.0 (64-bit)
CentOS 5.1 (32-bit)
CentOS 5.1 (64-bit)
CentOS 5.2 (32-bit)
CentOS 5.2 (64-bit)
CentOS 5.3 (32-bit)
CentOS 5.3 (64-bit)
CentOS 5.4 (32-bit)
CentOS 5.4 (64-bit)
Debian GNU/Linux 5.0 (64-bit)
Oracle Enterprise Linux 5.0 (32-bit)
Oracle Enterprise Linux 5.0 (64-bit)
Oracle Enterprise Linux 5.1 (32-bit)
Oracle Enterprise Linux 5.1 (64-bit)
Oracle Enterprise Linux 5.2 (32-bit)
Oracle Enterprise Linux 5.2 (64-bit)
Oracle Enterprise Linux 5.3 (32-bit)
Oracle Enterprise Linux 5.3 (64-bit)
Oracle Enterprise Linux 5.4 (32-bit)
Oracle Enterprise Linux 5.4 (64-bit)
Red Hat Enterprise Linux 4.5 (32-bit)
Red Hat Enterprise Linux 4.6 (32-bit)
Red Hat Enterprise Linux 4.7 (32-bit)
Red Hat Enterprise Linux 4.8 (32-bit)
Red Hat Enterprise Linux 5.0 (32-bit)
Red Hat Enterprise Linux 5.0 (64-bit)
Red Hat Enterprise Linux 5.1 (32-bit)
Red Hat Enterprise Linux 5.1 (64-bit)
Red Hat Enterprise Linux 5.2 (32-bit)
Red Hat Enterprise Linux 5.2 (64-bit)
Red Hat Enterprise Linux 5.3 (32-bit)
Red Hat Enterprise Linux 5.3 (64-bit)
Red Hat Enterprise Linux 5.4 (32-bit)
Red Hat Enterprise Linux 5.4 (64-bit)
SUSE Linux Enterprise Server 9 SP4 (32-bit)
SUSE Linux Enterprise Server 10 SP1 (32-bit)
SUSE Linux Enterprise Server 10 SP1 (64-bit)
SUSE Linux Enterprise Server 10 SP2 (32-bit)
SUSE Linux Enterprise Server 10 SP2 (64-bit)
SUSE Linux Enterprise Server 10 SP3 (64-bit)
SUSE Linux Enterprise Server 11 (32-bit)
SUSE Linux Enterprise Server 11 (64-bit)
Windows 7 (32-bit)
Windows 7 (64-bit)
Windows Server 2003 Enterprise Edition(32-bit)
Windows Server 2003 Enterprise Edition(64-bit)
Windows Server 2008 (32-bit)
Windows Server 2008 (64-bit)
Windows Server 2008 R2 (64-bit)
Windows 2000 Server SP4 (32-bit)
Windows Vista (32-bit)
Windows XP SP2 (32-bit)
Windows XP SP3 (32-bit)
Other Ubuntu (32-bit)
Other (32-bit)
Windows 2000 Server
Windows 98
Windows 95
Windows NT 4
Windows 3.1
Red Hat Enterprise Linux 3(32-bit)
Red Hat Enterprise Linux 3(64-bit)
Open Enterprise Server
Asianux 3(32-bit)
Asianux 3(64-bit)
Debian GNU/Linux 5(64-bit)
Debian GNU/Linux 4(32-bit)
Debian GNU/Linux 4(64-bit)
Other 2.6x Linux (32-bit)
Other 2.6x Linux (64-bit)
Novell Netware 6.x
Novell Netware 5.1
Sun Solaris 10(32-bit)
Sun Solaris 10(64-bit)
Sun Solaris 9(Experimental)
Sun Solaris 8(Experimental)
FreeBSD (32-bit)
FreeBSD (64-bit)
SCO OpenServer 5
SCO UnixWare 7
Windows Server 2003 DataCenter Edition(32-bit)
Windows Server 2003 DataCenter Edition(64-bit)
Windows Server 2003 Standard Edition(32-bit)
Windows Server 2003 Standard Edition(64-bit)
Windows Server 2003 Web Edition
Microsoft Small Bussiness Server 2003
Windows XP (32-bit)
Windows XP (64-bit)
Windows 2000 Advanced Server
SUSE Linux Enterprise 8(32-bit)
SUSE Linux Enterprise 8(64-bit)
Other Linux (32-bit)
Other Linux (64-bit)
Other Ubuntu (64-bit)
Windows Vista (64-bit)
DOS
Other (64-bit)
OS/2
Windows 2000 Professional
Red Hat Enterprise Linux 4(64-bi
SUSE Linux Enterprise 9(32-bit)
SUSE Linux Enterprise 9(64-bit)
SUSE Linux Enterprise 10(32-bit)
SUSE Linux Enterprise 10(64-bit)
CentOS 5.5 (32-bit)
CentOS 5.5 (64-bit)
Red Hat Enterprise Linux 5.5 (32-bit)
Red Hat Enterprise Linux 5.5 (64-bit)
Fedora 13
Fedora 12
Fedora 11
Fedora 10
Fedora 9
Fedora 8
Ubuntu 10.04 (32-bit)
Ubuntu 9.10 (32-bit)
Ubuntu 9.04 (32-bit)
Ubuntu 8.10 (32-bit)
Ubuntu 8.04 (32-bit)
Ubuntu 10.04 (64-bit)
Ubuntu 9.10 (64-bit)
Ubuntu 9.04 (64-bit)
Ubuntu 8.10 (64-bit)
Ubuntu 8.04 (64-bit)
Red Hat Enterprise Linux 2
Debian GNU/Linux 6(32-bit)
Debian GNU/Linux 6(64-bit)
Oracle Enterprise Linux 5.5 (32-bit)
Oracle Enterprise Linux 5.5 (64-bit)
Red Hat Enterprise Linux 6.0 (32-bit)
Red Hat Enterprise Linux 6.0 (64-bit)
None
Other PV (32-bit)
Other PV (64-bit)
CentOS 5.6 (32-bit)
CentOS 5.6 (64-bit)
CentOS 6.0 (32-bit)
CentOS 6.0 (64-bit)
Oracle Enterprise Linux 5.6 (32-bit)
Oracle Enterprise Linux 5.6 (64-bit)
Oracle Enterprise Linux 6.0 (32-bit)
Oracle Enterprise Linux 6.0 (64-bit)
Red Hat Enterprise Linux 5.6 (32-bit)
Red Hat Enterprise Linux 5.6 (64-bit)
SUSE Linux Enterprise Server 10 SP3 (32-bit)
SUSE Linux Enterprise Server 10 SP4 (64-bit)
SUSE Linux Enterprise Server 10 SP4 (32-bit)
SUSE Linux Enterprise Server 11 SP1 (64-bit)
SUSE Linux Enterprise Server 11 SP1 (32-bit)
Ubuntu 10.10 (32-bit)
Ubuntu 10.10 (64-bit)
Sun Solaris 11 (64-bit)
Sun Solaris 11 (32-bit)
Windows PV
CentOS 5.7 (32-bit)
CentOS 5.7 (64-bit)
Ubuntu 12.04 (32-bit)
Ubuntu 12.04 (64-bit)
Windows 8 (32-bit)
Windows 8 (64-bit)
Windows Server 2012 (64-bit)
Windows Server 2012 R2 (64-bit)
Ubuntu 11.04 (32-bit)
Ubuntu 11.04 (64-bit)
CentOS 6.3 (32-bit)
CentOS 6.3 (64-bit)
CentOS 5.8 (32-bit)
CentOS 5.8 (64-bit)
CentOS 5.9 (32-bit)
CentOS 5.9 (64-bit)
CentOS 6.1 (32-bit)
CentOS 6.1 (64-bit)
CentOS 6.2 (32-bit)
CentOS 6.2 (64-bit)
CentOS 6.4 (32-bit)
CentOS 6.4 (64-bit)
Debian GNU/Linux 7(32-bit)
Debian GNU/Linux 7(64-bit)
SUSE Linux Enterprise Server 11 SP2 (64-bit)
SUSE Linux Enterprise Server 11 SP2 (32-bit)
SUSE Linux Enterprise Server 11 SP3 (64-bit)
SUSE Linux Enterprise Server 11 SP3 (32-bit)
Red Hat Enterprise Linux 5.7 (32-bit)
Red Hat Enterprise Linux 5.7 (64-bit)
Red Hat Enterprise Linux 5.8 (32-bit)
Red Hat Enterprise Linux 5.8 (64-bit)
Red Hat Enterprise Linux 5.9 (32-bit)
Red Hat Enterprise Linux 5.9 (64-bit)
Red Hat Enterprise Linux 6.1 (32-bit)
Red Hat Enterprise Linux 6.1 (64-bit)
Red Hat Enterprise Linux 6.2 (32-bit)
Red Hat Enterprise Linux 6.2 (64-bit)
Red Hat Enterprise Linux 6.3 (32-bit)
Other CentOS (32-bit)
Other CentOS (64-bit)
Other SUSE Linux(32-bit)
Other SUSE Linux(64-bit)
Red Hat Enterprise Linux
Red Hat Enterprise Linux
Red Hat Enterprise Linux
Oracle Enterprise Linux 5.7 (32-bit)
Oracle Enterprise Linux 5.7 (64-bit)
Oracle Enterprise Linux 5.8 (32-bit)
Oracle Enterprise Linux 5.8 (64-bit)
Oracle Enterprise Linux 5.9 (32-bit)
Oracle Enterprise Linux 5.9 (64-bit)
Oracle Enterprise Linux 6.1 (32-bit)
Oracle Enterprise Linux 6.1 (64-bit)
Oracle Enterprise Linux 6.2 (32-bit)
Oracle Enterprise Linux 6.2 (64-bit)
Oracle Enterprise Linux 6.3 (32-bit)
Oracle Enterprise Linux 6.3 (64-bit)
Oracle Enterprise Linux 6.4 (32-bit)
Oracle Enterprise Linux 6.4 (64-bit)
Apple Mac OS X 10.6 (32-bit)
Apple Mac OS X 10.6 (64-bit)
Apple Mac OS X 10.7 (32-bit)
Apple Mac OS X 10.7 (64-bit)
FreeBSD 10 (32-bit)
FreeBSD 10 (64-bit)
CentOS 6.5 (32-bit)
CentOS 6.5 (64-bit)
Windows 8.1 (64-bit)
Windows 8.1 (32-bit)
CentOS 5 (32-bit)
CentOS 5 (64-bit)
Oracle Enterprise Linux 5 (32-bit)
Oracle Enterprise Linux 5 (64-bit)
Oracle Enterprise Linux 6 (32-bit)
Oracle Enterprise Linux 6 (64-bit)
Red Hat Enterprise Linux 5 (32-bit)
Red Hat Enterprise Linux 5 (64-bit)
Red Hat Enterprise Linux 6 (32-bit)
Red Hat Enterprise Linux 6 (64-bit)
Ubuntu 14.04 (32-bit)
SUSE Linux Enterprise Server 12 (64-bit)
Red Hat Enterprise Linux 7
CentOS 7
Oracle Linux 7
CentOS 6 (32-bit)
CentOS 6 (64-bit)
Oracle Enterprise Linux 6.5 (32-bit)
Oracle Enterprise Linux 6.5 (64-bit)
Red Hat Enterprise Linux 6.5 (32-bit)
Red Hat Enterprise Linux 6.5 (64-bit)
Ubuntu 14.04 (64-bit)
CoreOS


 

  • No labels