<!--{{{-->
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml'/>
<!--}}}-->
Background: #fff
Foreground: #000
PrimaryPale: #8cf
PrimaryLight: #18f
PrimaryMid: #04b
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
/*{{{*/
body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}

a {color:[[ColorPalette::PrimaryMid]];}
a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];}
a img {border:0;}

h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;}
h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];}
h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];}

.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];}
.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];}
.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];}

.header {background:[[ColorPalette::PrimaryMid]];}
.headerShadow {color:[[ColorPalette::Foreground]];}
.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];}
.headerForeground {color:[[ColorPalette::Background]];}
.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];}

.tabSelected{color:[[ColorPalette::PrimaryDark]];
	background:[[ColorPalette::TertiaryPale]];
	border-left:1px solid [[ColorPalette::TertiaryLight]];
	border-top:1px solid [[ColorPalette::TertiaryLight]];
	border-right:1px solid [[ColorPalette::TertiaryLight]];
}
.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];}
.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];}
.tabContents .button {border:0;}

#sidebar {}
#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];}
#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];}

.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];}
.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;}
.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;}
.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];
	border:1px solid [[ColorPalette::PrimaryMid]];}
.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];}
.wizardFooter {background:[[ColorPalette::PrimaryPale]];}
.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];}
.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid;
	border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];}
.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];}
.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid;
	border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];}

#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];}
#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;}

.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];}

.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];}
.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;}
.popup li.disabled {color:[[ColorPalette::TertiaryMid]];}
.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;}
.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];}

.tiddler .defaultCommand {font-weight:bold;}

.shadow .title {color:[[ColorPalette::TertiaryDark]];}

.title {color:[[ColorPalette::SecondaryDark]];}
.subtitle {color:[[ColorPalette::TertiaryDark]];}

.toolbar {color:[[ColorPalette::PrimaryMid]];}
.toolbar a {color:[[ColorPalette::TertiaryLight]];}
.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];}
.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];}

.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];}
.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];}
.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];}
.tagging .button, .tagged .button {border:none;}

.footer {color:[[ColorPalette::TertiaryLight]];}
.selected .footer {color:[[ColorPalette::TertiaryMid]];}

.sparkline {background:[[ColorPalette::PrimaryPale]]; border:0;}
.sparktick {background:[[ColorPalette::PrimaryDark]];}

.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];}
.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];}
.lowlight {background:[[ColorPalette::TertiaryLight]];}

.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];}

.imageLink, #displayArea .imageLink {background:transparent;}

.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];}

.viewer .listTitle {list-style-type:none; margin-left:-2em;}
.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];}
.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];}

.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];}
.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];}
.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];}

.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];}
.viewer code {color:[[ColorPalette::SecondaryDark]];}
.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}

.highlight, .marked {background:[[ColorPalette::SecondaryLight]];}

.editor input {border:1px solid [[ColorPalette::PrimaryMid]];}
.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;}
.editorFooter {color:[[ColorPalette::TertiaryMid]];}

#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];}
#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; }
#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;}
#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];}
.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];}
.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];}
#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:'alpha(opacity:60)';}
/*}}}*/
/*{{{*/
* html .tiddler {height:1%;}

body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}

h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:1.35em;}
h2 {font-size:1.25em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

ol {list-style-type:decimal;}
ol ol {list-style-type:lower-alpha;}
ol ol ol {list-style-type:lower-roman;}
ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol {list-style-type:lower-alpha;}
ol ol ol ol ol ol {list-style-type:lower-roman;}
ol ol ol ol ol ol ol {list-style-type:decimal;}

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

.indent {margin-left:3em;}
.outdent {margin-left:3em; text-indent:-3em;}
code.escaped {white-space:nowrap;}

.tiddlyLinkExisting {font-weight:bold;}
.tiddlyLinkNonExisting {font-style:italic;}

/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
a.tiddlyLinkNonExisting.shadow {font-weight:bold;}

#mainMenu .tiddlyLinkExisting,
	#mainMenu .tiddlyLinkNonExisting,
	#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}

.header {position:relative;}
.header a:hover {background:transparent;}
.headerShadow {position:relative; padding:4.5em 0em 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0em 1em 1em; left:0px; top:0px;}

.siteTitle {font-size:3em;}
.siteSubtitle {font-size:1.2em;}

#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}

#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}
#sidebarOptions {padding-top:0.3em;}
#sidebarOptions a {margin:0em 0.2em; padding:0.2em 0.3em; display:block;}
#sidebarOptions input {margin:0.4em 0.5em;}
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
#sidebarOptions .sliderPanel input {margin:0 0 .3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}

.wizard {padding:0.1em 1em 0em 2em;}
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}
.wizardStep {padding:1em 1em 1em 1em;}
.wizard .button {margin:0.5em 0em 0em 0em; font-size:1.2em;}
.wizardFooter {padding:0.8em 0.4em 0.8em 0em;}
.wizardFooter .status {padding:0em 0.4em 0em 0.4em; margin-left:1em;}
.wizard .button {padding:0.1em 0.2em 0.1em 0.2em;}

#messageArea {position:fixed; top:2em; right:0em; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
.messageToolbar {display:block; text-align:right; padding:0.2em 0.2em 0.2em 0.2em;}
#messageArea a {text-decoration:underline;}

.tiddlerPopupButton {padding:0.2em 0.2em 0.2em 0.2em;}
.popupTiddler {position: absolute; z-index:300; padding:1em 1em 1em 1em; margin:0;}

.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
.popup .popupMessage {padding:0.4em;}
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0em;}
.popup li.disabled {padding:0.4em;}
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
.listBreak {font-size:1px; line-height:1px;}
.listBreak div {margin:2px 0;}

.tabset {padding:1em 0em 0em 0.5em;}
.tab {margin:0em 0em 0em 0.25em; padding:2px;}
.tabContents {padding:0.5em;}
.tabContents ul, .tabContents ol {margin:0; padding:0;}
.txtMainTab .tabContents li {list-style:none;}
.tabContents li.listLink { margin-left:.75em;}

#contentWrapper {display:block;}
#splashScreen {display:none;}

#displayArea {margin:1em 17em 0em 14em;}

.toolbar {text-align:right; font-size:.9em;}

.tiddler {padding:1em 1em 0em 1em;}

.missing .viewer,.missing .title {font-style:italic;}

.title {font-size:1.6em; font-weight:bold;}

.missing .subtitle {display:none;}
.subtitle {font-size:1.1em;}

.tiddler .button {padding:0.2em 0.4em;}

.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
.isTag .tagging {display:block;}
.tagged {margin:0.5em; float:right;}
.tagging, .tagged {font-size:0.9em; padding:0.25em;}
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
.tagClear {clear:both;}

.footer {font-size:.9em;}
.footer li {display:inline;}

.annotation {padding:0.5em; margin:0.5em;}

* html .viewer pre {width:99%; padding:0 0 1em 0;}
.viewer {line-height:1.4em; padding-top:0.5em;}
.viewer .button {margin:0em 0.25em; padding:0em 0.25em;}
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}

.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
table.listView {font-size:0.85em; margin:0.8em 1.0em;}
table.listView th, table.listView td, table.listView tr {padding:0px 3px 0px 3px;}

.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
.viewer code {font-size:1.2em; line-height:1.4em;}

.editor {font-size:1.1em;}
.editor input, .editor textarea {display:block; width:100%; font:inherit;}
.editorFooter {padding:0.25em 0em; font-size:.9em;}
.editorFooter .button {padding-top:0px; padding-bottom:0px;}

.fieldsetFix {border:0; padding:0; margin:1px 0px 1px 0px;}

.sparkline {line-height:1em;}
.sparktick {outline:0;}

.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
.zoomer div {padding:1em;}

* html #backstage {width:99%;}
* html #backstageArea {width:99%;}
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em 0.3em 0.5em;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em 0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0em; right:0em;}
#backstageButton a {padding:0.1em 0.4em 0.1em 0.4em; margin:0.1em 0.1em 0.1em 0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; margin:0em 3em 0em 3em; padding:1em 1em 1em 1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding:0.2em 0.4em 0.2em 0.4em;}
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}

.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
/***
StyleSheet for use when a translation requires any css style changes.
This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which need larger font sizes.
***/
/*{{{*/
body {font-size:0.8em;}
#sidebarOptions {font-size:1.05em;}
#sidebarOptions a {font-style:normal;}
#sidebarOptions .sliderPanel {font-size:0.95em;}
.subtitle {font-size:0.8em;}
.viewer table.listView {font-size:0.95em;}
/*}}}*/
/*{{{*/
@media print {
#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none ! important;}
#displayArea {margin: 1em 1em 0em 1em;}
/* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
noscript {display:none;}
}
/*}}}*/
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar closeTiddler closeOthers +editTiddler > fields syncing permalink references jump'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler deleteTiddler'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>
<!--}}}-->
To get started with this blank TiddlyWiki, you'll need to modify the following tiddlers:
* SiteTitle & SiteSubtitle: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* MainMenu: The menu (usually on the left)
* DefaultTiddlers: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
You'll also need to enter your username for signing your edits: <<option txtUserName>>
These InterfaceOptions for customising TiddlyWiki are saved in your browser

Your username for signing your edits. Write it as a WikiWord (eg JoeBloggs)

<<option txtUserName>>
<<option chkSaveBackups>> SaveBackups
<<option chkAutoSave>> AutoSave
<<option chkRegExpSearch>> RegExpSearch
<<option chkCaseSensitiveSearch>> CaseSensitiveSearch
<<option chkAnimate>> EnableAnimations

----
Also see AdvancedOptions
<<importTiddlers>>
In Socialtext Unplugged, the selected pages of your Socialtext workspace are displayed as individual "tiddlers" on the page. When the mouse passes over a tiddler a short toolbar menu appears at the top right. Use the commands here to manipulate that particular tiddler: notably closing and editting it. (You can double click on a tiddler as a shortcut to directly enter edit mode).

Over on the right hand side of the window are commands that affect the entire page, in particular "close all" which can be useful to clear the decks when many tiddlers are open at once.

The user is encouraged to ensure that they can SaveChanges before embarking on widespread editing.
Welcome to Socialtext Unplugged. This is a specially designed web page that you can use to view and edit your Socialtext content without having to be online to your Socialtext server.

There are three steps to using Socialtext Unplugged:
* First, learn how to SaveChanges to your local hard drive. This keeps your work safe even if you close your browser or have to reboot your computer
* Secondly, find out how to BrowseAndEdit your content while it is unplugged
* Thirdly, when you can reconnect to your Socialtext server, you can SyncChanges to save your unplugged changes to the server so that other people can see them too

You should also check your system meets the SystemRequirements.
Socialtext Unplugged lets you browse and edit your content while you're offline. When you make a change you need to SaveChanges to save the change to your local hard drive, before later performing a SyncChanges to synchronise the change back to the server.

The procedure for SaveChanges is slightly different for different browsers:
* SavingOnInternetExplorer
* SavingOnFireFox
* SavingOnSafari
* SavingOnOpera
You can save changes with any version of FireFox, and also many other browsers in the FireFox family, such as Camino on the Mac and MiniMo on mobile devices. The procedure is:
# Click the button labelled 'save changes' over in the right hand sidebar
# If prompted with an "Internet Security" dialog as follows, click the checkbox labelled "Remember this decision" and then the "Allow" button
## "A script from "file://" is requesting enhanced capabilities that are UNSAFE and could be used to compromise your machine or data..."
# You should then see a message at the top right of the window saying "Main TiddlyWiki file saved"
If you accidentally //deny// permission instead, you may need to UnravelFireFoxPermissions.
You can save changes with Internet Explorer versions 6 and 7, but not the earlier versions. The procedure is:
# Click the button labelled 'save changes' over in the right hand sidebar
# If prompted as follows, click "Yes":
## "An ActiveX control on this page might be unsafe to interact with other parts of the page. Do you want to allow this interaction?"
# You should then see a message at the top right of the window saying "Main TiddlyWiki file saved"
Note that there is currently [[a bug|http://trac.tiddlywiki.org/tiddlywiki/ticket/39]] that prevents Internet Explorer from saving correctly if you have specified a backup directory in AdvancedOptions.
To SaveChanges on Opera, see the instructions for using the TiddlySaver Java applet.
To SaveChanges on Safari, see the instructions for using the TiddlySaver Java applet.
<<search>><<closeAll>><<permaview>><<newTiddler 'New Tiddler' fields:'server.host:"https://saturn.ffzg.hr%2C%20saturn.ffzg.hr:443" server.workspace:"rot13" wikiformat:socialtext'>><<newJournal 'DD MMM YYYY' fields:'server.host:"https://saturn.ffzg.hr%2C%20saturn.ffzg.hr:443" server.workspace:"rot13" wikiformat:socialtext'>><<saveChanges>><<backstage sync>><<slider chkSliderOptionsPanel OptionsPanel 'options »' 'Change TiddlyWiki advanced options'>>
Dobrica Pavlinušić's random unstructured stuff
Socialtext Unplugged
https://saturn.ffzg.hr/rot13/
[[SocialtextScreenStyle]]
[[SocialtextStyleOverrides]]
[[Styles HorizontalMainMenu]]
<<sync>>
@@The user interface for synchronization is not finalized@@
To synchronize your changes back to the Socialtext server:
# click on [[Sync]] in the right-hand sidebar
<<tabs txtMoreTab Orphans 'Orphaned tiddlers' TabMoreOrphans Shadowed 'Shadowed tiddlers' TabMoreShadowed>>
Under FireFox, you can run into problems if you accidentally click 'Deny' on the permission request dialog, and have selected //Remember this decision//.

To reverse the effects, first locate the file {{{prefs.js}}} in your FireFox profile directory. Under Windows you'll find it at something like {{{C:\Documents and Settings\Jeremy\Application Data\Mozilla\Firefox\Profiles\o3dhupu6.default\prefs.js}}}, where {{{Jeremy}}} is the name of your windows profile and {{{o3dhupu6}}} will be a similar string of gobbledegook. On the Mac it'll be at {{{~/Library/Application Support/Firefox/Profiles/o3dhupu6.default/prefs.js}}} and on most versions of Linux, at {{{~/.mozilla/firefox/o3dhupu6.default/prefs.js}}}.

Open the file in a text editor and find the line {{{user_pref("capability.principal.codebase.p0.denied", "UniversalXPConnect");}}} and simply replace the word {{{denied}}} with {{{granted}}}.
//(Thanks to JonScully for figuring out this fix)//
<!--{{{-->
<div class='toolbar' macro='toolbar closeTiddler closeOthers +editTiddler references > fields syncing jump'></div>
<div class='workspace' id='st-page-wiki-title' macro='view socialtext.workspace'></div>
<div class='title' id='st-page-titletext' macro='view title'></div>
<div class='subtitle'>
Created on <span macro='view created date [[MMM DD, 0hh:0mm]]'></span>.
Updated by <span macro='view modifier link'></span>
on <span macro='view modified date [[MMM DD, 0hh:0mm]]'></span></div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></span></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
/***
To use, add {{{[[Styles HorizontalMainMenu]]}}} to your StyleSheet tiddler.
See http://www.w3schools.com/css/css_colors.asp for a color chart.
***/
/*{{{*/
#mainMenu {position:relative;left:auto;width:auto;text-align:left;line-height:normal;padding 0em 1em 0em 1em;font-size:normal;}
#mainMenu br {display:none;}
#mainMenu {background:#336699;}
#mainMenu {padding:2px;}
#mainMenu .button, #mainMenu .tiddlyLink {padding-left:0.5em;padding-right:0.5em;color:white;font-size:115%;}

#displayArea {
	margin-top:0;margin-right:20em;margin-bottom:0;margin-left:1em;
	padding-top:.1em;padding-bottom:.1em;
}
/*}}}*/
|''Type:''|socialtext|
|''URL:''|https://saturn.ffzg.hr%2C%20saturn.ffzg.hr:443 |
|''Workspace:''|rot13|
|''WorkspaceList:''||
|''Description:''|Dobrica Pavlinušić's random unstructured stuff|
The TiddlySaver Java applet allows TiddlyWiki from a {{{file://}}} URL to save changes Safari, Opera and other browsers.

It is a small file named [["TiddlySaver.jar"|TiddlySaver.jar]] that must be placed in the same directory as your TiddlyWiki file. Before you can use it, you need to give it the necessary privileges by editting your {{{.java.policy}}} file.

For Windows, the file will be at {{{C:\Documents and Settings\your-user-name\.java.policy}}}. Add the following lines (substituting the directory of your TiddlyWiki file as appropriate):
{{{
grant codeBase "file:${user.home}/My Documents/tiddlywiki-folder/*" {
  permission java.io.FilePermission "${user.home}${/}My Documents${/}tiddlywiki-folder${/}*", "read,write";
};
}}}
On Mac OS X, the file is found at {{{/Users/your-user-name/.java.policy}}}:
{{{
grant codeBase "file:${user.home}/Documents/tiddlywiki-folder/*" {
  permission java.io.FilePermission "${user.home}${/}Documents${/}tiddlywiki-folder${/}*", "read,write";
};
}}}
It can be tricky creating files whose name starts with a period, so you can use this [[pre-built .java.policy file|.java.policy]]. The same file is suitable for Macs too, just edit it and delete the "My " bit, leaving just "Documents". Make sure you save it in the right place for each operating system!

If you have trouble setting up the permissions correctly, you can try granting broader permissions to the applet like this:

{{{
grant codeBase "file://localhost/home/users/Desktop/
TiddlySaver.jar"
 { permission java.security.AllPermission; };
}}}

Note that there is currently [[a bug|http://trac.tiddlywiki.org/ticket/172]] that prevents TiddlySaver from working if you have specified a backup directory in AdvancedOptions.
/***
|''Name:''|SocialtextLocaleOverrides|
|''Description:''|Text changes for Socialtext|
***/

//{{{
merge(config.views.wikified.tag,{
	labelNoTags: "No Tags",
	labelTags: "Tags"});

merge(config.commands.references,{
	text: "incoming links",
	tooltip: "Show tiddlers that link to this one",
	popupNone: "No incoming links"});
//}}}
/***
|''Name:''|SocialtextTweaksPlugin|
|''Description:''|Allows changes to be synchronised with a Socialtext server|
|''Source:''|http://stunplugged.tiddlywiki.com/#SocialtextTweaksPlugin|
|''Author:''|JeremyRuston (jeremy (at) osmosoft (dot) com)|
|''Version:''|1.0.2|
|''Date:''|Jun 15, 2006|
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev|
|''License:''|[[BSD open source license]]|
|''~CoreVersion:''|2.2|

Make minor configuration tweaks specific to Socialtext Unplugged
***/

//{{{
// Ensure that the SocialtextTweaksPlugin is only installed once.
if(!version.extensions.SocialtextTweaksPlugin) {
version.extensions.SocialtextTweaksPlugin = {installed:true};
// Check version number of core code
if(version.major < 2 || (version.major == 2 && version.minor < 2))
	{alertAndThrow("SocialtextTweaksPlugin requires TiddlyWiki 2.2 or later.");}

merge(config.defaultCustomFields,{
	wikiformat:'socialtext',
	'server.host':'https://saturn.ffzg.hr%2C%20saturn.ffzg.hr:443'
});

config.options.chkSinglePageMode = true;
config.options.chkEnableAnimations = true;

} // end of "install only once"
//}}}
/***
|''Name:''|SocialtextFormatterPlugin|
|''Description:''|Allows Tiddlers to use [[Socialtext|http://www.socialtext.com/]] text formatting|
|''Author:''|Martin Budden (mjbudden (at) gmail (dot) com)|
|''Source:''|http://www.martinswiki.com/#SocialtextFormatterPlugin|
|''CodeRepository:''|http://svn.tiddlywiki.org/Trunk/contributors/MartinBudden/formatters/SocialtextFormatterPlugin.js|
|''Version:''|0.9.4|
|''Date:''|Jan 21, 2007|
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev|
|''License:''|[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|''~CoreVersion:''|2.1.0|

This is the SocialtextFormatterPlugin, which allows you to insert Socialtext formated text into a TiddlyWiki.

The aim is not to fully emulate Socialtext, but to allow you to work with Socialtext content off-line and then resync the content with your Socialtext wiki later on, with the expectation that only minor edits will be required.

To use Socialtext format in a Tiddler, tag the Tiddler with SocialtextFormat or set the tiddler's {{{wikiformat}}} extended field to {{{socialtext}}}

Please report any defects you find at http://groups.google.co.uk/group/TiddlyWikiDev
***/

//{{{
// Ensure that the SocialtextFormatter Plugin is only installed once.
if(!version.extensions.SocialtextFormatterPlugin) {
version.extensions.SocialtextFormatterPlugin = {installed:true};

if(version.major < 2 || (version.major == 2 && version.minor < 1))
	{alertAndThrow('SocialtextFormatterPlugin requires TiddlyWiki 2.1 or later.');}

SocialtextFormatter = {}; // 'namespace' for local functions

wikify = function(source,output,highlightRegExp,tiddler)
{
	if(source && source != '') {
		var w = new Wikifier(source,getParser(tiddler),highlightRegExp,tiddler);
		var out = output;
		if(tiddler && (tiddler.isTagged(config.parsers.socialtextFormatter.formatTag) || (tiddler.fields.wikiformat==config.parsers.socialtextFormatter.format)) ) {
			var d1 = createTiddlyElement(output,'div','content-display-body','content-section-visible');
			var d2 = createTiddlyElement(d1,'div','wikipage');
			out = createTiddlyElement(d2,'div',null,'wiki');
		}
		var time1,time0 = new Date();
		w.subWikifyUnterm(out);
		if(tiddler && config.options.chkDisplayInstrumentation) {
			time1 = new Date();
			var t = tiddler ? tiddler.title : source.substr(0,10);
			displayMessage("Wikify '"+t+"' in " + (time1-time0) + " ms");
		}
	}
};

stDebug = function(out,str)
{
	createTiddlyText(out,str.replace(/\n/mg,'\\n').replace(/\r/mg,'RR'));
	createTiddlyElement(out,'br');
};

SocialtextFormatter.Tiddler_changed = Tiddler.prototype.changed;
Tiddler.prototype.changed = function()
{
	if((this.fields.wikiformat==config.parsers.socialtextFormatter.format) || this.isTagged(config.parsers.socialtextFormatter.formatTag)) {
		// update the links array, by checking for Socialtext format links
		this.links = [];
		var tiddlerLinkRegExp = /(?:\"(.*?)\" ?)?\[([^\]]*?)\]/mg;
		tiddlerLinkRegExp.lastIndex = 0;
		var match = tiddlerLinkRegExp.exec(this.text);
		while(match) {
			var link = match[2];
			this.links.pushUnique(link);
			match = tiddlerLinkRegExp.exec(this.text);
		}
	}/* else {
		return SocialtextFormatter.Tiddler_changed.apply(this,arguments);
	}*/
	this.linksUpdated = true;
};

SocialtextFormatter.wafl = function(w)
{
	this.lookaheadRegExp.lastIndex = w.matchStart;
	var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
	if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
		var lm2 = lookaheadMatch[2];
		switch(lookaheadMatch[1]) {
		case 'image':
			var img = createTiddlyElement(w.output,'img');
			img.src = w.tiddler.title + '/' + lm2;
			createTiddlyText(img,lm2);
			break;
		case 'file':
			var s = createTiddlyElement(w.output,'span',null,'nlw_phrase');
			var a = createTiddlyElement(s,'a');
			a.href = w.tiddler.title + '/' + lm2;
			createTiddlyText(a,lm2);
			break;
		case 'link':
			s = createTiddlyElement(w.output,'span',null,'nlw_phrase');
			a = createTiddlyElement(s,'a');
			var t = w.tiddler ? w.tiddler.title + ':' : '';
			a.setAttribute('href','#' + t + lm2);
			a.title = 'section link';
			createTiddlyText(a,lm2);
			break;
		case 'weblog':
			s = createTiddlyElement(w.output,'span',null,'nlw_phrase');
			var text = lm2;
			var link = 'Weblog: ' + lm2;
			createTiddlyText(createTiddlyLink(s,link,false,null,w.isStatic),text);
			break;
		case 'section':
			a = createTiddlyElement(w.output,'a');// drop anchor
			t = w.tiddler ? w.tiddler.title + ':' : '';
			a.setAttribute('name',t + lm2);
			break;
		case 'date':
			createTiddlyText(w.output,lm2);
			break;
		case 'user':
			var oldSource = w.source;
			w.source = lm2;
			w.nextMatch = 0;
			w.subWikifyUnterm(w.output);
			w.source = oldSource;
			break;
// Shortcut expansions - not strictly syntax
		case 'google':
			s = createTiddlyElement(w.output,'span',null,'nlw_phrase');
			a = createExternalLink(s,'http://www.google.com/search?q='+lm2);
			createTiddlyText(a,lm2);
			break;
		case 'fedex':
			s = createTiddlyElement(w.output,'span',null,'nlw_phrase');
			a = createExternalLink(s,'http://www.fedex.com/Tracking?tracknumbers='+lm2);
			createTiddlyText(a,lm2);
			break;
		case 'map':
			s = createTiddlyElement(w.output,'span',null,'nlw_phrase');
			a = createExternalLink(s,'http://maps.google.com/maps?q='+lm2);
			createTiddlyText(a,lm2);
			break;
		case 'wikipedia':
			s = createTiddlyElement(w.output,'span',null,'nlw_phrase');
			a = createExternalLink(s,'http://en.wikipedia.org/wiki/'+lm2);
			createTiddlyText(a,lm2);
			break;
		case 'rt':
			s = createTiddlyElement(w.output,'span',null,'nlw_phrase');
			a = createExternalLink(s,'http://rt.socialtext.net/Ticket/Display.html?id='+lm2);
			createTiddlyText(a,lm2);
			break;
		case 'stcal':
			s = createTiddlyElement(w.output,'span',null,'nlw_phrase');
			a = createExternalLink(s,'https://calendar.socialtext.net:445/view_t.php?timeb=1&id=3&date='+lm2);
			createTiddlyText(a,lm2);
			break;
		case 'svn':
			s = createTiddlyElement(w.output,'span',null,'nlw_phrase');
			a = createExternalLink(s,'https://repo.socialtext.net/listing.php?rev='+lm2+'sc=1');
			createTiddlyText(a,lm2);
			break;
		default:
			w.outputText(w.output,w.matchStart,w.nextMatch);
			return;
		}
		w.nextMatch = this.lookaheadRegExp.lastIndex;
	} else {
		w.outputText(w.output,w.matchStart,w.nextMatch);
	}
};

SocialtextFormatter.presence = function(w)
{
	this.lookaheadRegExp.lastIndex = w.matchStart;
	var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
	if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
		var p = lookaheadMatch[1];
		var text = lookaheadMatch[2];
		var link;
		var src;
		if(p=='aim') {
			link = 'aim:goim?screenname=' + text + '&message=hello';
			src = 'http://big.oscar.aol.com/sleepleft?on_url=http://www.aim.com/remote/gr/MNB_online.gif&amp;off_url=http://www.aim.com/remote/gr/MNB_offline.gif';
		} else if(p=='yahoo'||p=='ymsgr') {
			link = 'ymsgr:sendIM?'+text;
			src = 'http://opi.yahoo.com/online?u=chrislondonbridge&f=.gif';
		} else if(p=='skype'||p=='callto') {
			link = 'callto:'+text;
			src = 'http://goodies.skype.com/graphics/skypeme_btn_small_green.gif';
		} else if(p=='asap') {
			link = 'http://asap2.convoq.com/AsapLinks/Meet.aspx?l='+text;
			src = 'http://asap2.convoq.com/AsapLinks/Presence.aspx?l='+text;
		}
		var s = createTiddlyElement(w.output,'span',null,'nlw_phrase');
		var a = createExternalLink(s,link);
		var img = createTiddlyElement(a,'img');
		createTiddlyText(a,text);
		img.src = src;
		img.border='0';
		img.alt = '(' + lookaheadMatch[1] + ')';
		if(p=='aim') {
			img.width='11'; img.height='13';
		}
		w.nextMatch = this.lookaheadRegExp.lastIndex;
	}
};

config.formatterHelpers.singleCharFormat = function(w)
{
	this.lookaheadRegExp.lastIndex = w.matchStart;
	var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
	if(lookaheadMatch && lookaheadMatch.index == w.matchStart && lookaheadMatch[0].substr(lookaheadMatch[0].length-2,1) != ' ') {
		w.subWikifyTerm(createTiddlyElement(w.output,this.element),this.termRegExp);
	} else {
		w.outputText(w.output,w.matchStart,w.nextMatch);
	}
};

config.socialtext = {};
config.socialtext.formatters = [
{
	name: 'socialtextHeading',
	match: '^\\^{1,6} ?',
	termRegExp: /(\n+)/mg,
	handler: function(w)
	{
		var len = w.matchText.trim().length;
		var e = createTiddlyElement(w.output,'h' + len);
		var a = createTiddlyElement(e,'a');// drop anchor
		var t = w.tiddler ? w.tiddler.title + ':' : '';
		len = w.source.substr(w.nextMatch).indexOf('\n');
		a.setAttribute('name',t+w.source.substr(w.nextMatch,len));
		w.subWikifyTerm(e,this.termRegExp);
	}
},

{
	name: 'socialtextTable',
	match: '^\\|(?:(?:.|\n)*)\\|$',
	lookaheadRegExp: /^\|(?:(?:.|\n)*)\|$/mg,
	cellRegExp: /(?:\|(?:[^\|]*)\|)(\n|$)?/mg,
	cellTermRegExp: /((?:\x20*)\|)/mg,
	handler: function(w)
	{
		var table = createTiddlyElement(w.output,'table');
		var rowContainer = createTiddlyElement(table,'tbody');
		var prevColumns = [];
		w.nextMatch = w.matchStart;
		this.lookaheadRegExp.lastIndex = w.nextMatch;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		while(lookaheadMatch && lookaheadMatch.index == w.nextMatch) {
			var r = this.rowHandler(w,createTiddlyElement(rowContainer,'tr'),prevColumns);
			if(!r) {
				w.nextMatch++;
				break;
			}
			this.lookaheadRegExp.lastIndex = w.nextMatch;
			lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		}
	},
	rowHandler: function(w,e,prevColumns)
	{
		this.cellRegExp.lastIndex = w.nextMatch;
		var cellMatch = this.cellRegExp.exec(w.source);
		while(cellMatch && cellMatch.index == w.nextMatch) {
			w.nextMatch++;
			var cell = createTiddlyElement(e,'td');
			w.subWikifyTerm(cell,this.cellTermRegExp);
			if(cellMatch[1]) {
				// End of row
				w.nextMatch = this.cellRegExp.lastIndex;
				return true;
			}
			// Cell
			w.nextMatch--;
			this.cellRegExp.lastIndex = w.nextMatch;
			cellMatch = this.cellRegExp.exec(w.source);
		}
		return false;
	}
},

{
	name: 'socialtextList',
	match: '^[\\*#]+ ',
	lookaheadRegExp: /^([\*#])+ /mg,
	termRegExp: /(\n+)/mg,
	handler: function(w)
	{
		var stack = [w.output];
		var currLevel = 0, currType = null;
		var itemType = 'li';
		w.nextMatch = w.matchStart;
		this.lookaheadRegExp.lastIndex = w.nextMatch;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		while(lookaheadMatch && lookaheadMatch.index == w.nextMatch) {
			var listType = lookaheadMatch[1] == '*' ? 'ul' : 'ol';
			var listLevel = lookaheadMatch[0].length;
			w.nextMatch += listLevel;
			if(listLevel > currLevel) {
				for(var i=currLevel; i<listLevel; i++) {
					stack.push(createTiddlyElement(stack[stack.length-1],listType));
				}
			} else if(listLevel < currLevel) {
				for(i=currLevel; i>listLevel; i--) {
					stack.pop();
				}
			} else if(listLevel == currLevel && listType != currType) {
				stack.pop();
				stack.push(createTiddlyElement(stack[stack.length-1],listType));
			}
			currLevel = listLevel;
			currType = listType;
			var e = createTiddlyElement(stack[stack.length-1],itemType);
			w.subWikifyTerm(e,this.termRegExp);
			this.lookaheadRegExp.lastIndex = w.nextMatch;
			lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		}
	}
},

{
	name: 'socialtextQuoteByLine',
	match: '^>+',
	lookaheadRegExp: /^>+/mg,
	termRegExp: /(\n)/mg,
	element: 'blockquote',
	handler: function(w)
	{
		var stack = [w.output];
		var currLevel = 0;
		var newLevel = w.matchLength;
		var i;
		do {
			if(newLevel > currLevel) {
				for(i=currLevel; i<newLevel; i++) {
					stack.push(createTiddlyElement(stack[stack.length-1],this.element));
				}
			} else if(newLevel < currLevel) {
				for(i=currLevel; i>newLevel; i--) {
					stack.pop();
				}
			}
			currLevel = newLevel;
			w.subWikifyTerm(stack[stack.length-1],this.termRegExp);
			createTiddlyElement(stack[stack.length-1],'br');
			this.lookaheadRegExp.lastIndex = w.nextMatch;
			var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
			var matched = lookaheadMatch && lookaheadMatch.index == w.nextMatch;
			if(matched) {
				newLevel = lookaheadMatch[0].length;
				w.nextMatch += newLevel;
			}
		} while(matched);
	}
},

{
	name: 'socialtextRule',
	match: '^----+$\\n+',
	handler: function(w)
	{
		createTiddlyElement(w.output,'hr');
	}
},

{
	name: 'socialtextPreformatted',
	match: '^\\.pre\\s*\\n',
	lookaheadRegExp: /^.pre\s*\n((?:.|\n)*?)\n.pre\s*\n/mg,
	element: 'pre',
	handler: config.formatterHelpers.enclosedTextHelper
},

{
	name: 'socialtextHtml',
	match: '^\\.html',
	lookaheadRegExp: /\.html((?:.|\n)*?)\.html/mg,
	handler: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			createTiddlyElement(w.output,'span').innerHTML = lookaheadMatch[1];
			w.nextMatch = this.lookaheadRegExp.lastIndex;
		}
	}
},

{
	name: 'macro',
	match: '<<',
	lookaheadRegExp: /<<([^>\s]+)(?:\s*)((?:[^>]|(?:>(?!>)))*)>>/mg,
	handler: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart && lookaheadMatch[1]) {
			w.nextMatch = this.lookaheadRegExp.lastIndex;
			invokeMacro(w.output,lookaheadMatch[1],lookaheadMatch[2],w,w.tiddler);
		}
	}
},

{
	name: 'socialtextExplicitLink',
	match: '(?:".*?" ?)?\\[',
	lookaheadRegExp: /(?:\"(.*?)\" ?)?\[([^\]]*?)\]/mg,
	handler: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			var link = lookaheadMatch[2];
			var text = lookaheadMatch[1] ? lookaheadMatch[1] : link;
			createTiddlyText(createTiddlyLink(w.output,link,false,null,w.isStatic,w.tiddler),text);
			w.nextMatch = this.lookaheadRegExp.lastIndex;
		}
	}
},

{
	name: 'socialtextExternalLink',
	match: '(?:".*?" ?)?<[a-z]{2,8}:',
	lookaheadRegExp: /(?:\"(.*?)\" ?)?<([a-z]{2,8}:.*?)>/mg,
	imgRegExp: /\.(?:gif|ico|jpg|png)/g,
	handler: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			var link = lookaheadMatch[2];
			var text = lookaheadMatch[1] ? lookaheadMatch[1] : link;
			this.imgRegExp.lastIndex = 0;
			if(this.imgRegExp.exec(link)) {
				var img = createTiddlyElement(w.output,'img');
				if(lookaheadMatch[1]) {
					img.title = text;
				}
				img.alt = text;
				img.src = link;
			} else {
				createTiddlyText(createExternalLink(w.output,link),text);
			}
			w.nextMatch = this.lookaheadRegExp.lastIndex;
		}
	}
},

{
	name: 'socialtextUrlLink',
	match: config.textPrimitives.urlPattern,
	handler: function(w)
	{
		w.outputText(createExternalLink(w.output,w.matchText),w.matchStart,w.nextMatch);
	}
},

{
	name: 'socialtextBold',
	match: '\\*(?![\\s\\*])',
	lookaheadRegExp: /\*(?!\s)(?:.*?)(?!\s)\*(?=[$\s\|\._\-,])/mg,
	termRegExp: /((?!\s)\*(?=[$\s\|\.\-_,]))/mg,
	element: 'strong',
	handler: config.formatterHelpers.singleCharFormat
},

{
	name: 'socialtextItalic',
	match: '_(?![\\s_])',
	lookaheadRegExp: /_(?!\s)(?:.*?)(?!\s)_(?=[$\s\|\.\*\-,])/mg,
	termRegExp: /((?!\s)_(?=[$\s\|\.\*\-,]))/mg,
	element: 'em',
	handler: config.formatterHelpers.singleCharFormat
},

{
	name: 'socialtextStrike',
	match: '-(?![\\s\\-])',
	lookaheadRegExp: /-(?!\s)(?:.*?)(?!\s)-(?=[$\s\|\.\*_,])/mg,
	termRegExp: /((?!\s)-(?=[$\s\|\.\*_,]))/mg,
	element: 'del',
	handler: config.formatterHelpers.singleCharFormat
},

{
	name: 'socialtextMonoSpaced',
	match: '`(?![\\s`])',
	lookaheadRegExp: /`(?!\s)(?:.*?)(?!\s)`(?=[$\s\.\*\-_,])/mg,
	termRegExp: /((?!\s)`(?=[$\s\.\*\-_,]))/mg,
	element: 'tt',
	handler: config.formatterHelpers.singleCharFormat
},

{
	name: 'socialtextParagraph',
	match: '\\n{2,}',
	handler: function(w)
	{
		createTiddlyElement(w.output,'p');
	}
},

{
	name: 'socialtextLineBreak',
	match: '\\n',
	handler: function(w)
	{
		createTiddlyElement(w.output,'br');
	}
},

{
	name: 'socialtextNoWiki',
	match: '\\{\\{',
	lookaheadRegExp: /\{\{((?:.|\n)*?)\}\}/mg,
	element: 'span',
	handler: config.formatterHelpers.enclosedTextHelper
},

{
	name: 'socialtextTrademark',
	match: '\\{tm\\}',
	handler: function(w)
	{
		createTiddlyElement(w.output,'span').innerHTML = '&trade;';
	}
},

{
	name: 'socialtextWafl',
	match: '\\{(?:[a-z]{2,16}): ?.*?\\}',
	lookaheadRegExp: /\{([a-z]{2,16}): ?(.*?)\}/mg,
	handler: SocialtextFormatter.wafl
},

{
	name: 'socialtextPresence',
	match: '(?:aim|yahoo|ymsgr|skype|callto|asap):\\w+',
	lookaheadRegExp: /(aim|yahoo|ymsgr|skype|callto|asap):(\w+)/mg,
	handler: SocialtextFormatter.presence
},

{
	name: 'socialtextMailTo',
	match: '[\\w\.]+@[\\w]+\.[\\w\.]+',
	lookaheadRegExp: /([\w\.]+@[\w]+\.[\w\.]+)/mg,
	handler: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			var text = lookaheadMatch[1];
			createTiddlyText(createExternalLink(w.output,'mailto:'+text),text);
			w.nextMatch = this.lookaheadRegExp.lastIndex;
		}
	}
},

{
	name: 'socialtextHtmlEntitiesEncoding',
	match: '&#?[a-zA-Z0-9]{2,8};',
	handler: function(w)
	{
		createTiddlyElement(w.output,'span').innerHTML = w.matchText;
	}
}
];

config.parsers.socialtextFormatter = new Formatter(config.socialtext.formatters);
config.parsers.socialtextFormatter.format = 'socialtext';
config.parsers.socialtextFormatter.formatTag = 'SocialtextFormat';

} // end of 'install only once'
//}}}
/***
|''Name:''|SocialtextAdaptorPlugin|
|''Description:''|Adaptor for moving and converting data to and from Socialtext Wikis|
|''Author:''|Martin Budden (mjbudden (at) gmail (dot) com) and JeremyRuston (jeremy (at) osmosoft (dot) com)|
|''Source:''|http://www.martinswiki.com/#SocialtextAdaptorPlugin|
|''CodeRepository:''|http://svn.tiddlywiki.org/Trunk/contributors/MartinBudden/adaptors/SocialtextAdaptorPlugin.js|
|''Version:''|0.5.1|
|''Date:''|Feb 25, 2007|
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev|
|''License:''|[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|''~CoreVersion:''|2.2.0|

Socialtext REST documentation is at:
http://www.eu.socialtext.net/st-rest-docs/index.cgi?socialtext_rest_documentation

***/

//{{{
if(!version.extensions.SocialtextAdaptorPlugin) {
version.extensions.SocialtextAdaptorPlugin = {installed:true};

function SocialtextAdaptor()
{
	this.host = null;
	this.workspace = null;
	return this;
}

SocialtextAdaptor.mimeType = 'text/x.socialtext-wiki';
SocialtextAdaptor.serverType = 'socialtext';
SocialtextAdaptor.serverParsingErrorMessage = "Error parsing result from server";
SocialtextAdaptor.errorInFunctionMessage = "Error in function SocialtextAdaptor.%0";

SocialtextAdaptor.prototype.setContext = function(context,userParams,callback)
{
	if(!context) context = {};
	context.userParams = userParams;
	if(callback) context.callback = callback;
	context.adaptor = this;
	if(!context.host)
		context.host = this.host;
	if(!context.workspace && this.workspace)
		context.workspace = this.workspace;
	return context;
};

SocialtextAdaptor.doHttpGET = function(uri,callback,params,headers,data,contentType,username,password)
{
	return doHttp('GET',uri,data,contentType,username,password,callback,params,headers);
};

SocialtextAdaptor.doHttpPOST = function(uri,callback,params,headers,data,contentType,username,password)
{
	return doHttp('POST',uri,data,contentType,username,password,callback,params,headers);
};

SocialtextAdaptor.fullHostName = function(host)
{
	if(!host)
		return '';
	if(!host.match(/:\/\//))
		host = 'http://' + host;
	if(host.substr(host.length-1) != '/')
		host = host + '/';
	return host;
};

SocialtextAdaptor.minHostName = function(host)
{
	return host ? host.replace(/^http:\/\//,'').replace(/\/$/,'') : '';
};

// Convert a page title to the normalized form used in uris
SocialtextAdaptor.normalizedTitle = function(title)
{
	var n = title.toLowerCase();
	n = n.replace(/\s/g,'_').replace(/\//g,'_').replace(/\./g,'_').replace(/:/g,'').replace(/\?/g,'');
	if(n.charAt(0)=='_')
		n = n.substr(1);
	return String(n);
};

// Convert a Socialtext date in YYYY-MM-DD hh:mm format into a JavaScript Date object
SocialtextAdaptor.dateFromEditTime = function(editTime)
{
	var dt = editTime;
	return new Date(Date.UTC(dt.substr(0,4),dt.substr(5,2)-1,dt.substr(8,2),dt.substr(11,2),dt.substr(14,2)));
};

SocialtextAdaptor.prototype.openHost = function(host,context,userParams,callback)
{
	this.host = SocialtextAdaptor.fullHostName(host);
	context = this.setContext(context,userParams,callback);
	if(context.callback) {
		context.status = true;
		window.setTimeout(function() {callback(context,userParams);},0);
	}
	return true;
};

SocialtextAdaptor.prototype.openWorkspace = function(workspace,context,userParams,callback)
{
	this.workspace = workspace;
	context = this.setContext(context,userParams,callback);
	if(context.callback) {
		context.status = true;
		window.setTimeout(function() {callback(context,userParams);},0);
	}
	return true;
};


SocialtextAdaptor.prototype.getWorkspaceList = function(context,userParams,callback)
{
	context = this.setContext(context,userParams,callback);
	var uriTemplate = '%0data/workspaces';
	var uri = uriTemplate.format([context.host]);
	var req = SocialtextAdaptor.doHttpGET(uri,SocialtextAdaptor.getWorkspaceListCallback,context,{'accept':'application/json'});
	return typeof req == 'string' ? req : true;
};

SocialtextAdaptor.getWorkspaceListCallback = function(status,context,responseText,uri,xhr)
{
	context.status = false;
	context.statusText = SocialtextAdaptor.errorInFunctionMessage.format(['getWorkspaceListCallback']);
	if(status) {
		try {
			eval('var info=' + responseText);
		} catch (ex) {
			context.statusText = exceptionText(ex,SocialtextAdaptor.serverParsingErrorMessage);
			if(context.callback)
				context.callback(context,context.userParams);
			return;
		}
		var list = [];
		for(var i=0; i<info.length; i++) {
			var item = {
				title:info[i].title,
				name:info[i].name,
				modified:SocialtextAdaptor.dateFromEditTime(info[i].modified_time)
				};
			list.push(item);
		}
		context.workspaces = list;
		context.status = true;
	} else {
		context.statusText = xhr.statusText;
	}
	if(context.callback)
		context.callback(context,context.userParams);
};

SocialtextAdaptor.prototype.getTiddlerList = function(context,userParams,callback)
{
	context = this.setContext(context,userParams,callback);
	var uriTemplate = '%0data/workspaces/%1/pages?order=newest';//!! ? or ;
	var uri = uriTemplate.format([context.host,context.workspace]);
	var req = SocialtextAdaptor.doHttpGET(uri,SocialtextAdaptor.getTiddlerListCallback,context,{'accept':'application/json'});
	return typeof req == 'string' ? req : true;
};


SocialtextAdaptor.getTiddlerListCallback = function(status,context,responseText,uri,xhr)
{
	context.status = false;
	context.statusText = SocialtextAdaptor.errorInFunctionMessage.format(['getTiddlerListCallback']);
	if(status) {
		try {
			eval('var info=' + responseText);
		} catch (ex) {
			context.statusText = exceptionText(ex,SocialtextAdaptor.serverParsingErrorMessage);
			if(context.callback)
				context.callback(context,context.userParams);
			return;
		}
		var list = [];
		for(var i=0; i<info.length; i++) {
			var tiddler = new Tiddler(info[i].name);
			tiddler.modified = SocialtextAdaptor.dateFromEditTime(info[i].last_edit_time);
			tiddler.modifier = info[i].last_editor;
			tiddler.tags = info[i].tags;
			tiddler.fields['server.page.id'] = info[i].page_id;
			tiddler.fields['server.page.name'] = info[i].name;
			tiddler.fields['server.page.revision'] = String(info[i].revision_id);
			list.push(tiddler);
		}
		context.tiddlers = list;
		context.status = true;
	} else {
		context.statusText = xhr.statusText;
	}
	if(context.callback)
		context.callback(context,context.userParams);
};

SocialtextAdaptor.prototype.generateTiddlerInfo = function(tiddler)
{
	var info = {};
	var host = this && this.host ? this.host : SocialtextAdaptor.fullHostName(tiddler.fields['server.host']);
	var workspace = this && this.workspace ? this.workspace : tiddler.fields['server.workspace'];
	uriTemplate = '%0%1/index.cgi?%2';
	info.uri = uriTemplate.format([host,workspace,SocialtextAdaptor.normalizedTitle(tiddler.title)]);
	return info;
};

SocialtextAdaptor.prototype.getTiddler = function(title,context,userParams,callback)
{
	return this.getTiddlerRevision(title,null,context,userParams,callback);
};

SocialtextAdaptor.prototype.getTiddlerRevision = function(title,revision,context,userParams,callback)
{
	context = this.setContext(context,userParams,callback);

	// request the page in json format to get the page attributes
	if(revision) {
		var uriTemplate = '%0data/workspaces/%1/pages/%2/revisions/%3';
		context.revision = revision;
	} else {
		uriTemplate = '%0data/workspaces/%1/pages/%2';
		context.revision = null;
	}
	uri = uriTemplate.format([context.host,context.workspace,SocialtextAdaptor.normalizedTitle(title),revision]);

	context.tiddler = new Tiddler(title);
	context.tiddler.fields.wikiformat = 'socialtext';
	context.tiddler.fields['server.host'] = SocialtextAdaptor.minHostName(context.host);
	context.tiddler.fields['server.workspace'] = context.workspace;
	var req = SocialtextAdaptor.doHttpGET(uri,SocialtextAdaptor.getTiddlerCallback,context,{'accept':'application/json'});
	return typeof req == 'string' ? req : true;
};


SocialtextAdaptor.getTiddlerCallback = function(status,context,responseText,uri,xhr)
{
	context.status = false;
	context.statusText = SocialtextAdaptor.errorInFunctionMessage.format(['getTiddlerCallback']);
	if(status) {
		try {
			eval('var info=' + responseText);
			context.tiddler.tags = info.tags;
			context.tiddler.fields['server.page.id'] = info.page_id;
			context.tiddler.fields['server.page.name'] = info.name;
			context.tiddler.fields['server.page.revision'] = String(info.revision_id);
			context.tiddler.modifier = info.last_editor;
			context.tiddler.modified = SocialtextAdaptor.dateFromEditTime(info.last_edit_time);
		} catch (ex) {
			context.statusText = exceptionText(ex,SocialtextAdaptor.serverParsingErrorMessage);
			if(context.callback)
				context.callback(context,context.userParams);
			return;
		}
		context.status = true;
	} else {
		context.statusText = xhr.statusText;
		if(context.callback)
			context.callback(context,context.userParams);
		return;
	}
	var uriTemplate = context.revision ? '%0data/workspaces/%1/pages/%2/revisions/%3' : '%0data/workspaces/%1/pages/%2';
	var host = SocialtextAdaptor.fullHostName(context.tiddler.fields['server.host']);
	var workspace = context.workspace ? context.workspace : context.tiddler.fields['server.workspace'];
	uri = uriTemplate.format([host,workspace,SocialtextAdaptor.normalizedTitle(context.tiddler.title),context.revision]);
	var req = SocialtextAdaptor.doHttpGET(uri,SocialtextAdaptor.getTiddlerCallback2,context,{'accept':SocialtextAdaptor.mimeType});
};

SocialtextAdaptor.getTiddlerCallback2 = function(status,context,responseText,uri,xhr)
{
	context.tiddler.text = responseText;
	if(status) {
		context.status = true;
	} else {
		context.status = false;
		context.statusText = xhr.statusText;
	}
	if(context.callback)
		context.callback(context,context.userParams);
};

SocialtextAdaptor.prototype.getTiddlerRevisionList = function(title,limit,context,userParams,callback)
{
	context = this.setContext(context,userParams,callback);

	var uriTemplate = '%0data/workspaces/%1/pages/%2/revisions?accept=application/json';
	if(!limit)
		limit = 5;
	var uri = uriTemplate.format([context.host,context.workspace,SocialtextAdaptor.normalizedTitle(title),limit]);

	var req = SocialtextAdaptor.doHttpGET(uri,SocialtextAdaptor.getTiddlerRevisionListCallback,context);
	return typeof req == 'string' ? req : true;
};

SocialtextAdaptor.getTiddlerRevisionListCallback = function(status,context,responseText,uri,xhr)
{
	context.status = false;
	if(status) {
		var content = null;
		try {
			eval('var info=' + responseText);
		} catch (ex) {
			context.statusText = exceptionText(ex,SocialtextAdaptor.serverParsingErrorMessage);
			if(context.callback)
				context.callback(context,context.userParams);
			return;
		}
		list = [];
		for(var i=0; i<info.length; i++) {
			var tiddler = new Tiddler(info[i].name);
			tiddler.modified = SocialtextAdaptor.dateFromEditTime(info[i].last_edit_time);
			tiddler.modifier = info[i].last_editor;
			tiddler.tags = info[i].tags;
			tiddler.fields['server.page.id'] = info[i].page_id;
			tiddler.fields['server.page.name'] = info[i].name;
			tiddler.fields['server.page.revision'] = info[i].revision_id;
			list.push(tiddler);
		}
		var sortField = 'server.page.revision';
		list.sort(function(a,b) {return a.fields[sortField] < b.fields[sortField] ? +1 : (a.fields[sortField] == b.fields[sortField] ? 0 : -1);});
		context.revisions = list;
		context.status = true;
	} else {
		context.statusText = xhr.statusText;
	}
	if(context.callback)
		context.callback(context,context.userParams);
};

SocialtextAdaptor.prototype.putTiddler = function(tiddler,context,userParams,callback)
{
	context = this.setContext(context,userParams,callback);
	context.tiddler = tiddler;
	context.title = tiddler.title;
	var uriTemplate = '%0data/workspaces/%1/pages/%2';
	var host = context.host ? context.host : SocialtextAdaptor.fullHostName(tiddler.fields['server.host']);
	var workspace = context.workspace ? context.workspace : tiddler.fields['server.workspace'];
	var uri = uriTemplate.format([host,workspace,tiddler.title,tiddler.text]);
	//var req = doHttp('POST',uri,tiddler.text,SocialtextAdaptor.mimeType,null,null,SocialtextAdaptor.putTiddlerCallback,context,{"X-Http-Method": "PUT"});
	var req = SocialtextAdaptor.doHttpPOST(uri,SocialtextAdaptor.putTiddlerCallback,context,{"X-Http-Method": "PUT"},tiddler.text,SocialtextAdaptor.mimeType);
	return typeof req == 'string' ? req : true;
};

SocialtextAdaptor.putTiddlerCallback = function(status,context,responseText,uri,xhr)
{
	if(status) {
		context.status = true;
	} else {
		context.status = false;
		context.statusText = xhr.statusText;
	}
	if(context.callback)
		context.callback(context,context.userParams);
};

SocialtextAdaptor.prototype.close = function()
{
	return true;
};

config.adaptors[SocialtextAdaptor.serverType] = SocialtextAdaptor;
} //# end of 'install only once'
//}}}
/***
SocialtextStyleOverrides
***/

/*{{{*/
.headerShadow {padding: 2em 0em .5em 1em;}
.headerForeground {padding: 2em 0em .5em 1em;}

#st-page-wiki-title {
	font-size: 80%;
}
.subtitle {
	font-style: italic;
	font-size 80%;
}

/* from #st-tags */
.tagged {
	border-color: #bbeebb;
	background-color: #f4fff4;
}

.tagged .listTitle {
	color: #595;
	font-weight: bold;
}

.tagged .button {
	color: #000;
}

.selected .tagged {
	background-color: ColorPalette::TertiaryLight;
	border: 1px solid ColorPalette::TertiaryMid;
}

/* from #st-incoming-links */
.tagging {
	border-color: #ebb;
	background-color: #fff4f4;
}

.tagging .listTitle {
	color: #b78;
	font-weight: bold;
}

.tagging .button {
	color: #999;
}

.selected .tagging {
	background-color: ColorPalette::TertiaryLight;
	border: 1px solid ColorPalette::TertiaryMid;
}

.tiddler {/* Tiddler body */
	border:1px solid #ccc;
	margin:0.5em;
	background:#fff;
	padding:0.5em;
}

.viewer blockquote {border-left: 0px solid}

.tiddlyLinkNonExisting {
	font-style: italic;
	border-bottom: 1px dashed;
}

.editor input, .editor textarea {
	background: #ffd;
	border-style: solid;
	border-color: #888 #ccc #ccc #888;
	border-width: 2px;
}

.tabContents {white-space: nowrap;}

#displayArea {margin: 1em 20em 0em 14em;}

#sidebar {
	position: absolute;
	right: 3px;
	width: 21em;
	font-size: .9em;
}

#sidebarOptions .button {
	border-color: #eee;
}

#sidebarTabs .tabContents {
	width: 20em;
	overflow: hidden;
}

.viewer tt {
	font-size: 1.2em;
	line-height: 1.4em;
}

ul {list-style-type: square;}
ul ul {list-style-type: circle;}

ol {list-style-type: decimal;}
ol ol {list-style-type: decimal;}
ol ol ol {list-style-type: decimal;}
ol ol ol ol {list-style-type: decimal;}
ol ol ol ol ol {list-style-type: decimal;}
ol ol ol ol ol ol {list-style-type: decimal;}

/*}}}*/
/***
SocialtextScreenStyle
http://www.eu.socialtext.net/static/2.0.0.1/css/st/screen.css
***/

/*{{{*/
body {
	font-family: Arial, sans-serif;
	color: #000;
	background: #eee;
	margin: 0;
}

/* Wiki Navigation */

.st-wiki-nav {
	clear: both;
	margin-left: 10px;
	margin-right: 10px;
}
.st-wiki-nav-content {
	background: url('../../images/st/wiki-nav/solid.gif') repeat-x left bottom;
	margin-left: 24px;
	margin-right: 24px;
	padding-top: 3px;
	min-height: 24px;
}
* html .st-wiki-nav-content {
	padding-bottom: 3px;
	height: 24px;
}

.st-wiki-nav-right {
	background: url('../../images/st/wiki-nav/right-round.gif') no-repeat bottom right;
}

.st-wiki-nav-left {
	background: url('../../images/st/wiki-nav/left-round.gif') no-repeat bottom left;
}

#st-home {
	float: left;
	margin-right: 60px;
	padding-top: 2px;
}

#st-home-link {
	color: white;
	text-decoration: none;
	font-weight: bold;
	font-family: Helvetica, sans-serif;
	font-size: 90%;
}

#st-editing-prefix-container {
	border-collapse: collapse;
	width: 100%;
	padding: 0px;
	margin: 0px;
	margin-bottom: -20px;
}

#st-editing-prefix-container tr td {
	margin: 0px;
	padding: 0px;
}

#st-editing-title {
	color: black;
	background-color: white;
	text-decoration: none;
	font-weight: bold;
	font-family: Helvetica, sans-serif;
	font-size: 90%;
	margin-bottom: 0.4em;
}

#st-wiki-title-invite {
	font-size: 50%;
	font-family: Helvetica, sans-serif;
}

#st-wiki-title-central-page-link {
	font-size: 50%;
	font-family: Helvetica, sans-serif;
}

#st-wiki-title-invite a {
	color: #00f;
}

#st-wiki-logo {
	text-align: center;
	clear: both;
}

#st-wiki-logo-image {
}

.st-wiki-nav-actions {
	float: right;
	color: black;
	font-size: 75%;
	padding-top: 3px;
}

.st-wiki-nav-actions a {
	padding: 2px;
	color: white;
	text-decoration: none;
	font-family: Helvetica, sans-serif;
}

/* Wiki Subnav */

#st-wiki-subnav {
	margin-top: 2px;
	font-size: 70%;
	font-weight: bold;
	font-family: Helvetica, sans-serif;
	color: #888;
}

#st-wiki-subnav a {
	padding: 2px;
	color: #008;
	text-decoration: none;
}

#st-wiki-subnav-right {
	float: right;
	margin-right: 6em;
}

#st-wiki-subnav-left {
	float: left;
	margin-left: 6em;
}
* html #st-wiki-subnav-left {
	margin-left: 3em;
}

/* Wiki Navigation Search Bar */

#st-search-form {
	margin: 0;
	padding: 0;
	padding-top: 1px;
}

#st-search-form .button-table {
	float: left;
	font-size: 79%;
	font-weight: bold;
	margin-left: 5px;
	margin-top: 1px;
}

#st-search-form #st-search-term {
	float: left;
	font-size: 60%;
}

/* Content Outline */

#st-content-border, #st-edit-border {
	position: relative;
	clear: both;
	margin-left: 3px;
	margin-right: 2px;
	margin-bottom: 0px;
	margin-top: 0px;
	border-bottom: 1px solid #eee;
}

#st-content-border-left, #st-edit-border-left {
	background: url('../../images/st/page-shadow/left.gif') left top repeat-y;
	position: relative;
}

#st-content-border-right, #st-edit-border-right {
	background: url('../../images/st/page-shadow/right.gif') right top repeat-y;
	position: relative;
}

#st-content-border-top, #st-edit-border-top {
	position: relative;
	background: url('../../images/st/page-shadow/top.gif') left top repeat-x;
}

#st-content-border-bottom, #st-edit-border-bottom {
	background: url('../../images/st/page-shadow/bottom.gif') left bottom repeat-x;
	position: relative;
}

#st-content-border-left-top, #st-edit-border-left-top {
	background: url('../../images/st/page-shadow/left-top.gif') left top no-repeat;
	position: relative;
}
#st-content-border-right-top, #st-edit-border-right-top {
	background: url('../../images/st/page-shadow/right-top.gif') right top no-repeat;
	position: relative;
}

#st-content-border-left-bottom, #st-edit-border-left-bottom {
	background: url('../../images/st/page-shadow/left-bottom.gif') left bottom no-repeat;
	position: relative;
}

#st-content-border-right-bottom, #st-edit-border-right-bottom {
	background: url('../../images/st/page-shadow/right-bottom.gif') right bottom no-repeat;
	padding-top: 5px;
	padding-bottom: 9px;
	position: relative;
}

* html #st-content-border-right-bottom, * html #st-edit-border-right-bottom {
	padding-top: 4px;
	padding-left: 7px;
	padding-right: 8px;
	position: relative;
}

.st-content-width-controller {
	width: 100%;
	position: relative;
	border-collapse: collapse;
}
.st-content-width-controller td {
	vertical-align: top;
}
.st-content {
	position: relative;
	background-color: white;
	margin-top: 0px;
	margin-left: 7px;
	margin-right: 8px;
	margin-bottom: -1px;
	border-left: 1px dotted #80a9f3;
	border-right: 1px dotted #80a9f3;
	border: 1px solid #80a9f3;
	padding: 6px 12px 12px 12px;
}
* html .st-content {
	margin-top: 0px;
	margin-left: 0px;
	margin-right: 0px;
}

/* This textarea is only for Safari. However, if we use display:none; here Safari ignores the .value operation in JS */
#st-raw-wikitext-textarea {
	width:1px;
	height:1px;
	margin:0;
	padding:0;
}

/* Action Buttons */
.button-table, .button-table tr td {
	border-collapse: collapse;
	margin: 0;
	padding: 0;
}
.button-rounded {
	background: url('../../images/st/grey-button/left-top-rounded.png') top left no-repeat;
	margin: 0;
}
.button-rounded-right-top {
	background: url('../../images/st/grey-button/right-top-rounded.png') top right no-repeat;
	margin: 0;
}
.button-rounded-left-bottom {
	background: url('../../images/st/grey-button/left-bottom-rounded.png') bottom left no-repeat;
	margin: 0;
}
.button-rounded-right-bottom {
	background: url('../../images/st/grey-button/right-bottom-rounded.png') bottom right no-repeat;
	margin: 0;
}
.button-straight {
	background: url('../../images/st/grey-button/left-top-straight.png') top left no-repeat;
	margin: 0;
}
.button-straight-right-top {
	background: url('../../images/st/grey-button/right-top-straight.png') top right no-repeat;
	margin: 0;
}
.button-straight-left-bottom {
	background: url('../../images/st/grey-button/left-bottom-straight.png') bottom left no-repeat;
	margin: 0;
}
.button-straight-right-bottom {
	background: url('../../images/st/grey-button/right-bottom-straight.png') bottom right no-repeat;
	margin: 0;
}
.button-content {
	font-size: 90%;
}
.button-content a {
	display: block;
	padding: 2px;
	padding-left: 10px;
	padding-right: 10px;
	font-family: Helvetica, Verdana, sans-serif;
	font-weight: bold;
	text-decoration: none;
	color: black;
}

.button-content input.submit {
	border: 0px;
	padding: 2px;
	padding-left: 10px;
	padding-right: 10px;
	font-family: Helvetica, Verdana, sans-serif;
	font-weight: bold;
	text-decoration: none;
	color: black;
	background-color: transparent;
}

/* Personal Homepage */

#st-homepage {
	background: white url('../../images/st/homepage/blue-fade.gif') top left no-repeat;
}

#st-homepage-layout {
	margin-top: 15px;
	clear: both;
	width: 100%;
	border-collapse: collapse;
}

#st-homepage-layout tr td.st-homepage-layout-cell {
	padding: 5px;
	vertical-align: top;
}

#st-homepage-layout-dashboard {
	width: 50%
}

#st-homepage-layout-notes {
	width: 50%;
}

#st-homepage-notes, #st-homepage-dashboard {
	text-align: left;
	width: 95%;
}

#st-user-greeting, #st-wiki-title {
	font-family: Helvetica, Verdana, sans-serif;
	font-size: 150%;
}
#st-wiki-title {
	margin-left: 5px;
}

#st-user-greeting {
	position: relative;
	text-align: right;
	float: right;
}

#st-group-notes-content, #st-personal-notes-content {
}

.st-homepage-section {
	margin-bottom: 15px;
}

#st-homepage-notes .st-homepage-section {
	background-color: white;
	border: 1px solid #aaa;
	padding: 15px;
}

.st-homepage-section-title {
	font-size: 110%;
	font-family: Helvetica, Verdana, sans-serif;
}

#st-homepage-notes .st-homepage-section-title {
	color: #aaa;
	text-decoration: underline;
}

.st-homepage-notes-edit-link {
	background: url('../../images/st/homepage/edit-icon.gif') no-repeat left top;
	display: block;
	text-indent: -2000px;
	height: 13px;
	width: 36px;
	text-decoration: none;
	padding:0;
}
* html .st-homepage-notes-edit-link {
	border:1px solid white;
}

.st-homepage-notes-edit {
	font-family: Verdana, sans-serif;
	font-size: 65%;
	float: right;
}

.st-homepage-notes-content {
	font-size: 85%;
	margin-top: 10px;
	padding-top: 0px;
	padding-bottom: 0px;
	font-family: Verdana, Helvetica, sans-serif;
}

#st-dyk {
	border-color: #cca !important;
	background-color: #ffe !important;
}

#st-dyk-title {
	color: #e4a020 !important;
	text-decoration: none !important;
}


/* Homepage Simple List */

#st-whats-new-title-link {
	background: url('../../images/st/homepage/icon-28-pages.gif') no-repeat left top;
}
#st-watchlist-title-link {
	background: url('../../images/st/homepage/icon-28-star.gif') no-repeat left top;
}
#st-wikis-title-link {
	background: url('../../images/st/homepage/icon-28-group.gif') no-repeat left top;
}
.st-homepage-simplelist-title-link {
	display: block;
	padding-left: 32px;
	min-height: 32px;
}
* html .st-homepage-simplelist-title-link {
	height: 32px;
}

.st-homepage-simplelist-title {
}

.st-homepage-simplelist-table {
	margin-left: 25px;
	border: 1px dashed #ddd;
	border-collapse: collapse;
	font-family: Verdana, Helvetica, sans-serif;
	font-size: 80%;
	width: 95%;
}

.st-homepage-simplelist-table td {
	padding: 2px;
}

.st-homepage-simplelist-table tr.st-homepage-simplelist-row-odd {
	background-color: #f3f7f7;
}

.st-homepage-simplelist-table tr.st-homepage-simplelist-row-even {
	background-color: white;
}

.st-homepage-simplelist-table a {
	color: #4f55dd;
	text-decoration: none;
}

.st-homepage-simplelist-table a:visited {
	color: #551a8b;
}

.st-homepage-simplelist-subleft {
	font-size: 80%;
	margin-left: 1em;
	color: #666;
}

.st-homepage-simplelist-right {
	width: 20%;
}

.st-homepage-simplelist-subright {
	font-size: 80%;
	color: #666;
}

.st-homepage-simplelist {
}

.st-homepage-simplelist-header {
	min-height: 35px;
}

.st-homepage-simplelist-header .button-table {
	float: right;
	margin-right: 15px;
	font-size: 95%;
}

.st-homepage-simplelist-header .button-table .button-content {
	padding: 1px;
}

.st-homepage-whatsnew-author, .st-homepage-whatsnew-date {
	color: #555;
}
.st-homepage-whatsnew-attribution {
	padding-left: 1em;
	font-size: 80%;
	color: #aaa;
}

/* Homepage Wikis List */

#st-wikis-title {
}

/* Data and Templates */

.st-jst-template, .st-json {
	display: none;
}

/* Page Sidebox Common Styles */

#st-page-boxes-toggle {
	position: relative;
	float: right;
	text-align: right;
	font-family: Verdana, Arial, sans-serif;
	font-weight: bold;
	font-size: 80%;
	margin-bottom: 0.7em;
}

#st-page-boxes-toggle-link {
	text-decoration: none;
}

#st-page-boxes-underlay {
	float: right;
	margin-top: -10px;
	margin-right: 10px;
	background: white;
	z-index: 198;
	clear: both;
	margin-left: 15px;
}
* html #st-page-boxes-underlay {
	margin-right: 4px;
}
#st-page-boxes {
	background: inherit;
	position: absolute;
	right: 23px;
	z-index: 199;
	margin-top: 15px;
	margin-left: 20px;
}
#st-page-boxes, #st-page-boxes-underlay {
	width: 225px;
	/* padding-left: 15px; */ /* Gives the white border effect, cwest dislikes it. */
}

.st-page-box {
	border: 1px solid black;
	padding: 5px;
	font-family: Verdana, Helvetica, sans-serif;
	font-size: 80%;
	margin-top: 15px;
}

.st-page-box-title {
	font-family: Helvetica, Verdana, sans-serif;
	font-weight: bold;
	margin-bottom: 10px;
}

.st-page-box-listing {
	margin: 0;
	padding: 0;
}

.st-page-box-listing-entry {
	display: block;
}

.st-page-boxes-nobacklinks {
	font-family: Verdana, Helvetica, sans-serif;
	font-size: 90%;
	color: #888;
}

.st-page-box-first {
	margin-top: 0px;
}

/* Page Display */

#st-page-content {
	clear: left;
	margin-top: 6px;
	margin-bottom: 0;
	padding-bottom: 0;
}

#st-page-content, #st-page-content td {
	font-family: Verdana, Helvetica, sans-serif;
	font-size: 90%;
}

#st-page-wiki-title {
	font-family: Helvetica, Verdana, sans-serif;
	font-size: 65%;
	font-weight: bold;
	color: #aaa;
	margin-bottom: 0.2em;
	margin-top: 0.1em;
	padding-top: 0;
}

#wiki {
	margin: 0;
	padding: 0;
}

#st-page-title {
}

#st-page-titletext, .st-page-title {
	font-family: Helvetica, Verdana, sans-serif;
	font-size: 150%;
	font-weight: bold;
	color: #888;
	border-bottom: 1px solid #888;
}

#st-newpage-pagename-edit {
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
	color: #000;
	border: 1px solid black;
	padding-left: 0.3em;
	background-color: #ffd;
}

#st-page-details {
	font-style: italic;
	font-size: 75%;
	font-family: Georgia, serif;
	margin: 6px 10px 0 10px;
}

#st-page-details-feed-icon {
	vertical-align: middle;
	border: none;
}

#st-page-stats {
	float: right;
	vertical-align: middle;
}

#st-attribution {
	float: left;
	margin-bottom: 10px;
}

#st-page-editing-wysiwyg {
	background: #ffd;
	border-style: solid;
	border-color: #888 #ccc #ccc #888;
	border-width: 2px;
	width: 100%;
}

#st-page-editing-toolbar {
	margin-left: -6px;
	overflow: hidden;
	float: left;
	height: 25px;
}

#wikiwyg_wikitext_textarea {
	margin-top: 4px;
	background: #ffd;
	border-style: solid;
	border-color: #888 #ccc #ccc #888;
	border-width: 2px;
	width: 100%;
	font-family: monospace;
}

#st-page-maincontent {
}

#st-page-editing, #wikiwyg_wikitext_textarea {
}

#st-page-editing-pagebody-decoy, #st-page-editing-wysiwyg {
	display: none;
}

#st-editing-tools-edit {
	display: none;
}

#st-mode-wysiwyg-button
{
	font-size: 70%;
	margin-left: 4em;
}

#st-mode-wikitext-button
{
	font-size: 70%;
}

#st-edit-tips
{
	font-size: 70%;
}

.wikiwyg_button {
	background: #FFFFFF;
	border: 1px solid #FFFFFF;
	cursor: pointer;
	width: 20px;
	height: 20px;
	vertical-align: bottom;
}

.wikiwyg_button:hover {
	border: 1px outset;
}

.wikiwyg_button:active {
	border: 1px inset;
}

#wikiwyg_toolbar {
	display: none;
}

/* Sidebox Pagetools: Revisions, Watchlist */
#st-side-box-pagetools {
	border-collapse: collapse;
}

#st-rewind-norevisions {
	font-family: Helvetica, Arial, sans-serif;
	font-size: 11px;
	color: #777;
	text-decoration: none;
}

#st-side-box-pagetools a {
	font-family: Helvetica, Arial, sans-serif;
	font-size: 11px;
	color: #555;
	text-decoration: none;
}

/* Page View Tags/Incoming Links Sidebox */

#st-tags {
	background: #f4fff4;
	border-color: #bbeebb;
	color: #999;
}

#st-tags-title {
	color: #595;
}

#st-tags-addlink, #st-tags-addbutton {
	font-weight: bold;
}

#st-tags-listing {
	margin-bottom: 5px;
}

#st-tags-addinput, #st-tags-message, #st-tags-suggestion {
	display: none;
}

#st-tags-deletemessage {
	font-size: 90%;
	color: #555;
	display: none;
	margin-top: 0.5em;
	margin-bottom: 0.5em;
}

#st-tags-suggestion {
	margin-top: 2px;
}

.st-tags-level1 {
	font-size: 90%;
}

.st-tags-level2 {
	font-size: 100%;
}

.st-tags-level3 {
	font-size: 110%;
}

.st-tags-level4 {
	font-size: 120%;
}

.st-tags-level5 {
	font-size: 130%;
}

.st-tags-tagline .st-tags-tagdelete {
	text-decoration: none;
	color: #ccc;
}

.st-tags-tagline a {
	text-decoration: none;
	color: #444;
}

#st-tags-field {
	width: 95%;
}

#st-incoming-links {
	border-color: #ebb;
	background-color: #fff4f4;
}

#st-incoming-links-title {
	color: #b78;
}

#st-attachments {
	border-color: #bbe;
	background-color: #f4f4ff;
}

#st-attachments-uploadbutton, #st-attachments-managebutton {

}
#st-attachments-buttons-uploadbutton {
	margin: 0px;
	padding: 0px;
	padding-left: 2px;
}
#st-attachments-buttons-managebutton {
	margin: 0px;
	padding: 0px;
	padding-right: 2px;
}

#st-attachments-buttons td {
	padding-right: 3px;
	font-size: 99%;
}

#st-attachments-buttons {
	border-collapse: collapse;
	margin: 0px;
	padding: 0px;
	margin-top: 5px;
}

#st-attachments-title {
	color: #77b;
}

.st-attachments-line {
	width:100%;
	overflow:hidden;
}

/* Actions Bar */

#st-actions-bar-spacer {
	clear:both;
	height:0.5em;
	overflow:hidden;
}

#st-actions-bar-spacer-clear {
	clear:both;
	height:1px;
	overflow:hidden;
}


#st-actions-bar, #st-editing-tools-bar {
	margin-left: 30px !important;
	margin-right: 30px !important;
}

/* Footer */
#st-footer {
	margin-top: -8px;
	margin-bottom: 5px;
	clear: both;
}

/* Socialtext Attribution */

#st-socialtext-attribution {
	clear: both;
	text-align: center;
	font-size: 80%;
	font-family: Helvetica, sans-serif;
}

#st-socialtext-attribution-link {
	text-decoration: none;
}

#st-socialtext-attribution-image {
	border: 0;
}


/* Page Actions */

#st-edit-button-border-left-middle, #st-login-to-edit-button-border-left-middle {
	background: url('../../images/st/button-blue/left-middle.gif') left top repeat-y;
}
#st-edit-button-border-right-middle, #st-login-to-edit-button-border-right-middle {
	background: url('../../images/st/button-blue/right-middle.gif') right top repeat-y;
}

#st-edit-button-border-left-top, #st-login-to-edit-button-border-left-top {
	background: url('../../images/st/button-blue/left-top.gif') left top no-repeat;
}
#st-edit-button-border-right-top, #st-login-to-edit-button-border-right-top {
	background: url('../../images/st/button-blue/right-top.gif') right top no-repeat;
}

#st-edit-button-border-left-bottom, #st-login-to-edit-button-border-left-bottom {
	background: url('../../images/st/button-blue/left-bottom.gif') left bottom no-repeat;
}

#st-edit-button-border-right-bottom, #st-login-to-edit-button-border-right-bottom {
	background: url('../../images/st/button-blue/right-bottom.gif') right bottom no-repeat;
}

#st-edit-button-link, #st-login-to-edit-button-link {
}

#st-comment-button-border-left-middle {
	background: url('../../images/st/button-purple/left-middle.gif') left top repeat-y;
}

#st-comment-button-border-right-middle {
	background: url('../../images/st/button-purple/right-middle.gif') right top repeat-y;
}

#st-comment-button-border-left-top {
	background: url('../../images/st/button-purple/left-top.gif') left top no-repeat;
}

#st-comment-button-border-right-top {
	background: url('../../images/st/button-purple/right-top.gif') right top no-repeat;
}

#st-comment-button-border-left-bottom {
	background: url('../../images/st/button-purple/left-bottom.gif') left bottom no-repeat;
}

#st-comment-button-border-right-bottom {
	background: url('../../images/st/button-purple/right-bottom.gif') right bottom no-repeat;
}

#st-comment-button-link {
}

#st-save-button-border-left-middle {
	background: url('../../images/st/button-green/left-middle.gif') left top repeat-y;
}
#st-save-button-border-right-middle {
	background: url('../../images/st/button-green/right-middle.gif') right top repeat-y;
}

#st-save-button-border-left-top {
	background: url('../../images/st/button-green/left-top.gif') left top no-repeat;
}
#st-save-button-border-right-top {
	background: url('../../images/st/button-green/right-top.gif') right top no-repeat;
}

#st-save-button-border-left-bottom {
	background: url('../../images/st/button-green/left-bottom.gif') left bottom no-repeat;
}

#st-save-button-border-right-bottom {
	background: url('../../images/st/button-green/right-bottom.gif') right bottom no-repeat;
}

#st-save-button-link {
}

#st-preview-button-border-left-middle {
	background: url('../../images/st/button-gold/left-middle.gif') left top repeat-y;
}
#st-preview-button-border-right-middle {
	background: url('../../images/st/button-gold/right-middle.gif') right top repeat-y;
}

#st-preview-button-border-left-top {
	background: url('../../images/st/button-gold/left-top.gif') left top no-repeat;
}
#st-preview-button-border-right-top {
	background: url('../../images/st/button-gold/right-top.gif') right top no-repeat;
}

#st-preview-button-border-left-bottom {
	background: url('../../images/st/button-gold/left-bottom.gif') left bottom no-repeat;
}

#st-preview-button-border-right-bottom {
	background: url('../../images/st/button-gold/right-bottom.gif') right bottom no-repeat;
}

#st-preview-button-link {
}

#st-cancel-button-border-left-middle {
	background: url('../../images/st/button-crimson/left-middle.gif') left top repeat-y;
}
#st-cancel-button-border-right-middle {
	background: url('../../images/st/button-crimson/right-middle.gif') right top repeat-y;
}

#st-cancel-button-border-left-top {
	background: url('../../images/st/button-crimson/left-top.gif') left top no-repeat;
}
#st-cancel-button-border-right-top {
	background: url('../../images/st/button-crimson/right-top.gif') right top no-repeat;
}

#st-cancel-button-border-left-bottom {
	background: url('../../images/st/button-crimson/left-bottom.gif') left bottom no-repeat;
}

#st-cancel-button-border-right-bottom {
	background: url('../../images/st/button-crimson/right-bottom.gif') right bottom no-repeat;
}

#st-cancel-button-link {
}

#st-edit-more-button-border-left-middle {
	background: url('../../images/st/button-blue/left-middle.gif') left top repeat-y;
}
#st-edit-more-button-border-right-middle {
	background: url('../../images/st/button-blue/right-middle.gif') right top repeat-y;
}

#st-edit-more-button-border-left-top {
	background: url('../../images/st/button-blue/left-top.gif') left top no-repeat;
}
#st-edit-more-button-border-right-top {
	background: url('../../images/st/button-blue/right-top.gif') right top no-repeat;
}

#st-edit-more-button-border-left-bottom {
	background: url('../../images/st/button-blue/left-bottom.gif') left bottom no-repeat;
}

#st-edit-more-button-border-right-bottom {
	background: url('../../images/st/button-blue/right-bottom.gif') right bottom no-repeat;
}

#st-edit-more-button-link {
}

.st-page-action-button-link {
	min-height: 24px;
	min-width: 100px;
	text-align: center;
	font-family: Helvetica, Verdana, sans-serif;
	font-size: 90%;
	text-decoration: none;
	color: #fff;
	font-weight: bold;
	display: block;
	padding-top: 8px;
	padding-bottom: 0px;
	margin-bottom: -3px;
	width: 100%;
	margin-left: -2px;
}
* html .st-page-action-button-link {
	padding-top: 5px;
	padding-bottom: 0px;
	height: 24px;
}

.st-page-action-button {
	float: left;
	margin: 0;
	padding: 0;
	margin-right: 10px;
	min-height: 20px;
	border-collapse: collapse;
	width: 100px;
}

/* Attach File Interface */

#st-attachments-attachinterface {
	font-family: Helvetica, sans-serif;
	font-size: 90%;
	display: none;
	position: fixed;
	left: 0px;
	top: 0px;
	width: 100%;
	height: 100%;
	z-index: 2000;
	background-image: url('../../images/st/popup/bg.png');
}
#st-attachments-manageinterface {
	font-family: Helvetica, sans-serif;
	font-size: 90%;
	display: none;
	position: absolute;
	left: 0px;
	top: 0px;
	width: 100%;
	height: 100%;
	z-index: 2000;
	background-image: url('../../images/st/popup/bg.png');
}

* html #st-attachments-attachinterface {
	background-image: none;
}
* html #st-attachments-manageinterface {
	background-image: none;
}
* html .popup-overlay {
	background-image: url('../../images/st/popup/bg.png');
	background-color: #000;
	opacity: .70;
	position: absolute;
	left: 0px;
	top: 0px;
	width: 100%;
	height: 100%;
	z-index: 2001;
}

#st-attachments-attach-interface {
	z-index: 2002;
	background-color: #fff;
	color: #000;
	border: 4px solid #ccc;
	padding: 1em;
	width: 520px;
	margin-left: auto;
	margin-right: auto;
	margin-top: 10%;
	position: absolute;
	top: 0px;
}

* html #st-attachments-attach-interface {
}

#st-attachments-attach-formtarget {
	width: 0px;
	height: 0px;
	border: 0;
	padding: 0;
	margin: 0;
}

#st-attachments-attach-message {
	font-size: 90%;
	font-family: Verdana, Arial, Helvetica, Sans-Serif;
}

#st-attachments-attach-title {
	font-weight: bold;
	font-size: 120%;
}

#st-attachments-attach-close {
	float: right;
	margin-top: 6px;
}

#st-attachments-attach-uploadbutton {
	float: right;
	margin-right: 6px;
	margin-top: 6px;
	padding-bottom: 0;
}

#st-attachments-attach-fileprompt {
	margin: 0.2em 0 0.4em 0;
	padding-bottom: 0px;
}

#st-attachments-attach-submit {
	font-size: 90%;
	font-weight: bold;
}

#st-attachments-attach-filename {
	font-size: 90%;
}

#st-attachments-attach-uploadmessage {
	font-weight: bold;
	margin-bottom: 1em;
	display: none;
}

#st-attachments-attach-error {
	font-weight: bold;
	color: #f00;
	margin-bottom: 1em;
	display: none;
}

#st-attachments-attach-list {
	display: none;
	color: #666;
	font-size: 90%;
	margin-top: 1em;
	margin-bottom: 1em;
	border-top: 1px solid #4949BA;
	border-bottom: 1px solid #4949BA;
	background-color: #F5F5F5;
	padding: 3px;
}

.st-attachments-attach-listlabel {
	font-size: 90%;
	color: #4949BA;
}

/* Queue File Dialog */

#st-attachmentsqueue-interface {
	font-family: Helvetica, sans-serif;
	font-size: 90%;
	display: none;
	position: fixed;
	left: 0px;
	top: 0px;
	width: 100%;
	height: 100%;
	background-image: url('../../images/st/popup/bg.png'); /* Don't forget IE hack for ship! */
	z-index: 2000;
}

* html #st-attachmentsqueue-interface {
	background-image: none;
}

#st-attachmentsqueue-dialog {
	z-index: 2002;
	background-color: #fff;
	color: #000;
	border: 4px solid #ccc;
	padding: 1em;
	width: 530px;
	margin-left: auto;
	margin-right: auto;
	margin-top: 10%;
	position: absolute;
	top: 0px;
}

* html #st-attachmentsqueue-dialog {
}

#st-attachmentsqueue-fileprompt {
	margin-bottom: 0.4em;
	margin-top: 0;
	padding-bottom: 0;
}

#st-attachmentsqueue-title {
	font-weight: bold;
	font-size: 120%;
}

#st-attachmentsqueue-close {
	float: right;
	margin-top: 6px;
}

#st-attachmentsqueue-uploadbutton {
	float: right;
	margin-right: 6px;
	margin-top: 6px;
	padding-bottom: 0;
}

#st-attachmentsqueue-submit {
	font-size: 90%;
}

#st-attachmentsqueue-filename {
	font-size: 90%;
}

#st-attachmentsqueue-message {
	font-size: 90%;
	font-family: Verdana, Arial, Helvetica, Sans-Serif;
}

#st-attachmentsqueue-uploadmessage {
	font-weight: bold;
	margin-bottom: 1em;
	display: none;
}

#st-attachmentsqueue-error {
	font-weight: bold;
	color: #f00;
	margin-bottom: 1em;
	display: none;
}

#st-attachmentsqueue-list {
	display: none;
	color: #666;
	font-size: 90%;
	margin-top: 1em;
	margin-bottom: 1em;
	border-top: 1px solid #4949BA;
	border-bottom: 1px solid #4949BA;
	background-color: #F5F5F5;
	padding: 3px;
}

.st-attachmentsqueue-listlabel {
	font-size: 90%;
	color: #4949BA;
}

/* Lists */

tr.st-trbg-even, tr.st-trbg-even td{
	background-color: #f3f7f7;
}

tr.w-st-even-row, tr.w-st-even-row td {
	background-color: #f3f7f7;
}

.query-results-header-title, .query-results-header-last-edit-by {
	text-align: left;
}


.query-results-row-revisions {
	text-align: right;
}

.query-results-content {
	font-size: 85%;
	border-collapse: collapse;
	border: 1px dashed #ddd;
	border-left: 1px solid #ddd;
	border-right: 1px solid #ddd;
}

.query-results-row {
	border-collapse: collapse;
	border: 1px dashed #ddd;
	border-left: 1px solid #ddd;
	border-right: 1px solid #ddd;
}

.query-results-row a {
	text-decoration: underline;
	color: #00f;
}

.query-results-row td {
	font-family: Verdana;
	padding: 0.3em;
	border-left: 1px dashed #ddd;
	border-right: 1px dashed #ddd;
	border-top: 1px solid #ddd;
	border-bottom: 1px solid #ddd;
}

.query-results-header-row {
	border-collapse: collapse;
	border: 1px dashed #ddd;
	border-left: 1px solid #ddd;
	border-right: 1px solid #ddd;
}

.query-results-header-row a {
	text-decoration: underline;
	color: #00f;
}

.query-results-header-row th {
	font-family: Helvetica;
	padding: 0.3em;
	border-left: 1px dashed #ddd;
	border-right: 1px dashed #ddd;
	border-top: 1px solid #ddd;
	border-bottom: 1px solid #ddd;
}

div.st-actionbutton {
	float: left;
}

div#deleteme-st-actions-bar {
	clear: both;
	margin: 0.8em 20px 0.2em auto;
	padding: 0;
}

/* Manage File Interface */



#st-attachments-manage-interface {
	z-index: 2002;
	background-color: #fff;
	color: #000;
	border: 4px solid #ccc;
	padding: 1em;
	width: 520px;
	margin-left: auto;
	margin-right: auto;
	margin-top: 10%;
	position: absolute;
	top: 0px;
}

#st-attachments-manage-filetable {
	height: 150px;
	margin: 0;
	padding: 0;
	width: 100%;
	overflow: auto;
	border: 1px solid #ccc;
}

#st-attachments-manage-filelisting tbody td {
	font-size: 90%;
}
#st-attachments-manage-filelisting {
	width: 100%;
	border-collapse: collapse;
	border: 0;
	margin: 0;
	padding: 0;
}

#st-attachments-manage-fileheader {
	background: #ccc;
	font-weight: bold;
	border-bottom: 1px black solid;
}

#st-attachments-manage-close {
	float: right;
	margin-top: 3px;
	margin-right: -2px;
	font-weight: bold;
}

#st-attachments-manage-delete {
	margin-top: 3px;
	float: left;
	font-weight: bold;
}

.st-attachments-manage-filerow {
	border-bottom: 1px solid #ccc;
}

.row-odd {
	background-color: #eee;
}

.row-even {
	background-color: #fff;
}

.row-on {
	background-color: #009 !important;
	color: white !important;
}

.row-on a {
	color: #fff !important;
}

#st-attachments-manage-deletemessage {
	color: red;
}

/* Page tools icons */

#st-pagetools-print {
	background: url('../../images/st/pagetools/print.gif')
	left center no-repeat;
}

#st-pagetools-email {
	background: url('../../images/st/pagetools/email.gif')
	left center no-repeat;
}

#st-pagetools-tools {
	background: url('../../images/st/pagetools/tools.gif')
	left center no-repeat;
}

/*
 #st-pagetools-watch {
	background: url('../../images/st/pagetools/watch-blue.gif')
	left center no-repeat;
}
*/


/* *********** Settings *********** */

#st-settings-pane {
}
* html #settings-pane { font-size: 85%;}

.settings-start-table {
}
* html .settings-start-table { font-size: 90%;}

#st-settings-select {
	padding: 0px 10px 10px 10px;
	vertical-align: top;
	width: 1px;

	background-color: #eff1ec;
	border: none;
}

#st-settings-section {
	padding: 0px 10px 10px 10px;
	vertical-align: top;
}

.settings-top-header {
	margin-top: 1em;
	font-weight: bold;
	width: 15em;
}

.settings-header {
	margin-top: 1em;
	font-weight: bold;
}

.settings-selections {
	padding: 0px 0px 0px 20px;
	line-height: 1.5em;
}

.settings-selections a:visited, .settings-selections a:active {
	color: #0000ff;
}

.settings-link {
	clear: both;
	display: block;
}

.settings-section-left {
	text-align: right;
}

.settings-label {
	font-weight: bold;
}

.settings-help {
	color: #888;
}

.settings-comment {
}

.users-invite-message {
	padding: 0.5em 0.5em 0.5em 2em;
	background-color: #eee;
	/* This seems necessary to fix an IE bug that sometimes
		causes the text in this div to be invisible */
	z-index: 1000;
}

.workspace-entry-header {
	margin-top: .5em;
	font-weight: bold;
}

.workspace-entry {
	margin-left: 3em;
}

.workspace-entry-p {
	margin-top: .5em;
	margin-bottom: .75em;
}

.workspace-subentry {
	font-style: italic;
	font-weight: bold;
	margin-left: 1.5em;
}

.preferences-td {
	padding:.5em 0 1.5em 0;
}

.preferences-query {
	text-align: left;
}

.preference-radio {
	background-color: #cec;
}
.user-settings-listall-headings td {
	background-color: #eff3ef;
}

#st-settings-save {
	padding-bottom: 0.5em;
}

.standard-button-cancel {
	font-weight: bold;
	background-color: #71004b;

	border-left: 1px solid #aaa;
	border-top: 1px solid #aaa;
	border-bottom: 2px solid #333;
	border-right: 2px solid #333;
	color: #f4f3b9;
	width: 8em;
}

.standard-button-submit {
	font-weight: bold;
	background-color: #656084;

	border-left: 1px solid #aaa;
	border-top: 1px solid #aaa;
	border-bottom: 2px solid #333;
	border-right: 2px solid #333;
	color: #f4f3b9;
	width: 8em;
}

#st-settings {
	font-family: Verdana, Arial, Helvetica, Sans-Serif;
	font-size: 90%;
}


/* Listview Tabs */


#st-listview a:visited {
	color: #551a8b;
}
#st-listview-tabs ul {
	display: block;
	list-style: none outside;
	margin: 0 0 0 4em;
	padding: 0;
	font-family: Helvetica, Arial, Sans-serif;
	font-size: 80%;
}

#st-listview-tabs li {
	display: block;
	float: left;
	margin: 0 0.8em 0 0;
	padding: 3px 0.6em 0 0.6em;
	border: 1px solid #d8d8d8;
	border-bottom: 1px solid rgb(128, 169, 243);
	background-color: #f4f4f4;
	position: relative;
	bottom: -2px;
}

#st-listview-tabs li.spacer {
	margin: 0 0.8em 0 2em;
}

#st-listview-tabs a {
	color: #bbb;
	text-decoration: none;
}

#st-listview-tabs li.selected {
	background-color: #fff !important;
	border: 1px solid rgb(128, 169, 243) !important;
	border-bottom: 1px solid #fff !important;
	font-weight: bold !important;
}

#st-listview-tabs li.selected a {
	color: #000 !important;
}

/* Category List Display */

#st-category-display-links {
	margin-bottom: 1em;
	font-size: 90%;
}

#st-tag-listbody {
	font-family: Helvetica, Verdana, sans-serif;
}

/* Attachments List Display */

#st-attachments-list-body table.button-table {
	margin-top: 0.1em;
	font-size: 80%;
}


/* ********** PageTools Menu ************** */

div#st-editing-tools {
	float: left;
}

div#st-pagetools {
	z-index: 300;
	font-family: Helvetica, Verdana, sans-serif;
	font-size: 10px;
	float: right;
	margin: 18px 0 0 0em;
	color: #000;
	vertical-align: bottom;
	position: relative;
}

#st-pagetools a {
	text-decoration: none;
	color: black;
	padding-left: 17px;
}

#st-pagetools span {
	color: inherit;
	padding-left: 17px;
	vertical-align: top;
}

#st-pagetools span.st-watchlist-link {
	color: inherit;
	vertical-align: top;
}

.st-watchlist-link {
	cursor: pointer;
}

div#st-pagetools ul.level2 {
	z-index: 300;
	margin: 0;
	padding: 0;
	background: white;
	border: 1px solid #CCC;
	border-width: 0 1px;
}

div#st-pagetools li {
	position: relative;
	list-style: none;
	margin: 0;
	float: left;
	width: 7em;
	line-height: 11px;
}

div#st-pagetools ul ul li:hover {
	background: #BFE2FF;
}

div#st-pagetools li a {
	display: block;
	text-decoration: none;
}

div#st-pagetools>ul a {
	width: auto;
}

div#st-pagetools ul ul {
	position: absolute;
	width: auto;
	display: none;
}

div#st-pagetools ul ul li {
	line-height: 1.5em;
/*	width: 100%; */
	width: 14em;
}

.first {
	border-top: 1px solid #CCC;
}

.separator {
	border-bottom: 1px solid #CCC;
}

div#st-pagetools ul ul li a {
	border-bottom: 1px solid #CCC;
	padding-left: 15px;
	padding-right: 3px;
	margin-right: 3px;
	border: 0px;
}

div#st-pagetools li.submenu li.submenu:hover {
	z-index: 300;
	background-color: #BFE2FF;
}

div#st-pagetools ul.level1 li.submenu:hover ul.level2 {
	display:block;
}

div#st-pagetools ul.level2 {
	top: 1.0em;
	left: -9.5em;
}

/*

=head2 Revision List Display

Change these styles to update the page revision list.

*/

#st-revision-list-table {
	border-collapse: collapse;
	font-size: 85%;
	color: #000;
}

.st-page-title-decorator {
	color: #C80000;
}

.st-revision-header-emphasis {
	color: #C80000;
}

.st-revision-list-compare-button-row {
}

.st-revision-list-compare-button-cell {
	padding-top: 0.3em;
	text-align: center;
}

.st-revision-list-compare-button {
}

#st-revision-list-header-row {
}

#st-revision-list-header-select {
	padding: 6px 2px 2px 2px;
	text-align: center;
}

#st-revision-list-header-revision {
	padding: 6px 2px 2px 2px;
	text-align: left;
}

#st-revision-list-header-edited-by {
	padding: 6px 2px 2px 2px;
	text-align: center;
}

#st-revision-list-header-date {
	padding: 6px 2px 2px 2px;
	text-align: center;
}

.st-revision-list-row {
	border-collapse: collapse;
	border: 1px dashed #ddd;
	border-left: 1px solid #ddd;
	border-right: 1px solid #ddd;
}

.st-revision-list-row td {
	font-family: Verdana;
	padding: 0.3em;
	border-left: 1px dashed #ddd;
	border-right: 1px dashed #ddd;
	border-top: 1px solid #ddd;
	border-bottom: 1px solid #ddd;
}

.st-revision-list-row-select {
	padding: 3px 0 2px 0;
	text-align: center;
}

.st-revision-list-row-select-old {
}

.st-revision-list-row-select-new {
}

.st-revision-list-row-revision {
}

.st-revision-list-row-revision-link {
}

.st-revision-list-row-edited-by {
}

.st-revision-list-row-date {
}

/* Revision Menu */

#st-pagetools.st-revision-view-bar {
	float: left;
}

ul.st-revision-menu {
	list-style: none;
	margin: 0;
	padding: 0.2em;
	font-size: 80%;
}

ul.st-revision-menu li {
	float: left;
	padding: 0 0.4em 0 0.4em;
	border-right: thin solid #000000;
}

ul.st-revision-menu li.st-last {
	border-right: none;
}

#st-restore-revision-button {
	font-size: 80%;
}

/*

=head2 Revision Compare Display

When comparing two revisions of a page, these styles apply.

*/

#st-revision-compare-table {
	background-color: #f0f0f0;
}

#st-revision-compare-table td {
	background-color: white;
}

.st-revision-compare-old {
	background-color: #fdd;
	text-decoration: line-through;
}
.st-revision-compare-new {
	background-color: #dfd;
	font-weight: bold;
}

/* Weblog View */

#st-weblog {
	padding: 0;
}

#st-content-weblog-display-width-controller {
}
#st-content-weblog-display-width-controller-nav {
	width: 230px;
	margin-left: 15px;
	border-left: 5px solid #ddd;
	margin-top: -1px;
}

#st-weblog-content {
	font-family: Verdana, Helvetica, sans-serif;
	margin-top: -1px;
	margin-bottom: -1px;
	border-top: 1px solid #80a9f3;
	border-bottom: 1px solid #80a9f3;
}

#st-weblog-title {
	font-family: 'Trebuchet MS', Verdana, Helvetica, sans-serif;
	font-family: 'Times New Roman', serif;
	background-color: #80a9f3;
	color: #fff;
	font-size: 150%;
	font-weight: bold;
	padding: 0.2em;
	padding-left: 1em;
}

#st-weblog-wikititle {
	font-family: Helvetica, Verdana, sans-serif;
	font-style: italic;
	font-size: 40%;
	color: #fff;
	margin-bottom: 0.2em;
	margin-top: 0.1em;
	padding-top: 0;
}

#st-weblog-titletext {
	font-family: Helvetica, Verdana, sans-serif;
	font-weight: bold;
	color: #fff;
}

div.st-weblog-entry {
	margin-top: 0.2em;
	margin-bottom: 4.8em;
	padding: 0 1.5em 0 1.5em;
}

.st-page-title {
	clear: both;
}

div.st-weblog-entrytitle span.text {
	font-family: Helvetica, Verdana, sans-serif;
	font-size: 150%;
	font-weight: bold;
	color: #000;
}

.st-weblog-entrycontent {
	font-family: Verdana, Helvetica, sans-serif;
	font-size: 90%;
	border-bottom: 1px solid #888;
}

.st-weblog-byline {
	float: left;
	text-align: left;
	font-style: italic;
	font-size: 70%;
	font-family: Verdana, Helvetica, sans-serif;
}

.st-weblog-post-links {
	float: right;
	text-align: right;
	font-size: 70%;
	font-family: Verdana, Helvetica, sans-serif;
}

#st-weblog-archives, #st-weblog-navigation {
	position: relative;
	float: right;
	width: 230px;
}

#st-weblog-archives {
	margin-top: 15px;
	clear: right;
}

#st-weblog-archives-title, #st-weblog-navigation-title {
	margin-left: 15px;
	font-family: Helvetica, sans-serif;
	font-size: 95%;
	font-weight: bold;
	color: #999;
	border-bottom: 2px solid #f99;
	padding-bottom: 5px;
	padding-top: 5px;
	margin-bottom: 5px;
}

#st-weblog-navigation-content {
	margin-left: 15px;
	font-size: 80%;
}

#st-weblog-archives ul {
	margin: 0;
	padding: 0;
}

#st-weblog-archives ul li {
	/* list-type: none; */
	display: block;
	font-size: 80%;
	font-family: Helvetica, sans-serif;
	padding-left: 15px;
}

#st-weblog-newpost {
	padding: 0.5em 0.7em 0.3em 0.3em;
}

#st-weblog-newpost-button {
}

#st-weblog-actionbar-chooseweblog {
	float: right;
}

#st-weblog-postbyemail {
	font-size: 70%;
	font-family: Verdana, Helvetica, sans-serif;
	color: #def;
	padding-top: 0.4em;
}

#st-weblog-postbyemail-link {
	color: #00c;
}

.st-weblog-chooseprompt {
	font-size: 90%;
	font-family: Verdana, Helvetica, sans-serif;
	padding-right: 0.2em;
	color: #000;
}

.st-spacer {
	padding-right: 0.1em;
	padding-left: 0.1em;
}

.st-weblog-preventries {
	padding-bottom: 20px;
	clear: both;
}
.st-weblog-nextentries {
	clear: both;
}

div.st-weblog-entrynav {
	margin-top: 0.2em;
	margin-bottom: 1.8em;
	padding: 0;
}

span.st-weblog-previousentries, span.st-weblog-nextentries {
	font-size: 90%;
	font-family: Verdana, Helvetica, sans-serif;
	padding-left: 1em;
}

/* ******* Page Stats ******** */

#st-usagereport-navbar {
	font-size: 80%;
	padding: 0;
	margin: 0;
}

#st-usagereport-date {
	font-weight: bold;
	margin-top: 1em;
}

#st-page-usagereport h1 {
	font-size: 1.3em;
	font-weight: bold;
	margin-top: 1.2em;
	margin-bottom: 0.3em;
}

#st-page-usagereport h2 {
	font-size: 1.1em;
	font-weight: bold;
	margin-top: 0.8em;
	margin-bottom: 0.3em;
}

/* New Page */
#st-newpage-save, #st-newpage-duplicate {
	display: none;
	position: fixed;
	left: 0px;
	top: 0px;
	width: 100%;
	height: 100%;
	background: url('../../images/st/popup/bg.png'); /* Don't forget IE hack for ship! */
	z-index: 2000;
}

#st-newpage-save-interface {
	background-color: #fff;
	color: #000;
	border: 4px solid #ccc;
	padding: 0.5em;
	width: 450px;
	margin-left: auto;
	margin-right: auto;
	margin-top: 10%;
	position:absolute;
	top:0px;
	z-index:2003;
}

#st-newpage-duplicate-interface {
	background-color: #fff;
	color: #000;
	border: 4px solid #ccc;
	padding: 0.5em;
	width: 530px;
	margin-left: auto;
	margin-right: auto;
	margin-top: 10%;
	position:absolute;
	top:0px;
	z-index:2003;
}

#st-newpage-save-title, #st-newpage-duplicate-title {
	margin: 0;
	padding: 0;
	font-weight: bold;
	font-family: Helvetica, sans-serif;
	font-size: 100%;
}

#st-newpage-save-prompt, #st-newpage-duplicate-prompt {
	font-family: Helvetica, sans-serif;
	font-size: 90%;
	margin-bottom: 0.4em;
}

#st-newpage-save-buttons, #st-newpage-duplicate-buttons {
	margin-top: 0.8em;
	text-align: right;
}

.st-newpage-duplicate-option {
	font-family: Helvetica, sans-serif;
	font-size: 90%;
	margin: 0;
	padding: 0;
}

#st-newpage-duplicate-pagename {
	font-size: 90%;
}

.st-newpage-duplicate-emphasis {
	background-color: #FFFF00;
	font-weight: bold;
}

#st-newpage-save-field-pagename {
	margin-bottom: 0;
	margin-top: 0.2em;
	padding-bottom: 0;
	font-size: 90%;
}

#st-newpage-save-tip {
	margin-bottom: 0;
	margin-top: 1.2em;
	padding-bottom: 0;
	font-size: 75%;
	color: #888;
}

/* Wikitext Styling */

.wiki {
}

.wiki hr {
	margin-top: .4em;
	margin-bottom: .4em;
}

.wiki .short-rule {
	width: 25%;
}

.wiki .medium-rule {
	width: 50%
}

.wiki ul,
.wiki ol,
.wiki blockquote {
	margin-left: 2em;
	padding-left: 0em;
}

.wiki table {
	border-collapse: collapse;
}

.wiki td {
	border: 1px;
	border-style: solid;
	padding: .2em;
	vertical-align: top;
}

.wiki h1,
.wiki h2,
.wiki h3,
.wiki h4,
.wiki h5,
.wiki h6 {
	font-weight: bold;
	font-style: normal;
	margin-top: 0.1em;
	margin-bottom: 8px;
}

.wiki h1 {font-size: 200%;}
.wiki h2 {font-size: 170%;}
.wiki h3 {font-size: 145%;}
.wiki h4 {font-size: 125%;}
.wiki h5 {font-size: 110%;}
.wiki h6 {font-size: 100%;}

.wiki pre {
	background-color: #eee; /* XXX */
	margin-left: 1em;
	margin-right: 1em;
	padding: .2em;
}

.wiki .incipient {
	text-decoration: none;
	border-bottom: 1px dashed;
}

.wiki-include-title {
	background-color: #ccccff;
}

.wiki .wiki {
	position: relative;
	background-color: #ddddff;
	border: 1px solid #ccccff;
	padding: 3px;
}

.wafl_existence_error {
	color: rgb(200,0,0);
	border-bottom: 0.2em dashed rgb(200,0,0);
}

#st-edit-mode-container {
}

#st-edit-mode-view {
}

#st-page-editing-uploadbutton {
	z-index: 1500;
	float: left;
}

/* Comment UI */


body#st-commentui {
	background: #ffffff;
}

#st-commentui-container {
}

#st-commentui-container a:visited,
#st-commentui-container a:active {
	color: #00f;
}

#st-commentui-notetop {
}

#st-commentui-controls {
}

#st-commentui-savelink {
	background-color: #fffebd;
}

#st-commentui-cancellink {
}

#st-commentui-customfield {
}

#st-commentui-customfield .customfield-label {
}

#st-commentui-customfield .customfield-input {
}

#st-commentui-textarea {
	padding: 0;
	border-style: inset;
	border-width: thin;
	background-color: #ffd;
	color: black;
	width: 99%;
	height: 150px;
}

/*

=head2 Send Page by Email

Styles for the 'Send Page by Email' popup, accessed from the 'Email' dropdown
menu on the page bar.

*/

#email-page {
	background: #ffffff;
	font-size: 80%;
}

.email-page-row {
	clear: both;
}

.email-page-row-label {
	font-weight: bold;
	float: left;
	width: 5em;
	margin-left: 1.2em;
	margin-right: 1.2em;
	text-align: right;
}

.email-page-row-content {
	float: left;
	padding-bottom: 1.2em;
}

.email-page-user-select-column {
	float: left;
	padding-right: 1.2em;
	width: 14em;
}

#email-page-user-select-column-center {
	width: 10em;
}

.email-page-user-select-label {
	text-align: center;
}

#email-page-user-select-add-label {
	padding-top: 1em;
}

.email-page-user-select-button-group {
	padding-bottom: 2em;
}

.email-page-input {
	width: 120px;
	clear: both;
	display: block;
}


.email-page-select {
	width: 175px;
	font-size: x-small;
}

#email-page-error-message {
	text-align: center;
}

#email-page-buttons-container {
	clear: both;
}

#email-page-buttons {
	text-align: center;
}

.email-page-input-new {
	width: 175px;
}

/* System Status, Red with icon */

#st-system-status-alert {
	clear: both;
	width: 50%;
	margin-left: 25%;
	margin-top: 10px;
	padding: 5px;
	color: #c00;
	font-weight: bold;
	font-size: 80%;
	background: transparent url('../../images/st/system-message/important-note.gif') no-repeat 5px center;
	padding-left: 60px;
	min-height: 38px;
}
* html #st-system-status-alert {
	height: 38px;
}

/* System Status, Green */

#st-system-status {
	clear: both;
	text-align:center;
	width: 80%;
	margin-left: 10%;
	padding: 8px 0 3px 0;
	color: #0a0;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 80%;
}

.socialtextLogo {
	text-align: center;
}
/*}}}*/
/***
|''Name:''|SparklinePlugin|
|''Description:''|Sparklines macro|
***/
//{{{
if(!version.extensions.SparklinePlugin) {
version.extensions.SparklinePlugin = {installed:true};

//--
//-- Sparklines
//--

config.macros.sparkline = {};
config.macros.sparkline.handler = function(place,macroName,params)
{
	var data = [];
	var min = 0;
	var max = 0;
	var v;
	for(var t=0; t<params.length; t++) {
		v = parseInt(params[t]);
		if(v < min)
			min = v;
		if(v > max)
			max = v;
		data.push(v);
	}
	if(data.length < 1)
		return;
	var box = createTiddlyElement(place,"span",null,"sparkline",String.fromCharCode(160));
	box.title = data.join(",");
	var w = box.offsetWidth;
	var h = box.offsetHeight;
	box.style.paddingRight = (data.length * 2 - w) + "px";
	box.style.position = "relative";
	for(var d=0; d<data.length; d++) {
		var tick = document.createElement("img");
		tick.border = 0;
		tick.className = "sparktick";
		tick.style.position = "absolute";
		tick.src = "data:image/gif,GIF89a%01%00%01%00%91%FF%00%FF%FF%FF%00%00%00%C0%C0%C0%00%00%00!%F9%04%01%00%00%02%00%2C%00%00%00%00%01%00%01%00%40%02%02T%01%00%3B";
		tick.style.left = d*2 + "px";
		tick.style.width = "2px";
		v = Math.floor(((data[d] - min)/(max-min)) * h);
		tick.style.top = (h-v) + "px";
		tick.style.height = v + "px";
		box.appendChild(tick);
	}
};


}
//}}}
/***
|''Name:''|CryptoFunctionsPlugin|
|''Description:''|Support for cryptographic functions|
***/
//{{{
if(!version.extensions.CryptoFunctionsPlugin) {
version.extensions.CryptoFunctionsPlugin = {installed:true};

//--
//-- Crypto functions and associated conversion routines
//--

// Crypto "namespace"
function Crypto() {}

// Convert a string to an array of big-endian 32-bit words
Crypto.strToBe32s = function(str)
{
	var be = Array();
	var len = Math.floor(str.length/4);
	var i, j;
	for(i=0, j=0; i<len; i++, j+=4) {
		be[i] = ((str.charCodeAt(j)&0xff) << 24)|((str.charCodeAt(j+1)&0xff) << 16)|((str.charCodeAt(j+2)&0xff) << 8)|(str.charCodeAt(j+3)&0xff);
	}
	while (j<str.length) {
		be[j>>2] |= (str.charCodeAt(j)&0xff)<<(24-(j*8)%32);
		j++;
	}
	return be;
};

// Convert an array of big-endian 32-bit words to a string
Crypto.be32sToStr = function(be)
{
	var str = "";
	for(var i=0;i<be.length*32;i+=8)
		str += String.fromCharCode((be[i>>5]>>>(24-i%32)) & 0xff);
	return str;
};

// Convert an array of big-endian 32-bit words to a hex string
Crypto.be32sToHex = function(be)
{
	var hex = "0123456789ABCDEF";
	var str = "";
	for(var i=0;i<be.length*4;i++)
		str += hex.charAt((be[i>>2]>>((3-i%4)*8+4))&0xF) + hex.charAt((be[i>>2]>>((3-i%4)*8))&0xF);
	return str;
};

// Return, in hex, the SHA-1 hash of a string
Crypto.hexSha1Str = function(str)
{
	return Crypto.be32sToHex(Crypto.sha1Str(str));
};

// Return the SHA-1 hash of a string
Crypto.sha1Str = function(str)
{
	return Crypto.sha1(Crypto.strToBe32s(str),str.length);
};

// Calculate the SHA-1 hash of an array of blen bytes of big-endian 32-bit words
Crypto.sha1 = function(x,blen)
{
	// Add 32-bit integers, wrapping at 32 bits
	add32 = function(a,b)
	{
		var lsw = (a&0xFFFF)+(b&0xFFFF);
		var msw = (a>>16)+(b>>16)+(lsw>>16);
		return (msw<<16)|(lsw&0xFFFF);
	};
	// Add five 32-bit integers, wrapping at 32 bits
	add32x5 = function(a,b,c,d,e)
	{
		var lsw = (a&0xFFFF)+(b&0xFFFF)+(c&0xFFFF)+(d&0xFFFF)+(e&0xFFFF);
		var msw = (a>>16)+(b>>16)+(c>>16)+(d>>16)+(e>>16)+(lsw>>16);
		return (msw<<16)|(lsw&0xFFFF);
	};
	// Bitwise rotate left a 32-bit integer by 1 bit
	rol32 = function(n)
	{
		return (n>>>31)|(n<<1);
	};

	var len = blen*8;
	// Append padding so length in bits is 448 mod 512
	x[len>>5] |= 0x80 << (24-len%32);
	// Append length
	x[((len+64>>9)<<4)+15] = len;
	var w = Array(80);

	var k1 = 0x5A827999;
	var k2 = 0x6ED9EBA1;
	var k3 = 0x8F1BBCDC;
	var k4 = 0xCA62C1D6;

	var h0 = 0x67452301;
	var h1 = 0xEFCDAB89;
	var h2 = 0x98BADCFE;
	var h3 = 0x10325476;
	var h4 = 0xC3D2E1F0;

	for(var i=0;i<x.length;i+=16) {
		var j,t;
		var a = h0;
		var b = h1;
		var c = h2;
		var d = h3;
		var e = h4;
		for(j = 0;j<16;j++) {
			w[j] = x[i+j];
			t = add32x5(e,(a>>>27)|(a<<5),d^(b&(c^d)),w[j],k1);
			e=d; d=c; c=(b>>>2)|(b<<30); b=a; a = t;
		}
		for(j=16;j<20;j++) {
			w[j] = rol32(w[j-3]^w[j-8]^w[j-14]^w[j-16]);
			t = add32x5(e,(a>>>27)|(a<<5),d^(b&(c^d)),w[j],k1);
			e=d; d=c; c=(b>>>2)|(b<<30); b=a; a = t;
		}
		for(j=20;j<40;j++) {
			w[j] = rol32(w[j-3]^w[j-8]^w[j-14]^w[j-16]);
			t = add32x5(e,(a>>>27)|(a<<5),b^c^d,w[j],k2);
			e=d; d=c; c=(b>>>2)|(b<<30); b=a; a = t;
		}
		for(j=40;j<60;j++) {
			w[j] = rol32(w[j-3]^w[j-8]^w[j-14]^w[j-16]);
			t = add32x5(e,(a>>>27)|(a<<5),(b&c)|(d&(b|c)),w[j],k3);
			e=d; d=c; c=(b>>>2)|(b<<30); b=a; a = t;
		}
		for(j=60;j<80;j++) {
			w[j] = rol32(w[j-3]^w[j-8]^w[j-14]^w[j-16]);
			t = add32x5(e,(a>>>27)|(a<<5),b^c^d,w[j],k4);
			e=d; d=c; c=(b>>>2)|(b<<30); b=a; a = t;
		}

		h0 = add32(h0,a);
		h1 = add32(h1,b);
		h2 = add32(h2,c);
		h3 = add32(h3,d);
		h4 = add32(h4,e);
	}
	return Array(h0,h1,h2,h3,h4);
};


}
//}}}
/***
|''Name:''|DeprecatedFunctionsPlugin|
|''Description:''|Support for deprecated functions removed from core|
***/
//{{{
if(!version.extensions.DeprecatedFunctionsPlugin) {
version.extensions.DeprecatedFunctionsPlugin = {installed:true};

//--
//-- Deprecated code
//--

// @Deprecated: Use createElementAndWikify and this.termRegExp instead
config.formatterHelpers.charFormatHelper = function(w)
{
	w.subWikify(createTiddlyElement(w.output,this.element),this.terminator);
};

// @Deprecated: Use enclosedTextHelper and this.lookaheadRegExp instead
config.formatterHelpers.monospacedByLineHelper = function(w)
{
	var lookaheadRegExp = new RegExp(this.lookahead,"mg");
	lookaheadRegExp.lastIndex = w.matchStart;
	var lookaheadMatch = lookaheadRegExp.exec(w.source);
	if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
		var text = lookaheadMatch[1];
		if(config.browser.isIE)
			text = text.replace(/\n/g,"\r");
		createTiddlyElement(w.output,"pre",null,null,text);
		w.nextMatch = lookaheadRegExp.lastIndex;
	}
};

// @Deprecated: Use <br> or <br /> instead of <<br>>
config.macros.br = {};
config.macros.br.handler = function(place)
{
	createTiddlyElement(place,"br");
};

// Find an entry in an array. Returns the array index or null
// @Deprecated: Use indexOf instead
Array.prototype.find = function(item)
{
	var i = this.indexOf(item);
	return i == -1 ? null : i;
};

// Load a tiddler from an HTML DIV. The caller should make sure to later call Tiddler.changed()
// @Deprecated: Use store.getLoader().internalizeTiddler instead
Tiddler.prototype.loadFromDiv = function(divRef,title)
{
	return store.getLoader().internalizeTiddler(store,this,title,divRef);
};

// Format the text for storage in an HTML DIV
// @Deprecated Use store.getSaver().externalizeTiddler instead.
Tiddler.prototype.saveToDiv = function()
{
	return store.getSaver().externalizeTiddler(store,this);
};

// @Deprecated: Use store.allTiddlersAsHtml() instead
function allTiddlersAsHtml()
{
	return store.allTiddlersAsHtml();
}

// @Deprecated: Use refreshPageTemplate instead
function applyPageTemplate(title)
{
	refreshPageTemplate(title);
}

// @Deprecated: Use story.displayTiddlers instead
function displayTiddlers(srcElement,titles,template,unused1,unused2,animate,unused3)
{
	story.displayTiddlers(srcElement,titles,template,animate);
}

// @Deprecated: Use story.displayTiddler instead
function displayTiddler(srcElement,title,template,unused1,unused2,animate,unused3)
{
	story.displayTiddler(srcElement,title,template,animate);
}

// @Deprecated: Use functions on right hand side directly instead
var createTiddlerPopup = Popup.create;
var scrollToTiddlerPopup = Popup.show;
var hideTiddlerPopup = Popup.remove;

// @Deprecated: Use right hand side directly instead
var regexpBackSlashEn = new RegExp("\\\\n","mg");
var regexpBackSlash = new RegExp("\\\\","mg");
var regexpBackSlashEss = new RegExp("\\\\s","mg");
var regexpNewLine = new RegExp("\n","mg");
var regexpCarriageReturn = new RegExp("\r","mg");

}
//}}}
{toc: }

^ Nano 3.0 Atmega328P-AU

http://dx.com/p/arduino-nano-v3-0-81877

but it doesn't work without bootloader

http://club.dx.com/forums/forums.dx/threadid.1185512
http://club.dx.com/forums/forums.dx/threadid.1218851

^^ avrdude

.pre
dpavlin@blue:~$ avrdude -c buspirate -P /dev/ttyUSB0 -p m328p -v

avrdude: Version 5.11.1, compiled on Mar 24 2013 at 00:54:55
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/dpavlin/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : buspirate
         AVR Part                      : ATMEGA328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : BusPirate
         Description     : The Bus Pirate

Detecting BusPirate...
avrdude: buspirate_readline(): #
avrdude: buspirate_readline(): RE
avrdude: buspirate_readline(): Bus Pirate v3.b clone w/different PIC
avrdude: buspirate_readline(): Firmware v6.1 r1676  Bootloader v4.4
avrdude: buspirate_readline(): DEVID:0x044F REVID:0x3003 (24FJ64GA004 A3)
avrdude: buspirate_readline(): http://dangerousprototypes.com
avrdude: buspirate_readline(): HiZ>
**
BusPirate: using BINARY mode
BusPirate binmode version: 1
BusPirate SPI version: 1
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as 62
avrdude: safemode: hfuse reads as D9
avrdude: safemode: efuse reads as 7

avrdude: safemode: lfuse reads as 62
avrdude: safemode: hfuse reads as D9
avrdude: safemode: efuse reads as 7
avrdude: safemode: Fuses OK
BusPirate is back in the text mode

avrdude done.  Thank you.
.pre

^ bootloader update

^^ bus pirate

http://dangerousprototypes.com/docs/Bus_Pirate_AVR_Programming

But *which* bootloader to use? (hint: not optiboot!)

.pre
dpavlin@blue:~$ ard-parse-boards nano328 bootloader.file
ATmegaBOOT_168_atmega328.hex
.pre

Ok, now flash it!

.pre
dpavlin@blue:~$ avrdude -c buspirate -P /dev/ttyUSB0 -p m328p -U flash:w:/usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex

Detecting BusPirate...
**
BusPirate: using BINARY mode
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "/usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex"
avrdude: input file /usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex auto detected as Intel Hex
avrdude: writing flash (32670 bytes):

Writing | ################################################## | 100% 56.84s

avrdude: 32670 bytes of flash written
avrdude: verifying flash memory against /usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex:
avrdude: load data flash data from input file /usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex:
avrdude: input file /usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex auto detected as Intel Hex
avrdude: input file /usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex contains 32670 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 55.22s

avrdude: verifying ...
avrdude: 32670 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.
.pre

After re-flash using bus pirate as ISP from Arduino GUI fuses changed:

.pre
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as 5
avrdude: safemode: Fuses OK
.pre

^^ usbasp bootloader update

.pre
Sun Jan 12 11:27:34 2020] usb 8-2: new low-speed USB device number 4 using uhci_hcd
[Sun Jan 12 11:27:34 2020] usb 8-2: New USB device found, idVendor=16c0, idProduct=05dc, bcdDevice= 1.02
[Sun Jan 12 11:27:34 2020] usb 8-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[Sun Jan 12 11:27:34 2020] usb 8-2: Product: USBasp
[Sun Jan 12 11:27:34 2020] usb 8-2: Manufacturer: www.fischl.de

dpavlin@x200:~$ avrdude -v -patmega328p -cusbasp

avrdude: Version 6.3-20171130
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/dpavlin/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : usbasp
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD
avrdude: safemode: Fuses OK (E:FD, H:DA, L:FF)

avrdude done.  Thank you.
.pre

^^^ flash ond nano bootloader

this is old nano bootloader, it doesn't work on 115200 but on 57600 with avrdude

.pre
dpavlin@x200:~$ avrdude -v -patmega328p -cusbasp -U flash:w:/tmp/nuc/opt/arduino/hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex
.pre

^^^ flash optiboot

.pre
dpavlin@x200:~$ avrdude -v -patmega328p -cusbasp -U flash:w:/tmp/nuc/opt/arduino/hardware/arduino/avr/bootloaders/optiboot/optiboot_atmega328.hex
.pre

^ add bus pirate to arduino GUI

http://taylanayken.wordpress.com/2011/05/04/using-bus-pirate-with-arduino-ide/

.pre
root@blue:~# grep buspirate /usr/share/arduino/hardware/arduino/programmers.txt
buspirate.name=The Bus Pirate
buspirate.communication=serial
buspirate.protocol=buspirate
.pre

^ Simulators/Emulators

^^ emulino

console output, somewhat large network on github

https://github.com/ghewgill/emulino

^^ simuino

ncurses interface, single stepping, doesn't have source control link, can't compile it

http://code.google.com/p/simuino/

^^ emulare

Requres .net, need to test it with mono

http://emulare.sourceforge.net/

^^ simavr

* http://gitorious.org/simavr
* https://github.com/buserror-uk/simavr (more up-to-date according to mailing list)
* https://groups.google.com/forum/#!forum/simavr

^ programming sketches

* https://github.com/nickgammon/arduino_sketches

^ DebugWire protocol

http://www.ruemohr.org/docs/debugwire.html

^ Internal ADC reference

https://github.com/SensorsIot/ADC_Test/blob/master/ADC_Test.ino
{image: cubieboard-ir-module.png}

{file: cubieboard_schematic_2012-08-08.pdf}

{file: BreadBoard V1.0 03-25 For CubieBoard.pdf}

{toc: }

^ A20

* Debian image sunxi_ss crypto http://www.cubieforums.com/index.php/topic,1275.0.html
* http://www.armbian.com/cubieboard-2/

^ Running UBI/UBIFS on MLC NAND

* https://events.static.linuxfound.org/sites/events/files/slides/ubi-mlc.pdf
* https://youtu.be/9j2pOIiJqYw

^ NAND in mainline kernel

* http://linux-sunxi.org/Mainline_NAND_Howto
* http://linux-sunxi.org/MTD_Driver

Samsung K9GBG08U0A NAND

* https://groups.google.com/forum/#!topic/linux-sunxi/PxMmiCe0Deg
* https://www.netdevconf.org/2.1/papers/distributed-switch-architecture.pdf

.pre
dpavlin@cubieboard:~$ dmesg | grep -A 5 nand
[    4.395437] nand: Could not find valid JEDEC parameter page; aborting
[    4.401898] nand: device found, Manufacturer ID: 0xec, Chip ID: 0xd7
[    4.408272] nand: Samsung NAND 4GiB 3,3V 8-bit
[    4.412719] nand: 4096 MiB, MLC, erase size: 1024 KiB, page size: 8192, OOB size: 640
[    4.421299] Bad block table found at page 524160, version 0x25
[    4.427987] Bad block table found at page 524032, version 0x25
[    4.434238] nand_read_bbt: bad block at 0x000001000000
[    4.439379] nand_read_bbt: bad block at 0x000001100000
[    4.445411] 6 ofpart partitions found on MTD device 1c03000.nand
[    4.451420] Creating 6 MTD partitions on "1c03000.nand":
[    4.456769] 0x000000a00000-0x0001ffa00000 : "rootfs"
[    4.461737] mtd: partition "rootfs" extends beyond the end of device "1c03000.nand" -- size truncated to 0xff600000
[    4.472910] 0x000001000000-0x000001400000 : "env"
[    4.477926] 0x000000c00000-0x000001000000 : "U-Boot.backup"
[    4.483748] 0x000000800000-0x000000c00000 : "U-Boot"
[    4.488997] 0x000000400000-0x000000800000 : "SPL.backup"
[    4.494580] 0x000000000000-0x000000400000 : "SPL"



dpavlin@cubieboard2:~$ dmesg | grep -A 5 nand
[    4.709427] nand: device found, Manufacturer ID: 0xad, Chip ID: 0xd7
[    4.715876] nand: Hynix H27UBG8T2BTR-BC 32G 3.3V 8-bit
[    4.721021] nand: 4096 MiB, MLC, erase size: 2048 KiB, page size: 8192, OOB size: 640
[    4.728997] Scanning device for bad blocks
[    8.484659] 6 ofpart partitions found on MTD device 1c03000.nand
[    8.490678] Creating 6 MTD partitions on "1c03000.nand":
[    8.496021] 0x000000a00000-0x0001ffa00000 : "rootfs"
[    8.500992] mtd: partition "rootfs" extends beyond the end of device "1c03000.nand" -- size truncated to 0xff600000
[    8.515527] 0x000001000000-0x000001400000 : "env"
[    8.520564] 0x000000c00000-0x000001000000 : "U-Boot.backup"
[    8.526504] 0x000000800000-0x000000c00000 : "U-Boot"
[    8.531755] 0x000000400000-0x000000800000 : "SPL.backup"
[    8.537395] 0x000000000000-0x000000400000 : "SPL"
.pre

^^ many bad blocks

http://linux-sunxi.org/Mainline_NAND_Howto#Many_bad_blocks

To fix many bad blocks issue you should:

1. Disable nand-on-flash-bbt in your dts
2. Remove this test: http://lxr.free-electrons.com/source/drivers/mtd/nand/nand_base.c?v=4.7#L2940
3. Boot your new kernel and erase chip with flash_erase /dev/mtd[0-X]
4. Re-introduce the bad block check removed in 2, re-enable nand-on-flash-bbt
   and boot the new kernel

Let's try to do this with armbian.

^^^ cubieboard

First, enable nand overlay

.pre
dpavlin@cubieboard:~$ cat /boot/armbianEnv.txt
overlays=nand
.pre

Then remove nand-om-flash-btt:

.pre
dpavlin@cubieboard:/$ cd /boot/dtb-`uname -r`/overlay
dpavlin@cubieboard:/boot/dtb-4.14.23-sunxi/overlay$ 

# backup original
root@cubieboard:/boot/dtb-4.14.23-sunxi/overlay# cp sun4i-a10-nand.dtbo sun4i-a10-nand.dtbo.orig

# remote nand-on-flash-bbt
root@cubieboard:/boot/dtb-4.14.23-sunxi/overlay# dtc -I dtb -O dts sun4i-a10-nand.dtbo | grep -v nand-on-flash-bbt > /tmp/nand.dts
root@cubieboard:/boot/dtb-4.14.23-sunxi/overlay# dtc -I dts -O dtb /tmp/nand.dts > sun4i-a10-nand.dtbo
.pre

Compile armbian kernel with this patch applied

.pre
dpavlin@armbian:~/build$ cp ./patch/kernel/sunxi-dev/nand-disable-badblock-check-for-migration.patch.disabled \
    ./userpatches/kernel/sunxi-next/nand-disable-badblock-check-for-migration.patch
.pre

Reboot and check that nand is available:

.pre
dpavlin@cubieboard:~$ dmesg | grep -A 8 MTD
[   13.696198] 6 ofpart partitions found on MTD device 1c03000.nand
[   13.702205] Creating 6 MTD partitions on "1c03000.nand":
[   13.707550] 0x000000a00000-0x0001ffa00000 : "rootfs"
[   13.712517] mtd: partition "rootfs" extends beyond the end of device "1c03000.nand" -- size truncated to 0xff600000
[   13.723693] 0x000001000000-0x000001400000 : "env"
[   13.728713] 0x000000c00000-0x000001000000 : "U-Boot.backup"
[   13.734568] 0x000000800000-0x000000c00000 : "U-Boot"
[   13.739778] 0x000000400000-0x000000800000 : "SPL.backup"
[   13.745368] 0x000000000000-0x000000400000 : "SPL"
[   13.751476] sun4i-mdio 1c0b080.mdio: 1c0b080.mdio supply phy not found, using dummy regulator
.pre

Now init nand:

.pre
root@cubieboard:~# mtd_debug info /dev/mtd0
mtd.type = MTD_MLCNANDFLASH
mtd.flags = MTD_CAP_NANDFLASH
mtd.size = 4284481536 (3G)
mtd.erasesize = 1048576 (1M)
mtd.writesize = 8192 (8K)
mtd.oobsize = 640 
regions = 0


root@cubieboard2:~# mtd_debug info /dev/mtd0
mtd.type = MTD_MLCNANDFLASH
mtd.flags = MTD_CAP_NANDFLASH
mtd.size = 4284481536 (3G)
mtd.erasesize = 2097152 (2M)
mtd.writesize = 8192 (8K)
mtd.oobsize = 640 
regions = 0

root@cubieboard:/home/dpavlin# flash_erase /dev/mtd0 0 0
Erasing 1024 Kibyte @ 600000 --  0 % complete libmtd: error!: MEMERASE64 ioctl failed for eraseblock 6 (mtd0)
        error 5 (Input/output error)
flash_erase: error!: /dev/mtd0: MTD Erase failure
             error 5 (Input/output error)
Erasing 1024 Kibyte @ 700000 --  0 % complete libmtd: error!: MEMERASE64 ioctl failed for eraseblock 7 (mtd0)
        error 5 (Input/output error)
flash_erase: error!: /dev/mtd0: MTD Erase failure
             error 5 (Input/output error)
Erasing 1024 Kibyte @ ff500000 -- 100 % complete 


root@cubieboard:/home/dpavlin# ubiformat /dev/mtd0
ubiformat: mtd0 (mlc-nand), size 4284481536 bytes (4.0 GiB), 4086 eraseblocks of 1048576 bytes (1024.0 KiB), min. I/O size 8192 bytes
libscan: scanning eraseblock 4085 -- 100 % complete  
ubiformat: 4084 eraseblocks are supposedly empty
ubiformat: warning!: 2 of 4086 eraseblocks contain non-UBI data
ubiformat: continue? (y/N) y
ubiformat: warning!: only 0 of 4086 eraseblocks have valid erase counter
ubiformat: erase counter 0 will be used for all eraseblocks
ubiformat: note, arbitrary erase counter value may be specified using -e option
ubiformat: continue? (y/N) y
ubiformat: use erase counter 0 for all eraseblocks
ubiformat: formatting eraseblock 6 --  0 % complete  libmtd: error!: MEMERASE64 ioctl failed for eraseblock 6 (mtd0)
        error 5 (Input/output error)

ubiformat: error!: failed to erase eraseblock 6
           error 5 (Input/output error)
ubiformat: mark it as bad? (y/N) y
ubiformat: marking block 6 bad
ubiformat: formatting eraseblock 7 --  0 % complete  libmtd: error!: MEMERASE64 ioctl failed for eraseblock 7 (mtd0)
        error 5 (Input/output error)

ubiformat: error!: failed to erase eraseblock 7
           error 5 (Input/output error)
ubiformat: mark it as bad? (y/N) y
ubiformat: marking block 7 bad
ubiformat: formatting eraseblock 4085 -- 100 % complete  




ubiattach -p /dev/mtd0

ubimkvol /dev/ubi0 -s 2GiB -N root

mount /dev/ubi0_0 /mnt/ -t ubifs

root@cubieboard:~# mount /dev/ubi0_0 /mnt/ -t ubifs
[Wed Feb 28 17:49:38 2018] UBIFS error (pid: 4709): cannot open "/dev/ubi0:root", error -22
[Wed Feb 28 17:49:43 2018] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 4722
[Wed Feb 28 17:49:44 2018] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "root"
[Wed Feb 28 17:49:44 2018] UBIFS (ubi0:0): LEB size: 1032192 bytes (1008 KiB), min./max. I/O unit sizes: 8192 bytes/8192 bytes
[Wed Feb 28 17:49:44 2018] UBIFS (ubi0:0): FS size: 2137669632 bytes (2038 MiB, 2071 LEBs), journal size 33030144 bytes (31 MiB, 32 LEBs)
[Wed Feb 28 17:49:44 2018] UBIFS (ubi0:0): reserved for root: 4952683 bytes (4836 KiB)
[Wed Feb 28 17:49:44 2018] UBIFS (ubi0:0): media format: w5/r0 (latest is w5/r0), UUID 8E9A30F0-241F-4013-916F-C0B995F22BB1, small LPT model

.pre

^^^ cubieboard2

This is mostly redundant from cubieboard, but with attempt to define mtd partitions correctly

.pre
root@cubieboard2:/home/dpavlin# ubiformat /dev/mtd0
ubiformat: mtd0 (mlc-nand), size 4273995776 bytes (4.0 GiB), 2038 eraseblocks of 2097152 bytes (2.0 MiB), min. I/O size 8192 bytes
libscan: scanning eraseblock 2037 -- 100 % complete  
ubiformat: 2038 eraseblocks have valid erase counter, mean value is 1
ubiformat: formatting eraseblock 2037 -- 100 % complete  


.pre

^^ mount ubifs filesystem

.pre
dpavlin@cubieboard:~$ grep ubi /mnt/boot/armbianEnv.txt
rootdev=ubi0:root ubi.mtd=0
rootfstype=ubifs

dpavlin@cubieboard:~$ grep ubi /etc/fstab 
ubi0:root / ubifs defaults,noatime,nodiratime 0 1
.pre

^ u-boot

Original u-boot output

.pre
HELLO! BOOT0 is starting!
boot0 version : 1.5.1
dram size =1024
Succeed in opening nand flash.
Succeed in reading Boot1 file head.
The size of Boot1 is 0x0003c000.
The file stored in 0X00000000 of block 2 is perfect.
Check is correct.
Ready to disable icache.
Succeed in loading Boot1.
Jump to Boot1.
[       0.133] boot1 version : 1.4.0
[       0.133] pmu type = 3
[       0.134] bat vol = 0
[       0.161] axi:ahb:apb=3:2:2
[       0.161] set dcdc2=1400, clock=1008 successed
[       0.163] key
[       0.175] no key found
[       0.175] flash init start
[       4.051] flash init finish
[       4.052] fs init ok
[       4.053] fattype FAT16
[       4.053] fs mount ok
[       4.060] script finish
[       4.061] power finish
[       4.069] BootMain start
[       4.069] 13
[       4.089] key value = 0
[       4.089] recovery key high 6, low 4
[       4.090] unable to find fastboot_key key_max value
[       4.098] test for multi os boot with display
[       4.100] show pic finish
[       4.103] load kernel start
[       4.127] load kernel successed
[       4.127] start address = 0x4a00000

U-Boot 2011.09-rc1 (Nov 26 2012 - 14:01:52) Allwinner Technology 

CPU:   SUNXI Family
Board: A10-EVB
DRAM:  512 MiB
NAND:  3776 MiB
In:    serial
Out:   serial
Err:   serial
--------fastboot partitions--------
-total partitions:11-
-name-        -start-       -size-      
bootloader  : 1000000       1000000     
env         : 2000000       1000000     
boot        : 3000000       2000000     
system      : 5000000       14000000    
data        : 19000000      20000000    
misc        : 39000000      1000000     
recovery    : 3a000000      2000000     
cache       : 3c000000      8000000     
private     : 44000000      1000000     
sysrecovery : 45000000      14000000    
UDISK       : 59000000      93000000    
-----------------------------------
Hit any key to stop autoboot:  0 
sunxi#
.pre

^^ compile with nand support

* https://groups.google.com/forum/#!topic/linux-sunxi/PxMmiCe0Deg

On Cubieboard2 with those patches we get:

.pre
=> nand info

Device 0: nand0, sector size 2048 KiB
  Page size       8192 b
  OOB size         640 b
  Erase size   2097152 b
  subpagesize     8192 b
  options     0x00001000
  bbt options 0x00070000

# which comparted to booted linux kernel with mtd support....

root@cubieboard2:~# mtd_debug info /dev/mtd0
mtd.type = MTD_MLCNANDFLASH
mtd.flags = MTD_CAP_NANDFLASH
mtd.size = 4284481536 (3G)
mtd.erasesize = 2097152 (2M)
mtd.writesize = 8192 (8K)
mtd.oobsize = 640 
regions = 0

# it looks somewhat OK, but mtdparts doesn't (yet) return anything.
.pre

Another day, another try to get mtdparts to display something...

.pre
root@armbian:~/build/cache/sources/u-boot/v2017.11# grep -i mtd .config
CONFIG_SPL_MTD_SUPPORT=y
CONFIG_CMD_MTDPARTS=y
CONFIG_MTDIDS_DEFAULT="nand0=sunxi-nand"
CONFIG_MTDPARTS_DEFAULT="mtdparts=sunxi-nand:4m(spl),4m(spl-backup),4m(uboot),4m(uboot-backup),4m(env),-(UBI)"
# CONFIG_CMD_MTDPARTS_SPREAD is not set
# MTD Support
CONFIG_MTD=y
# CONFIG_MTD_NOR_FLASH is not set
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_WL_THRESHOLD=4096
CONFIG_MTD_UBI_BEB_LIMIT=20
# CONFIG_MTD_UBI_FASTMAP is not set

=> mtdparts

device nand0 <sunxi-nand>, # parts = 6
 #: name                size            offset          mask_flags
 0: spl                 0x00400000      0x00000000      0
 1: spl-backup          0x00400000      0x00400000      0
 2: uboot               0x00400000      0x00800000      0
 3: uboot-backup        0x00400000      0x00c00000      0
 4: env                 0x00400000      0x01000000      0
 5: UBI                 0xfec00000      0x01400000      0

active partition: nand0,0 - (spl) 0x00400000 @ 0x00000000

defaults:
mtdids  : nand0=sunxi-nand
mtdparts: mtdparts=sunxi-nand:4m(spl),4m(spl-backup),4m(uboot),4m(uboot-backup),4m(env),-(UBI)






.pre

Instructions after this are hit-or-miss...

.pre
dpavlin@klin:/klin/u-boot$ cp configs/Cubieboard_defconfig .config

# add NAND, MTD options, A10 for cubieboard1

# compile while defining flash:

dpavlin@klin:/klin/u-boot$ cat build-cubieboard.sh 
# parametars are probably wrong for your chip!
make V=1 CONFIG_NAND_SUNXI_SPL_ECC_STRENGTH=40 CONFIG_SYS_NAND_PAGE_SIZE=4036 CONFIG_SYS_NAND_OOBSIZE=640 CONFIG_SYS_NAND_BLOCK_SIZE=0x100000


dpavlin@cubieboard:~$ scp 10.60.0.92:/klin/u-boot/u-boot*spl* .

dpavlin@cubieboard:~$ sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 bs=1024 seek=8 
488+1 records in
488+1 records out
500154 bytes (500 kB) copied, 0.0423498 s, 11.8 MB/s

.pre

It would be better to define params in u-boot config file like:

.pre
CONFIG_SYS_EXTRA_OPTIONS="SYS_NAND_BLOCK_SIZE=0x40000,SYS_NAND_PAGE_SIZE=4096,SYS_NAND_OOBSIZE=256"
.pre

(with correct values of course).

^ pinout

* http://docs.cubieboard.org/cubieboard1_and_cubieboard2_gpio_pin

^^ U14 (Next to SATA connector)

|  | *SPI0* |
| 48 | PI13 (SPI0-MISO/UART6-RX/EINT25) | 47 | PI11 (SPI0-CLK/UART5-RX/EINT23) |
| 46 | PI12 (SPI0-MOSI/UART6-TX/EINT24) | 45 | PI10 (SPI0-CS/UART5-TX/EINT22) |
|  | *LCD* |
| 44 | 3.3V (nc in 2012-08-08) | 43 | VCC-5V |
| 42 | Ground | 41 | SPDIF |
| 40 | PB10 (LCD0-SCK/LCD-PIO1) | 39 | PB11 (LCD0-SDA/LCD-PIO2) |
| 38 | Ground | 37 | PH7 (LCD0-BL-EN/LCD-PIO0/UART5-RX/EINT7) |
| 36 | XN_TP (TP-X2) | 35 | YN_TP (TP-Y2) |
| 34 | XP_TP (TP-X1) | 33 | YP_TP (TP-Y1) |
| 32 | PD25 (LCDDE) | 31 | PB2 (PWM0) |
| 30 | PD26 (LCDHSYNC)-VGA-HSYNC | 29 | PD24 (LCDCLK) |
| 28 | PD23 (LCDD23) | 27 | PD27 (LCDVSYNC)-VGA-VSYNC |
| 26 | PD21 (LCDD21) | 25 | PD22 (LCDD22) |
| 24 | PD19 (LCDD19/LVDS1N3) | 23 | PD20 (LCDD20) |
| 22 | PD17 (LCDD17/LVDS1NC) | 21 | PD18 (LCDD18/LVDS1P3) |
| 20 | Ground | 19 | PD16 (LCDD16/LVDS1PC) |
| 18 | PD14 (LCDD14/LVDS1P2) | 17 | PD15 (LCDD15/LVDS1N2) |
| 16 | PD12 (LCDD12/LVDS1P1) | 15 | PD13 (LCDD13/LVDS1N1) |
| 14 | PD10 (LCDD10/LVDS1P0) | 13 | PD11 (LCDD11/LVDS1N0) |
| 12 | PD8 (LCDD8/LVDS0P3) | 11 | PD9 (LCDD9/LVDS0N3) |
| 10 | PD7 (LCDD7/LVDS0NC) | 9 | Ground |
| 8 | PD5 (LCDD5/LVDS0N2) | 7 | PD6 (LCDD6/LVDS0PC) |
| 6 | PD3 (LCDD3/LVDS0N1) | 5 | PD4 (LCDD4/LNVS0P2) |
| 4 | PD1 (LCDD1/LVDS0N0) | 3 | PD2 (LCDD2/LVDS0P1) |
| 2 | Ground | 1 | PD0 (LCDD0/LVDSP0) |

^^ U15 (Between Ethernet port and USB ports)

|  | *CSI1/TS* |
| 1 | VCC-5V | 2 | PH15 (CSI1-PWR/EINT15) |
| 3 | CSI1-IO-2V8 | 4 | PH14 (CSI1-RST#/EINT14) |
| 5 | PG0 (CSI1-PCLK/SDC1-CMD) | 6 | PB18 (TWI1-SCK) |
| 7 | PB19 (TWI1-SDA) | 8 | PG3 (CSI1-VSYNC/SDC1-D1) |
| 9 | PG2 (CSI1-HSYNC/SDC1-D0) | 10 | PG1 (CSI1-MCLK/SDC1-CLK) |
| 11 | PG4 (CSI1-D0/SDC1-D2) | 12 | PG5 (CSI1-D1/SDC1-D3) |
| 13 | PG6 (CSI1-D2/UART3-TX) | 14 | PG7 (CSI1-D3/UART3-RX |
| 15 | PG8 (CSI1-D4/UART3-RTS) | 16 | PG9 (CSI1-D5/UART3-CTS) |
| 17 | PG10 (CSI1-D6/UART4-TX) | 18 | PG11 (CSI1-D7/UART4-RX) |
| 19 | Ground | 20 | Ground |
|  | *Analog* *SDIO3* |
| 21 | FMINL | 22 | PI4 (SDC3-CMD) |
| 23 | FMINR | 24 | PI5 (SDC3-CLK) |
| 25 | Ground | 26 | PI6 (SDC3-D0) |
| 27 | VGA-R | 28 | PI7 (SDC3-D1) |
| 29 | VGA-G | 30 | PI8 (SDC3-D2) |
| 31 | VGA-B | 32 | PI9 (SDC3-D3) |
|  | *CSI0/TS* |
| 33 | LCD1-VSYNC | 34 | PE4 (CSI0-D0) |
| 35 | LCD1-HSYNC | 36 | PE5 (CSI0-D1) |
| 37 | Ground | 38 | PE6 (CSI0-D2) |
| 39 | AVCC | 40 | PE7 (CSI0-D3) |
| 41 | LRADC0 | 42 | PE8 (CSI0-D4) |
| 43 | CVBS | 44 | PE9 (CSI0-D5) |
| 45 | HPL | 46 | PE10 (CSI0-D6) |
| 47 | HPR | 48 | PE11 (CSI0-D7) |

----

everything below line is for legacy kernel and quite old

^ disk speed

^^ NAND

.pre
root@cubieboard2:/home/dpavlin# uname -a
Linux cubieboard2 3.4.109-sun7i #4 SMP PREEMPT Sun Oct 11 14:32:15 CEST 2015 armv7l GNU/Linux
root@cubieboard2:/home/dpavlin# hdparm -t /dev/nand

/dev/nand:
 Timing buffered disk reads:  32 MB in  3.22 seconds =   9.94 MB/sec

# this is different, faster sdcard
root@cubieboard2:~# uname -a
Linux cubieboard2 4.3.3-sunxi #3 SMP Mon Dec 28 11:27:16 CET 2015 armv7l GNU/Linux
root@cubieboard2:~# hdparm -tT /dev/mmcblk0

/dev/mmcblk0:
 Timing cached reads:   770 MB in  2.00 seconds = 384.59 MB/sec
 Timing buffered disk reads:  60 MB in  3.05 seconds =  19.67 MB/sec


.pre

^^ SATA

Powered by 2A Nexus 7 power supply (for SATA)

https://groups.google.com/d/searchin/cubieboard/sata/cubieboard/hKJgJneGVmQ/xme3w4Y7XtsJ?fromplusone=1

.pre
root@debian:~/sunxi-tools# ./bin2fex /boot/script.bin script.fex
fexc-bin: /boot/script.bin: version: 0.1.2
fexc-bin: /boot/script.bin: size: 42144 (76 sections)

root@debian:~/sunxi-tools# cp script.fex script+sata.fex

root@debian:~/sunxi-tools# diff -urw script.fex script+sata.fex 
--- script.fex  2013-05-30 10:41:13.979510762 +0000
+++ script+sata.fex     2013-05-30 10:42:36.380244101 +0000
@@ -595,7 +595,7 @@
 
 [sata_para]
 sata_used = 1
-sata_power_en =
+sata_power_en = port:PB08<1><default><default><0>
 
 [mmc0_para]
 sdc_used = 1

root@debian:~/sunxi-tools# ./fex2bin script+sata.fex /boot/script.bin

root@debian:/etc# git diff
diff --git a/modules b/modules
index d8894c3..9e65a80 100644
--- a/modules
+++ b/modules
@@ -4,3 +4,4 @@
 # at boot time, one per line. Lines beginning with "#" are ignored.
 # Parameters can be specified after the module name.
 
+sw_ahci_platform
.pre

Reboot to activate changes and test speed (using 80G intel SSD to have sense of maximum performance)

.pre
root@debian:~# hdparm -i /dev/sda

/dev/sda:

 Model=INTEL SSDSA2M080G2GC, FwRev=2CV102HD, SerialNo=CVPO035101VN080JGN
 Config={ Fixed }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0
 BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=1
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=156301488
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio3 pio4 
 DMA modes:  mdma0 mdma1 mdma2 
 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
 AdvancedPM=no WriteCache=enabled
 Drive conforms to: ATA/ATAPI-7 T13 1532D revision 1:  ATA/ATAPI-2,3,4,5,6,7

 * signifies the current active mode

root@debian:~# hdparm -tT /dev/sda

/dev/sda:
 Timing cached reads:   784 MB in  2.00 seconds = 392.08 MB/sec
 Timing buffered disk reads: 460 MB in  3.00 seconds = 153.32 MB/sec
.pre

And test with disk:

.pre
root@debian:~# hdparm -i /dev/sda

/dev/sda:

 Model=ST96812AS, FwRev=7.24, SerialNo=3PJ1GCKE
 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
 BuffType=unknown, BuffSize=8192kB, MaxMultSect=16, MultSect=off
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=117231408
 IORDY=on/off, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4 
 DMA modes:  mdma0 mdma1 mdma2 
 UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5 
 AdvancedPM=yes: unknown setting WriteCache=enabled
 Drive conforms to: Unspecified:  ATA/ATAPI-1,2,3,4,5,6,7

 * signifies the current active mode

root@debian:~# hdparm -tT /dev/sda

/dev/sda:
 Timing cached reads:   746 MB in  2.00 seconds = 372.90 MB/sec
 Timing buffered disk reads: 120 MB in  3.03 seconds =  39.56 MB/sec
.pre

^ GPIO

* https://github.com/gootoomoon/WiringCB-python

^ Camera

[OV7670] is supported http://linux-sunxi.org/CSI

* https://groups.google.com/forum/#!msg/linux-sunxi/DYWwfUFgVlw/_7A5APHyl7UJ
* https://groups.google.com/forum/#!msg/cubieboard/SWzC9qvpVL8/9cjQ_CPHQzUJ

^ hardware

* http://linux-sunxi.org/Cubieboard/ExpansionPorts
* https://linux-sunxi.org/A20/PIO

pinout: {image: gpio_defination_large.jpg}

https://www.olimex.com/wiki/How_to_add_pwm

.pre
cat /sys/class/pwm-sunxi/pwm0/pin 
PB2

echo 10khz > /sys/class/pwm-sunxi/pwm0/period

echo 25 > /sys/class/pwm-sunxi/pwm0/duty_percent

echo 1 > /sys/class/pwm-sunxi/pwm0/run
.pre

^^ LEDs

.pre
dpavlin@cubieboard2:~$ grep . /sys/class/leds/*/trigger 
/sys/class/leds/blue:ph21:led2/trigger:none battery-charging-or-full battery-charging battery-full battery-charging-blink-full-solid ac-online usb-online mmc0 timer [heartbeat] backlight cpu0 cpu1 default-on 
/sys/class/leds/green:ph20:led1/trigger:[none] battery-charging-or-full battery-charging battery-full battery-charging-blink-full-solid ac-online usb-online mmc0 timer heartbeat backlight cpu0 cpu1 default-on 
.pre

^ forum

* ov7670 http://www.cubieforums.com/index.php/topic,3823.0.html
* LVDS http://www.cubieforums.com/index.php/topic,3908.0.html

^ ina219

^^ device tree

* https://github.com/dpavlin/sunxi-DT-overlays/blob/cubieboard2/examples/i2c-ina219.dts

.pre
dpavlin@cubieboard2:~$ sensors
ina219-i2c-1-40
Adapter: mv64xxx_i2c adapter
in0:          +0.04 V  
in1:          +4.64 V  
power1:       66.88 W  
curr1:       +13.64 A  

iio_hwmon-isa-0000
Adapter: ISA adapter
temp1:        +33.6�C  

root@cubieboard2:~# dmesg | grep ina | tail -1
[ 6597.685287] ina2xx 1-0040: power monitor ina219 (Rshunt = 100 uOhm)

# hum, it should be 10uA, so I changed that in device tree

dpavlin@cubieboard2:~$ dmesg | grep ina219
[   11.594536] ina2xx 1-0040: power monitor ina219 (Rshunt = 10 uOhm)
dpavlin@cubieboard2:~$ sensors
ina219-i2c-1-40
Adapter: mv64xxx_i2c adapter
in0:          +0.02 V  
in1:          +4.75 V  
power1:       85.00 W  
curr1:       +17.97 A  

iio_hwmon-isa-0000
Adapter: ISA adapter
temp1:        +32.5�C  

# still wrong current!

.pre

^^ user-land C

User-land implementation which works: https://github.com/ZigFisher/Glutinium/blob/master/i2c-telemetry/src/ina219.c

modified a little to provide full timestamp and fflush: {file: ina219.c}

.pre
dpavlin@cubieboard2:~$ ./ina219 -b 1 -i 1
2017-10-23T12:40:24 4744mV  262.2mA
2017-10-23T12:40:26 4756mV  249.1mA
2017-10-23T12:40:27 4776mV  223.0mA
2017-10-23T12:40:28 4772mV  223.8mA
2017-10-23T12:40:29 4760mV  224.0mA
2017-10-23T12:40:30 4768mV  223.0mA
2017-10-23T12:40:31 4772mV  223.1mA
2017-10-23T12:40:32 4748mV  224.6mA
2017-10-23T12:40:33 4776mV  223.1mA
2017-10-23T12:40:34 4768mV  223.5mA
.pre

^ SPI flash

^^ flashrom

.pre
dpavlin@cubieboard:~$ sudo grep spidev /boot/armbianEnv.txt
overlays=pwm nand uart3 uart4 spi-spidev
#overlays=spi-spidev
param_spidev_spi_bus=0


dpavlin@cubieboard:~$ sudo flashrom -p linux_spi:dev=/dev/spidev0.0
flashrom v0.9.9-2-g51e4303 on Linux 4.14.47-sunxi (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Calibrating delay loop... OK.
Found GigaDevice flash chip "GD25Q80(B)" (1024 kB, SPI) on linux_spi.
No operations were specified.

root@cubieboard:/home/dpavlin# time flashrom -p linux_spi:dev=/dev/spidev0.0 -r /dev/null
flashrom v0.9.9-2-g51e4303 on Linux 4.14.47-sunxi (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Calibrating delay loop... OK.
Found GigaDevice flash chip "GD25Q80(B)" (1024 kB, SPI) on linux_spi.
Reading flash... done.

real    0m11.210s
user    0m0.796s
sys     0m0.381s

.pre

^^ build u-boot with SPI support

http://linux-sunxi.org/Bootable_SPI_flash

.pre
git clone -b sunxi-spi https://github.com/StephanvanSchaik/u-boot

dpavlin@armbian:~/u-boot$ git diff
diff --git a/configs/Cubieboard_defconfig b/configs/Cubieboard_defconfig
index 0389d4c..cbafac9 100644
--- a/configs/Cubieboard_defconfig
+++ b/configs/Cubieboard_defconfig
@@ -16,3 +16,13 @@ CONFIG_SPL=y
 # CONFIG_SPL_ISO_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_USB_EHCI_HCD=y
+
+CONFIG_CMD_SF=y
+CONFIG_CMD_SPI=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_MACRONIX=y
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_DM_SPI=y
+CONFIG_SUNXI_SPI=y
+
dpavlin@armbian:~/u-boot$ make Cubieboard_defconfig



.pre

This doesn't actually work for me (since it's missing device tree overlays), but rebasing to current u-boot master doesn't
produce code which compiles.

https://forum.armbian.com/topic/3252-opi-zero-boot-with-spi/

^ reset

http://linux-sunxi.org/Cubieboard/Reset

^ external ir receiver

configuration described on [lirc] page
* http://www.seeedstudio.com/wiki/FST-01
* https://gitorious.org/gnuk
* http://www.fsij.org/doc-gnuk/index.html
* build one from ST-Link clone https://blog.danman.eu/2-usb-crypto-token-for-use-with-gpg-and-ssh/

^ update vid and pid in compiled binary

since version 1.2.8 you need to insert vid and pid into the binary by running

.pre
make build/gnuk-vidpid.elf
.pre

and than flash the resulting gnuk-vidpid.bin binary into your FST-01

^ SWD flashing using ST Link v2

.pre
usb 1-1.6.4: new full-speed USB device number 16 using ehci-pci
usb 1-1.6.4: New USB device found, idVendor=0483, idProduct=3748
usb 1-1.6.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1.6.4: Product: STM32 STLink
usb 1-1.6.4: Manufacturer: STMicroelectronics
usb 1-1.6.4: SerialNumber: Qÿl^FH<85>PH'Q^C<87>
.pre

* http://www.gniibe.org/memo/development/fst-01/dongle/fst-01-swd-connection
* http://no-passwd.net/askbot/question/48/how-can-i-re-flash-fst-01/

Problem:

.pre
dpavlin@blue:/blue-zfs/STM32/FST-01/gnuk/tool$ ./stlinkv2.py -s
ST-Link/V2 version info: 2 17 4
Change ST-Link/V2 mode 0002 -> 0001
CORE: 0de01477, CHIP_ID: 00000000
Flash ROM read protection: off
Option bytes: 00000000
Core does not halt, try API V2 halt.
ValueError('Status of core is not halt.', 128)
.pre

after several re-runs:

.pre
dpavlin@blue:/blue-zfs/STM32/FST-01/gnuk/tool$ ./stlinkv2.py -s
ST-Link/V2 version info: 2 17 4
Change ST-Link/V2 mode 0002 -> 0001
CORE: 1ba01477, CHIP_ID: a0036410
Flash ROM read protection: off
Option bytes: a0036410
Core does not halt, try API V2 halt.
ValueError('Status of core is not halt.', 128)
.pre

after a bit of fiddling with cables (it's always cables, right?)

Lovro contributed that if you are getting continous output like this

.pre
ST-Link/V2 version info: 2 17 4
Change ST-Link/V2 mode 0002 -> 0001
Core does not halt, try API V2 halt.
ValueError('Status of core is not halt.', 128)
.pre

then run this while holding reset active (hold tweezers on both side of C3)
that should hand the uC in a mode that will enable stlinkv2.py script to turn off the flash rom protection and erase the flash while doing that

.pre
dpavlin@blue:/blue-zfs/STM32/FST-01/gnuk$ sudo ./tool/stlinkv2.py -s
ST-Link/V2 version info: 2 17 4
Change ST-Link/V2 mode 0002 -> 0001
CORE: 1ba01477, CHIP_ID: 20036410
Flash ROM read protection: ON
Option bytes: 03fffffe
The MCU is now stopped.
SUCCESS

dpavlin@blue:/blue-zfs/STM32/FST-01/gnuk$ sudo ./tool/stlinkv2.py -u
ST-Link/V2 version info: 2 17 4
Change ST-Link/V2 mode 0002 -> 0001
Status is 0081
CORE: 1ba01477, CHIP_ID: 20036410
Flash ROM read protection: ON
Option bytes: 03fffffe
Flash ROM read protection disabled.  Reset the board, now.
SUCCESS

# plugin, plugout st-link/v2

dpavlin@blue:/blue-zfs/STM32/FST-01/gnuk$ sudo ./tool/stlinkv2.py -s
ST-Link/V2 version info: 2 17 4
Change ST-Link/V2 mode 0100 -> 0001
CORE: 1ba01477, CHIP_ID: 20036410
Flash ROM read protection: off
Option bytes: ffff5aa5
Flash ROM blank check: True
SUCCESS

dpavlin@blue:/blue-zfs/STM32/FST-01/gnuk$ sudo ./tool/stlinkv2.py -b ../binaries/gnuk/gnuk.bin 
ST-Link/V2 version info: 2 17 4
Change ST-Link/V2 mode 0001 -> 0001
CORE: 1ba01477, CHIP_ID: 20036410
Flash ROM read protection: off
Option bytes: ffff5aa5
Flash ROM blank check: True
SPI Flash ROM ID: bf254a
WRITE
VERIFY
PROTECT
Flash ROM read protection enabled.  Reset the board to enable protection.
SUCCESS

# power cycle

dpavlin@blue:/blue-zfs/STM32/FST-01/gnuk$ sudo ./tool/stlinkv2.py -s
ST-Link/V2 version info: 2 17 4
Change ST-Link/V2 mode 0100 -> 0001
CORE: 1ba01477, CHIP_ID: 20036410
Flash ROM read protection: ON
Option bytes: 03fffffe
The MCU is now stopped.
SUCCESS
.pre

plugin just FST-01:

.pre
[ 9890.019368] usb 1-1.6.4: New USB device found, idVendor=234b, idProduct=0000
[ 9890.019372] usb 1-1.6.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 9890.019374] usb 1-1.6.4: Product: Gnuk Token
[ 9890.019375] usb 1-1.6.4: Manufacturer: Free Software Initiative of Japan
[ 9890.019377] usb 1-1.6.4: SerialNumber: FSIJ-1.0.4-50FF7006
.pre
It seems that every peace of hardware I have needs a separate page. When I first bought it, I didn't have any problems with it.

Since then, "some kernels have problems with USB suspend"<http://www.openprinting.org/show_printer.cgi?recnum=Samsung-ML-2510>, but following works:

.pre
apt-get install cups splix
.pre

And then select ML-2150 in cups.

^ toner

* http://rumburg.org/printerhack/
* http://www.arbikas.com/yabbfiles/Attachments/ML1640_reset.pdf
* http://www.fixyourownprinter.com/forums/laser/44978 (it has i2c eeprom and fuse)
{toc: }

^ References

* http://embeddedprogrammer.blogspot.com/2012/07/hacking-ov7670-camera-module-sccb-cheat.html

^ [RaspberryPi]

* http://nicolasfley.fast-page.org/?page_id=35

^ FPGA

* http://hamsterworks.co.nz/mediawiki/index.php/OV7670_camera
* https://github.com/ahmadabbas55/miniOV7670

^ Stereo vision

* http://danstrother.com/2011/06/10/fpga-stereo-vision-core-released/
** http://code.danstrother.com/dls_cores/
Script to convert eagle sch file to pdf {file: eagle-sch2pdf.sh}

.pre
dpavlin@t61p:~/t61p/eagle$ wget ftp://ftp.cadsoft.de/eagle/program/6.6/eagle-lin-6.6.0.run

dpavlin@t61p:~/t61p/eagle$ sudo apt-get install libxrandr2:i386

# install
dpavlin@t61p:~/t61p/eagle$ bash eagle-lin-6.6.0.run

# run
dpavlin@t61p:~/t61p/eagle$ /home/dpavlin/eagle-6.6.0/bin/eagle
.pre

.pre
dpavlin@klin:/klin$ wget http://web.cadsoft.de/ftp/eagle/program/7.2/eagle-lin-7.2.0.run
dpavlin@klin:/klin$ sudo apt-get install libxrandr2:i386 libfontconfig1:i386
dpavlin@klin:/klin$ bash eagle-lin-7.2.0.run
.pre
{toc: }

STM32F100RBT6B

* different from http://pulkomandy.tk/_/_Electronique/_Discovering%20the%20STM32F3%20Discovery

.pre
dpavlin@blue:~$ lsusb | grep ST
Bus 003 Device 006: ID 0483:3744 SGS Thomson Microelectronics STLINK Pseudo disk
.pre

^ Install toolchain

.pre
dpkg --add-architecture i386
apt-get install libc6-i386
#wget https://launchpad.net/gcc-arm-embedded/4.7/4.7-2012-q4-major/+download/gcc-arm-none-eabi-4_7-2012q4-20121208-linux.tar.bz2
wget https://sourcery.mentor.com/GNUToolchain/package4463/public/arm-none-eabi/arm-2009q1-161-arm-none-eabi-i686-pc-linux-gnu.tar.bz2

.pre

^ Install openocd

.pre
dpavlin@blue:~$ sudo apt-get install openocd
dpavlin@blue:~$ dpkg -l openocd
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                    Version          Architecture     Description
+++-=======================-================-================-====================================================
ii  openocd                 0.6.1-1          amd64            Open on-chip JTAG debug solution for ARM and MIPS sy
.pre

^^ start openocd

Disable STLINKv1 SCSI emulation, see https://github.com/texane/stlink

.pre
root@blue:~# modprobe -r usb-storage && modprobe usb-storage quirks=483:3744:i

root@blue:~# sudo openocd -f /usr/share/openocd/scripts/board/stm32vldiscovery.cfg
Open On-Chip Debugger 0.6.1 (2012-12-05-01:32)
Licensed under GNU GPL v2
For bug reports, read
       http://openocd.sourceforge.net/doc/doxygen/bugs.html
adapter speed: 1000 kHz
Info : clock speed 1000 kHz
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
.pre

Open another window and connect with telnet:

.pre
dpavlin@blue:~$ telnet localhost 4444
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> reset init
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08000b4c msp: 0x20000400
.pre

^ summon toolchain

* https://github.com/esden/summon-arm-toolchain

^^ openocd

.pre
dpavlin@blue:~/sat$ sudo openocd -f /usr/share/openocd/scripts/board/stm32vldiscovery.cfg
[sudo] password for dpavlin: 
Open On-Chip Debugger 0.6.1 (2012-12-05-01:32)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.sourceforge.net/doc/doxygen/bugs.html
adapter speed: 1000 kHz
Info : clock speed 1000 kHz
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'telnet' connection from 4444
Warn : target was in unknown state when halt was requested
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x21000000 pc: 0x080001ce msp: 0x20001ff0
.pre

From different terminal

.pre
dpavlin@blue:~/sat$ telnet localhost 4444
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> halt
target was in unknown state when halt was requested
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x21000000 pc: 0x080001ce msp: 0x20001ff0
> 

> flash write_image erase /virtual/stm32discovery/libopencm3/examples/stm32/f1/stm32vl-discovery/fancyblink/fancyblink.hex
auto erase enabled
device id = 0x10016420
flash size = 128kbytes
target state: halted
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x2000003a msp: 0x20001ff0
wrote 2048 bytes from file /virtual/stm32discovery/libopencm3/examples/stm32/f1/stm32vl-discovery/fancyblink/fancyblink.hex in 0.192207s (10.405 KiB/s)

.pre

^ Using Arduino IDE

http://forums.leaflabs.com/topic.php?id=630
{toc: }

^ Cheap(er) China Proxmark

* http://www.xfpga.com/e_products/?big_id=17&small_id=7
* http://www.proxmark.org/forum/viewtopic.php?id=863

^ Mifare sniff/crack

http://code.google.com/p/crapto1/

http://www.youtube.com/watch?v=kTvb7tjbSTI
http://www.fuzzysecurity.com/tutorials/rfid/3.html

Proxmark firmware comparison on emulated Mifare 4k

| r | command | note |
| 590 |  | USB HID |
|  | hf mf rdbl 0 A a0a1a2a3a4a5 | OK |
|  | hf mf chk 0 A a0a1a2a3a4a5 | Can't select card |
| 617 |  | USB HID |
|  | hf mf rdbl 0 A a0a1a2a3a4a5 | OK |
|  | hf mf chk 0 A a0a1a2a3a4a5 | Can't select card |
|  | hf mf mifare | 2 red, needs power cycle |
|  | hf mf nested o 0 a a0a1a2a3a4a5 4 t | Can't select card |
| 672 |  | proxendian.h:22:4: error: #error Define BYTE_ORDER |
| 756 |  | USB CCID |
|  | hf mf rdbl 0 A a0a1a2a3a4a5 | Auth error |
|  | hf mf chk 0 A a0a1a2a3a4a5 | Can't select card |
|  | hf mf mifare | red, yellow, red, needs power cycle |
|  | hf mf nested o 0 a a0a1a2a3a4a5 4 t | Can't select card |
| 840 |  | latest |
|  | hf mf rdbl 0 A a0a1a2a3a4a5 | Can't select card |
|  | hf mf chk 0 A a0a1a2a3a4a5 | Can't select card |
|  | hf mf mifare | Can't select card |
|  | hf mf nested o 0 a a0a1a2a3a4a5 4 t | Can't select card |

^^ Usage

.pre
proxmark3> hw version
#db# Prox/RFID mark3 RFID instrument                 
#db# bootrom: svn 816 2013-10-11 22:09:42                 
#db# os: svn 816 2013-10-11 22:09:43                 
#db# FPGA image built on 2012/ 1/ 6 at 15:27:56                 
uC: AT91SAM7S256 Rev B          
Embedded Processor: ARM7TDMI          
Nonvolatile Program Memory Size: 256K bytes          
Second Nonvolatile Program Memory Size: None          
Internal SRAM Size: 64K bytes          
Architecture Identifier: AT91SAM7Sxx Series          
Nonvolatile Program Memory Type: Embedded Flash Memory          

proxmark3> hw tune
#db# Measuring antenna characteristics, please wait...                 
#db# Measuring complete, sending report back to host                 
          
# LF antenna:  0.00 V @   125.00 kHz          
# LF antenna:  0.00 V @   134.00 kHz          
# LF optimal:  0.00 V @ 12000.00 kHz          
# HF antenna:  7.28 V @    13.56 MHz          
# Your LF antenna is unusable.          

proxmark3> hf 14a read
ATQA : 02 00          
 UID : ?? ?? ?? ??
 SAK : 38 [1]          
TYPE : Nokia 6212 or 6131 MIFARE CLASSIC 4K          
 ATS : 0d 78 f7 b1 02 4a 43 4f 50 76 32 34 31 27 cc           
       -  TL : length is 13 bytes          
       -  T0 : TA1 is present, TB1 is present, TC1 is present, FSCI is 8          
       - TA1 : different divisors are NOT supported, DR: [2, 4, 8], DS: [2, 4, 8]          
       - TB1 : SFGI = 0, FWI = 8          
       - TC1 : NAD is NOT supported, CID is supported          
       -  HB : 4a 43 4f 50 76 32 34 31           


.pre

^ brute force 26-bit proxcard

* https://github.com/brad-anton/proxbrute

^ firmware version

According to http://wiki.radiowar.org/Proxmark3%E5%9B%BA%E4%BB%B6%E5%88%97%E8%A1%A8
firmwares newer than 617 have problems.

Google translated version

> Please do not upgrade your firmware to the CDC Proxmark3 version r617 ~ r830 driver's! We found that because the problem will lead to Proxmark3 code appears unable to identify high-frequency card, and 816 will appear after Nested number of keys for 000000000000.

^ flashing update

.pre
dpavlin@blue:/blue-zfs/FPGA/proxmark/proxmark3$ make flash-all

.pre

^ Compile new version of firmware

*All instructions below this are for old version of software* see http://www.proxmark.org/forum/viewtopic.php?id=1668

http://code.google.com/p/proxmark3/wiki/Compiling je strgan http://www.proxmark.org/forum/post/3244/#p3244

.pre
sudo apt-get install build-essential libreadline5 libreadline-dev libusb-0.1-4 libusb-dev libqt4-dev perl pkg-config

dpavlin@t61p:/tank/proxmark3$ svn co http://proxmark3.googlecode.com/svn/trunk proxmark3
.pre

^ Boot loader

.pre
dpavlin@t61p:/tank/proxmark3/proxmark3$ ./client/flasher -b ./bootrom/obj/bootrom.elf 
Loading ELF file './bootrom/obj/bootrom.elf'...
Loading usable ELF segments:
0: V 0x00100000 P 0x00100000 (0x00000200->0x00000200) [R X] @0x94
1: V 0x00200000 P 0x00100200 (0x000017a8->0x000017a8) [R X] @0x294

Waiting for Proxmark to appear on USB...
Connected units:
        1. SN: ? [004/013]
 Found.
Entering bootloader...
(Press and release the button only to abort)
Waiting for Proxmark to reappear on USB....
Connected units:
        1. SN: ? [004/014]
 Found.

Flashing...
Writing segments for file: ./bootrom/obj/bootrom.elf
 0x00100000..0x001001ff [0x200 / 2 blocks].. OK
 0x00100200..0x001019a7 [0x17a8 / 24 blocks]........................ OK

Resetting hardware...
All done.

Have a nice day!
.pre

^

.pre
dpavlin@t61p:/tank/proxmark3/proxmark3$ ./client/flasher ./armsrc/obj/fullimage.elf 
Loading ELF file './armsrc/obj/fullimage.elf'...
Loading usable ELF segments:
0: V 0x00102000 P 0x00102000 (0x0000a4bc->0x0000a4bc) [R  ] @0xb4
1: V 0x00110000 P 0x00110000 (0x0000ba8c->0x0000ba8c) [R X] @0xa570
2: V 0x00200000 P 0x0011ba8c (0x00000004->0x00000004) [RW ] @0x15ffc
Note: Extending previous segment from 0xba8c to 0xba90 bytes

Waiting for Proxmark to appear on USB...
Connected units:
        1. SN: ? [004/015]
 Found.
Entering bootloader...
(Press and release the button only to abort)
Waiting for Proxmark to reappear on USB....
Connected units:
        1. SN: ChangeMe [004/016]
 Found.

Flashing...
Writing segments for file: ./armsrc/obj/fullimage.elf
 0x00102000..0x0010c4bb [0xa4bc / 165 blocks]..................................................................................................................................................................... OK
 0x00110000..0x0011ba8f [0xba90 / 187 blocks]........................................................................................................................................................................................... OK

Resetting hardware...
All done.

Have a nice day!
.pre
^ Open the watch

https://www.youtube.com/watch?v=kOKDaPp8oiY

^ Mailing list

<https://groups.google.com/forum/#!forum/ti-chronos-development>-

^ Watch

^^ OpenChronos

https://github.com/poelzi/OpenChronos/

.pre
dpavlin@blue:/blue-raidz1/MSP430/Chronos$ git clone git@github.com:poelzi/OpenChronos.git
Cloning into 'OpenChronos'...
remote: Counting objects: 1639, done.
remote: Compressing objects: 100% (907/907), done.
remote: Total 1639 (delta 921), reused 1321 (delta 671)
Receiving objects: 100% (1639/1639), 1.02 MiB | 330.00 KiB/s, done.
Resolving deltas: 100% (921/921), done.
Checking connectivity... done
dpavlin@blue:/blue-raidz1/MSP430/Chronos$ cd OpenChronos/
dpavlin@blue:/blue-raidz1/MSP430/Chronos/OpenChronos$ 

.pre

*outdated*

^^ openchronos-ng

http://sourceforge.net/p/openchronos-ng/

.pre
dpavlin@blue:/blue-raidz1/MSP430/Chronos$ git clone git://git.code.sf.net/p/openchronos-ng/code openchronos-ng-code
Cloning into 'openchronos-ng-code'...
remote: Counting objects: 4088, done.
remote: Compressing objects: 100% (1961/1961), done.
remote: Total 4088 (delta 2930), reused 2831 (delta 2036)
Receiving objects: 100% (4088/4088), 1.31 MiB | 627.00 KiB/s, done.
Resolving deltas: 100% (2930/2930), done.
Checking connectivity... done
dpavlin@blue:/blue-raidz1/MSP430/Chronos$ ls
OpenChronos  openchronos-ng-code
dpavlin@blue:/blue-raidz1/MSP430/Chronos$ cd openchronos-ng-code/
dpavlin@blue:/blue-raidz1/MSP430/Chronos/openchronos-ng-code$ sudo apt-get install python-urwid
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  python-urwid
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 731 kB of archives.
After this operation, 2,697 kB of additional disk space will be used.
Get:1 http://ftp.hr.debian.org/debian/ sid/main python-urwid amd64 1.1.1-1+b1 [731 kB]
Fetched 731 kB in 0s (848 kB/s)      
Selecting previously unselected package python-urwid.
(Reading database ... 274572 files and directories currently installed.)
Unpacking python-urwid (from .../python-urwid_1.1.1-1+b1_amd64.deb) ...
Setting up python-urwid (1.1.1-1+b1) ...


# turn off acleration module which breaks build

dpavlin@blue:/blue-raidz1/MSP430/Chronos/openchronos-ng-code$ make config
grep: config.h: No such file or directory
/usr/bin/python2 tools/config.py

/usr/bin/python2 tools/make_modinit.py


# build

dpavlin@blue:/blue-raidz1/MSP430/Chronos/openchronos-ng-code$ make
Generating dependencies..
/bin/sh: 1: makedepend: not found
CC modinit.c
-e 
>> Building openchronos.elf as target RELEASE
/usr/bin/python2 tools/memory.py -i openchronos.elf -o openchronos.txt
ELF section .text at 0x8000 14972 bytes
ELF section .rodata at 0xba7c 512 bytes
ELF section .data at 0xbc7c 216 bytes
ELF section .vectors at 0xff80 128 bytes
convert to TI Hex



.pre

^ Links

http://processors.wiki.ti.com/index.php/EZ430-Chronos

^ AP dongle BM-USBD4-V1.1

New, white one with M430F5509 and CC1101

http://www.ti.com/product/msp430f5509

.pre
[33569.199972] usb 3-1.2.3: USB disconnect, device number 7
[38564.358606] usb 3-1.1: new full-speed USB device number 8 using ehci-pci
[38564.453766] usb 3-1.1: New USB device found, idVendor=2047, idProduct=0340
[38564.453780] usb 3-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[38564.453783] usb 3-1.1: Product: eZ430-ChronosAP
[38564.453785] usb 3-1.1: Manufacturer: Texas Instruments
[38564.453787] usb 3-1.1: SerialNumber: F5BF93460A000B00
[38564.466959] cdc_acm 3-1.1:1.0: This device cannot do calls on its own. It is not a modem.
[38564.466984] cdc_acm 3-1.1:1.0: ttyACM0: USB ACM device
[38564.467400] usbcore: registered new interface driver cdc_acm
[38564.467402] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
.pre

^ Debugger MSP-eZ430U

.pre
[47106.422402] usb 3-1.1: new full-speed USB device number 10 using ehci-pci
[47106.537358] usb 3-1.1: New USB device found, idVendor=0451, idProduct=f432
[47106.537363] usb 3-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[47106.537366] usb 3-1.1: Product: Texas Instruments MSP-FET430UIF
[47106.537369] usb 3-1.1: Manufacturer: Texas Instruments
[47106.537371] usb 3-1.1: SerialNumber: EDFF41CE960B3D18
[47106.543217] cdc_acm 3-1.1:1.0: This device cannot do calls on its own. It is not a modem.
[47106.543222] cdc_acm 3-1.1:1.0: No union descriptor, testing for castrated device
[47106.543241] cdc_acm 3-1.1:1.0: ttyACM0: USB ACM device
[47109.197929] hid-generic 0003:0451:F432.0004: hiddev0,hidraw3: USB HID v1.01 Device [Texas Instruments Texas Instruments MSP-FET430UIF] on usb-0000:00:1a.0-1.1/input1
[47109.548548] usb 3-1.1: USB disconnect, device number 10
[47110.260115] usb 3-1.1: new full-speed USB device number 11 using ehci-pci
[47110.375589] usb 3-1.1: New USB device found, idVendor=0451, idProduct=f432
[47110.375594] usb 3-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[47110.375597] usb 3-1.1: Product: Texas Instruments MSP-FET430UIF
[47110.375599] usb 3-1.1: Manufacturer: Texas Instruments
[47110.375601] usb 3-1.1: SerialNumber: EDFF41CE960B3D18
[47110.381368] cdc_acm 3-1.1:1.0: This device cannot do calls on its own. It is not a modem.
[47110.381373] cdc_acm 3-1.1:1.0: No union descriptor, testing for castrated device
[47110.381399] cdc_acm 3-1.1:1.0: ttyACM0: USB ACM device
[47120.132638] hid-generic 0003:0451:F432.0005: hiddev0,hidraw3: USB HID v1.01 Device [Texas Instruments Texas Instruments MSP-FET430UIF] on usb-0000:00:1a.0-1.1/input1
[47303.482869] usb 3-1.1: USB disconnect, device number 11
[47304.191698] usb 3-1.1: new full-speed USB device number 12 using ehci-pci
[47304.306763] usb 3-1.1: New USB device found, idVendor=0451, idProduct=f432
[47304.306767] usb 3-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[47304.306770] usb 3-1.1: Product: Texas Instruments MSP-FET430UIF
[47304.306772] usb 3-1.1: Manufacturer: Texas Instruments
[47304.306774] usb 3-1.1: SerialNumber: EDFF41CE960B3D18
[47304.312539] cdc_acm 3-1.1:1.0: This device cannot do calls on its own. It is not a modem.
[47304.312554] cdc_acm 3-1.1:1.0: No union descriptor, testing for castrated device
[47304.312575] cdc_acm 3-1.1:1.0: ttyACM0: USB ACM device
[47314.353996] hid-generic 0003:0451:F432.0006: usb_submit_urb(ctrl) failed: -1
[47314.354020] hid-generic 0003:0451:F432.0006: timeout initializing reports
[47314.354185] hid-generic 0003:0451:F432.0006: hiddev0,hidraw3: USB HID v1.01 Device [Texas Instruments Texas Instruments MSP-FET430UIF] on usb-0000:00:1a.0-1.1/input1
.pre

* debugging with MSP-eZ430U directly? http://e2e.ti.com/support/low_power_rf/f/155/p/252352/1011359.aspx#1011359
* remove battery when debugging? http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/265185.aspx

^ sending data

https://github.com/ApertureLabsLtd/ChronIC
Disconnect receiver dongle and move finger on touchpad

.pre
dpavlin@blue:/blue-zfs/MSP430/goodfet/client$ ./goodfet.nrf sniffmacs | tee /dev/shm/keyboard
Holding autotune on 2402 MHz
sync,mac,r5,r6
'aa,bffffdea01,02,0f' looks valid       1       0.00094
'aa,bffffdea01,02,0f' looks valid       2       0.00187
'aa,bffffdea01,02,0f' looks valid       3       0.00143
'55,5ffffef500,02,0f' looks valid       1       0.00047
'55,5ffffef500,02,0f' looks valid       2       0.00084
'aa,bffffdea01,02,0f' looks valid       4       0.00154
'aa,bffffdea01,02,0f' looks valid       5       0.00182
'aa,bffffdea01,02,0f' looks valid       6       0.00202
'55,5ffffef500,02,0f' looks valid       3       0.00094

dpavlin@x200:/rest/cvs/goodfet/client$ ./goodfet.nrf tune aa,bffffdea01,02,0f

dpavlin@blue:/blue-zfs/MSP430/goodfet/client$ ./goodfet.nrf sniff
Listening as bffffdea01 on 2402 MHz           
 cc af f7 bf ff 1f e0 19 54 3b 9f 2d 2d c4 d4 1d 6a 96 d5 16 93 2a 95 b6 2b 74 d4 aa 85 72 91 41
 cc ef f7 bc fe 7f e0 19 46 c2 5e b0 c2 5a 54 a5 48 cd 42 2c d8 99 dd 19 7a aa a5 85 4a 84 55 15
 cc 2f f7 bd 42 5f e0 19 4c bf be dc d5 69 ab 19 55 8e 95 4f 8f 66 ed ac a7 d2 b6 8d d1 1b 8b 2a
 cc 6f f7 a2 62 ff e0 19 58 26 9e 32 25 20 82 0b 56 d5 12 54 3a a6 bd 5f 7d 75 ed fd 14 b2 4b 48
 cc af f7 a2 7f 9f e0 19 5b 61 5d bf 1a 62 50 b6 a9 14 b8 d9 d2 1a 52 11 0a 25 4d aa a8 dc 85 1a
 cc ef f7 bf 1d 9f e0 19 53 1f 14 a5 14 54 c3 a2 14 d1 84 59 25 56 09 08 77 55 4a 22 ce ad 56 91
.pre
^ sniffing

* http://travisgoodspeed.blogspot.com/2011/02/promiscuity-is-nrf24l01s-duty.html
* http://goodfet.sourceforge.net/clients/goodfetnrf/

Alternative implementation

* http://sarwiki.informatik.hu-berlin.de/R0ket_Keyboard_sniffer
* https://github.com/Kaczmarczyck/r0ket/blob/486d3e07b08f185346a41a79e485f2999ddaf2ea/firmware/applications/radi0.c

^ Arduino libraries

* https://github.com/aaronds/arduino-nrf24l01
* https://github.com/maniacbug/RF24 (has private functions for register access, not suitable for sniffing)

^ MCU independent

* https://github.com/kehribar/nrf24L01_plus
^ dmesg

.pre
[  894.003473] usb 1-3.1: new full-speed USB device number 5 using xhci_hcd
[  894.022883] usb 1-3.1: New USB device found, idVendor=03eb, idProduct=2144
[  894.022888] usb 1-3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[  894.022891] usb 1-3.1: Product: Mojo V2
[  894.022893] usb 1-3.1: Manufacturer: Emb Micro
[  894.022896] usb 1-3.1: SerialNumber: 84134353230351B0D1B0
[  894.023034] usb 1-3.1: ep 0x82 - rounding interval to 1024 microframes, ep desc says 2040 microframes
[  894.039841] cdc_acm 1-3.1:1.0: ttyACM0: USB ACM device
[  894.040196] usbcore: registered new interface driver cdc_acm
[  894.040200] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
.pre

^ mojo-loader

http://embeddedmicro.com/tutorials/the-mojo/installing-mojo-loader

remove RXTXcomm from distribution and use one from packages

.pre
dpavlin@blue:/blue-zfs/FPGA/Mojo/mojo-loader-1.1.2/lib$ rm RXTXcomm.jar 
dpavlin@blue:/blue-zfs/FPGA/Mojo/mojo-loader-1.1.2/lib$ rm librxtxSerial.so
dpavlin@blue:/blue-zfs/FPGA/Mojo/mojo-loader-1.1.2/lib$ ln -s /usr/share/java/RXTXcomm.jar 
dpavlin@blue:/blue-zfs/FPGA/Mojo/mojo-loader-1.1.2/lib$ ln -s /usr/lib/jni/librxtxSerial.so
.pre

alternative implementation: https://github.com/mogorman/mojo.py

^ Bitcoin mining

https://github.com/kramble/DE0-Nano-BitCoin-Miner/tree/master/Mojo_LX9

http://embeddedmicro.com/forum/viewtopic.php?f=3&t=68&sid=8510da058a2db897f380609cfcee4044&start=10#p300

.pre
dpavlin@blue:/blue-zfs/FPGA/Mojo$ git clone https://github.com/kramble/DE0-Nano-BitCoin-Miner.git
Cloning into 'DE0-Nano-BitCoin-Miner'...
remote: Counting objects: 227, done.
remote: Compressing objects: 100% (167/167), done.
remote: Total 227 (delta 74), reused 208 (delta 56)
Receiving objects: 100% (227/227), 659.22 KiB | 174.00 KiB/s, done.
Resolving deltas: 100% (74/74), done.
.pre

upload bitstream

.pre
dpavlin@blue:/blue-zfs/FPGA/Mojo/DE0-Nano-BitCoin-Miner/Mojo_LX9/MiningSoftware$ ../../../mojo.py/mojo.py -v -d /dev/ttyACM1 -i ../Bitstream/mojo_top_hashers6_100MHz_icarus.bin 
Rebooting Mojo
Mojo is ready to recieve bitstream
Mojo acknowledged size of bitstream. Writing bitstream
Mojo has been flashed
Verifying Mojo
First Byte was valid getting flash size.
Flash and local bitstream match file size.
Flash and local bitstream are a match.
Mojo has been loaded bitsream
.pre

.pre
dpavlin@blue:/blue-zfs/FPGA/Mojo/DE0-Nano-BitCoin-Miner/Mojo_LX9$ python miner_icarus.py 
Miner started on Tue Jul 16 23:26:17 2013
Sending data to FPGA

...

Share found on Tue Jun 25 23:37:11 2013 nonce 0074fd13
Upstream result: True
[15 accepted, 0 failed, 5.25 +/- 1.35 Mhash/s]
.pre
^ Serial

http://www.ebay.com/itm/SLBoat-The-TL-WR703N-Mod-64Mbyte-RAM-16Mbyte-Flash-And-TTLout-Inside-MicroUSB/181078954797
^^ ISE IMPACT

^ USB driver

http://rmdir.de/~michael/xilinx/

.pre
dpavlin@blue:/blue-zfs/FPGA/S3A$ git clone git://git.zerfleddert.de/usb-driver
dpavlin@blue:/blue-zfs/FPGA/S3A$ cd usb-driver/
dpavlin@blue:/blue-zfs/FPGA/S3A/usb-driver$ make
cc -Wall -fPIC -DUSB_DRIVER_VERSION="\"2013-06-18 23:37:15\""  -DJTAGKEY usb-driver.c xpcu.c parport.c config.c jtagmon.c jtagkey.c -o libusb-driver.so -ldl -lusb -lpthread -L/usr/lib/x86_64-linux-gnu -lftdi -lusb -shared
parport.c: In function ‘parport_transfer’:
parport.c:21:23: warning: variable ‘last_pp_write’ set but not used [-Wunused-but-set-variable]
  static unsigned char last_pp_write = 0;
                       ^
cc -DDEBUG -Wall -fPIC -DUSB_DRIVER_VERSION="\"2013-06-18 23:37:15\""  -DJTAGKEY usb-driver.c xpcu.c parport.c config.c jtagmon.c jtagkey.c -o libusb-driver-DEBUG.so -ldl -lusb -lpthread -L/usr/lib/x86_64-linux-gnu -lftdi -lusb -shared
Built library is 64 bit. Run `make lib32' to build a 32 bit version
dpavlin@blue:/blue-zfs/FPGA/S3A/usb-driver$ ./setup_pcusb /blue-zfs/Xilinx/14.5/ISE_DS/ISE/
You are not root, trying sudo...
Looking for USB cable files: /blue-zfs/Xilinx/14.5/ISE_DS/ISE//bin/lin64
Copying firmware to /usr/share:
‘/blue-zfs/Xilinx/14.5/ISE_DS/ISE//bin/lin64/xusbdfwu.hex’ -> ‘/usr/share/xusbdfwu.hex’
‘/blue-zfs/Xilinx/14.5/ISE_DS/ISE//bin/lin64/xusb_emb.hex’ -> ‘/usr/share/xusb_emb.hex’
‘/blue-zfs/Xilinx/14.5/ISE_DS/ISE//bin/lin64/xusb_xlp.hex’ -> ‘/usr/share/xusb_xlp.hex’
‘/blue-zfs/Xilinx/14.5/ISE_DS/ISE//bin/lin64/xusb_xp2.hex’ -> ‘/usr/share/xusb_xp2.hex’
‘/blue-zfs/Xilinx/14.5/ISE_DS/ISE//bin/lin64/xusb_xpr.hex’ -> ‘/usr/share/xusb_xpr.hex’
‘/blue-zfs/Xilinx/14.5/ISE_DS/ISE//bin/lin64/xusb_xse.hex’ -> ‘/usr/share/xusb_xse.hex’
‘/blue-zfs/Xilinx/14.5/ISE_DS/ISE//bin/lin64/xusb_xup.hex’ -> ‘/usr/share/xusb_xup.hex’
Installing udev rules:
done

# install fxload
sudo apt-get install fxload
.pre

^^ boundary scan

.pre
GUI --- Auto connect to cable...
INFO:iMPACT - Connecting to TCF agent...
AutoDetecting cable. Please wait.
*** WARNING ***: When port is set to auto detect mode, cable speed is set to default 6 MHz regardless of explicit arguments supplied for setting the baud rates
PROGRESS_START - Starting Operation.
 Using windrvr6 driver.
Connecting to cable (Usb Port - USB21).
Checking cable driver.
File version of /blue-zfs/Xilinx/14.5/ISE_DS/ISE/bin/lin64/xusbdfwu.hex = 1030.
File version of /usr/share/xusbdfwu.hex = 1030.
 libusb-driver.so version: 2013-06-18 23:37:15.
 Cable PID = 0008.
 Max current requested during enumeration is 74 mA.
Type = 0x0004.
 Cable Type = 3, Revision = 0.
 Setting cable speed to 6 MHz.
Cable connection established.
Firmware version = 1303.
File version of /blue-zfs/Xilinx/14.5/ISE_DS/ISE/data/xusb_xlp.hex = 1303.
Firmware hex file version = 1303.
PLD file version = 0012h.
 PLD version = 0012h.
PROGRESS_END - End Operation.
Elapsed time =      0 sec.
Type = 0x0004.
 ESN device is not available for this cable.
Attempting to identify devices in the boundary-scan chain configuration...
INFO:iMPACT - Current time: 6/22/13 4:27 PM
PROGRESS_START - Starting Operation.
Identifying chain contents...'0': : Manufacturer's ID = Xilinx xcf04s, Version : 15
INFO:iMPACT:1777 - 
Reading /blue-zfs/Xilinx/14.5/ISE_DS/ISE/xcf/data/xcf04s.bsd...
INFO:iMPACT:501 - '1': Added Device xcf04s successfully.
----------------------------------------------------------------------
----------------------------------------------------------------------
'1': : Manufacturer's ID = Xilinx xc3s700a, Version : 2
INFO:iMPACT:1777 - 
Reading /blue-zfs/Xilinx/14.5/ISE_DS/ISE/spartan3a/data/xc3s700a.bsd...
INFO:iMPACT:501 - '1': Added Device xc3s700a successfully.
----------------------------------------------------------------------
----------------------------------------------------------------------
done.
PROGRESS_END - End Operation.
Elapsed time =      0 sec.
Attempting to identify devices in the boundary-scan chain configuration...
INFO:iMPACT - Current time: 6/22/13 5:44 PM
PROGRESS_START - Starting Operation.
----------------------------------------------------------------------
----------------------------------------------------------------------
Identifying chain contents...'0': : Manufacturer's ID = Xilinx xcf04s, Version : 15
INFO:iMPACT:1777 - 
Reading /blue-zfs/Xilinx/14.5/ISE_DS/ISE/xcf/data/xcf04s.bsd...
INFO:iMPACT:501 - '1': Added Device xcf04s successfully.
----------------------------------------------------------------------
----------------------------------------------------------------------
'1': : Manufacturer's ID = Xilinx xc3s700a, Version : 2
INFO:iMPACT:1777 - 
Reading /blue-zfs/Xilinx/14.5/ISE_DS/ISE/spartan3a/data/xc3s700a.bsd...
INFO:iMPACT:501 - '1': Added Device xc3s700a successfully.
----------------------------------------------------------------------
----------------------------------------------------------------------
done.
PROGRESS_END - End Operation.
Elapsed time =      0 sec.
'1': Loading file '/blue-zfs/FPGA/S3A/Open-Source-FPGA-Bitcoin-Miner/projects/Verilog_Xilinx_Port/S3A/top/fpgaminer_top.bit' ...
done.
INFO:iMPACT:2257 - Startup Clock has been changed to 'JtagClk' in the bitstream stored in memory,
but the original bitstream file remains unchanged.
UserID read from the bitstream file = 0xFFFFFFFF.
----------------------------------------------------------------------
INFO:iMPACT:501 - '1': Added Device xc3s700a successfully.
----------------------------------------------------------------------
.pre

^^ Get Device ID

.pre
INFO:iMPACT - Current time: 6/22/13 5:45 PM
Maximum TCK operating frequency for this device chain: 10000000.
Validating chain...
Boundary-scan chain validated successfully.
'1': IDCODE is '00100010001000101000000010010011'
'1': IDCODE is '22228093' (in hex).
'1': : Manufacturer's ID = Xilinx xc3s700a, Version : 2
.pre

^^ get device status

.pre
INFO:iMPACT - Current time: 6/22/13 5:48 PM
Maximum TCK operating frequency for this device chain: 10000000.
Validating chain...
Boundary-scan chain validated successfully.
'1': Reading status register contents...
CRC error                                                                  :         0
IDCODE not validated while writing FDRI                                    :         0
DCM Locked                                                                 :         1
status of GTS_CFG_B                                                        :         1
status of GWE                                                              :         1
status of GHIGH                                                            :         1
value of VSEL pin 0                                                        :         1
value of VSEL pin 1                                                        :         1
value of VSEL pin 2                                                        :         1
value of MODE pin M0                                                       :         1
value of MODE pin M1                                                       :         0
value of MODE pin M2                                                       :         0
value of CFG_RDY (INIT_B)                                                  :         1
DONEIN input from Done Pin                                                 :         1
SYNC word not found                                                        :         0
.pre

^^ Get Device Signature/Usercode

.pre
INFO:iMPACT - Current time: 6/22/13 5:50 PM
Maximum TCK operating frequency for this device chain: 10000000.
Validating chain...
Boundary-scan chain validated successfully.
'1': Usercode is 'ffffffff'
.pre

^^ program

Load FPGA bitstream, don't update flash

.pre
INFO:iMPACT - Current time: 6/22/13 5:51 PM
PROGRESS_START - Starting Operation.
Maximum TCK operating frequency for this device chain: 10000000.
Validating chain...
Boundary-scan chain validated successfully.
'1': Programming device...
 LCK_cycle = NoWait.
LCK cycle: NoWait
done.
'1': Reading status register contents...
CRC error                                                                  :         0
IDCODE not validated while writing FDRI                                    :         0
DCM Locked                                                                 :         1
status of GTS_CFG_B                                                        :         1
status of GWE                                                              :         1
status of GHIGH                                                            :         1
value of VSEL pin 0                                                        :         1
value of VSEL pin 1                                                        :         1
value of VSEL pin 2                                                        :         1
value of MODE pin M0                                                       :         1
value of MODE pin M1                                                       :         0
value of MODE pin M2                                                       :         0
value of CFG_RDY (INIT_B)                                                  :         1
DONEIN input from Done Pin                                                 :         1
SYNC word not found                                                        :         0
INFO:iMPACT:2219 - Status register values:
INFO:iMPACT - 0011 1111 1100 1100 
INFO:iMPACT:579 - '1': Completed downloading bit file to device.
INFO:iMPACT:188 - '1': Programming completed successfully.
 LCK_cycle = NoWait.
LCK cycle: NoWait
INFO:iMPACT - '1': Checking done pin....done.
'1': Programmed successfully.
PROGRESS_END - End Operation.
Elapsed time =      1 sec.
.pre

^ FPGA bitcoin mining

http://github.com/sfo/Open-Source-FPGA-Bitcoin-Miner
{toc: }

^ Working configuration

(for me at least :-)

^^ /etc/ppp/peers/huawei-e220

.pre
dpavlin@llin:~$ cat /etc/ppp/peers/huawei-e220
# /etc/ppp/peers/huawei-e220 pppd script
# pppd call huawei-e220

debug
kdebug 3
nodetach
#persist

/dev/ttyUSB0
460800
idle 7200
noipdefault
defaultroute
usepeerdns

connect "/usr/sbin/chat -vf /etc/chatscripts/huawei-e220.chat"  

# avoid compression:
noccp
#nobsdcomp
novj
# t-mobile specific?
#ipcp-restart 8
#ipcp-max-configure 50
#ipcp-accept-local
#ipcp-accept-remote
#ipcp-max-failure 20

lcp-echo-failure 0
lcp-echo-interval 0

modem
crtscts

require-pap
refuse-chap

show-password
user YOUR_USERNAME@DOMAIN
password YOUR_PASSWORD

passive
.pre

^^ /etc/chatscripts/huawei-e220.chat

.pre
dpavlin@llin:~$ cat /etc/chatscripts/huawei-e220.chat
TIMEOUT 3
ABORT BUSY 
ABORT 'NO CARRIER' 
ABORT VOICE 
ABORT 'NO DIALTONE' 
ABORT 'NO DIAL TONE' 
ABORT 'NO ANSWER' 
ABORT DELAYED
"" ATZ
OK ATQ0V1E1S0=0&C1&D2
OK AT+COPS?
OK AT+CGDCONT=1,"ip","carnet.vip.hr"
OK ATDT*99#
CONNECT ""
.pre

^ Links

* http://wwwu.uni-klu.ac.at/agebhard/HuaweiE220/
* another tutorial: http://ske.sourceforge.net/html/projects/huawei/huawei_tre.html
* interesting compilation of configuration files and stat tool: http://oozie.fm.interia.pl/pro/huawei-e220/
* Ubuntu, GUI: http://sistemac-portal.carnet.hr/node/335
* source: http://www.kanoistika.sk/bobovsky/archiv/umts/
* ObWikipedia: http://en.wikipedia.org/wiki/Huawei_E220

^ Turn off pin

.pre
$ cu -l /dev/ttyUSB0
at+clck="sc",0,"PIN!"
OK
.pre

^ libusb driver program

^^ Compilation

Get source from http://www.kanoistika.sk/bobovsky/archiv/umts/huaweiAktBbo.c

.pre
cc     huaweiAktBbo.c   -o huaweiAktBbo -lusb
.pre

^ hal problem

If you modem is restarting like mad, it's problem with hal.

* http://wiki.archlinux.org/index.php/Huawei_E220

^ CD image update

Since device can emulate USB CDROM, I will try to update image on it to provide bios update image instead of useless (to me) Windows drivers.

^^ dmesg

.pre
dpavlin@t61p:~$ uname -a
Linux t61p 2.6.30-1-686-bigmem #1 SMP Mon Aug 3 17:32:39 UTC 2009 i686 GNU/Linux
dpavlin@t61p:~$ dmesg
[ 3405.568120] usb 4-1: new full speed USB device using uhci_hcd and address 2
[ 3405.726188] usb 4-1: New USB device found, idVendor=12d1, idProduct=1003
[ 3405.726196] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 3405.726203] usb 4-1: Product: HUAWEI Mobile
[ 3405.726208] usb 4-1: Manufacturer: HUAWEI Technologies
[ 3405.726384] usb 4-1: configuration #1 chosen from 1 choice
[ 3405.792930] Initializing USB Mass Storage driver...
[ 3405.796244] usb-storage: probe of 4-1:1.0 failed with error -1
[ 3405.796289] usbcore: registered new interface driver usb-storage[ 3405.796296] USB Mass Storage support registered.
[ 3405.952077] usb 4-1: USB disconnect, address 2
[ 3407.432107] usb 4-1: new full speed USB device using uhci_hcd and address 3
[ 3407.590171] usb 4-1: New USB device found, idVendor=12d1, idProduct=1003
[ 3407.590180] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 3407.590187] usb 4-1: Product: HUAWEI Mobile
[ 3407.590192] usb 4-1: Manufacturer: HUAWEI Technologies
[ 3407.590373] usb 4-1: configuration #1 chosen from 1 choice
[ 3407.603280] usb-storage: probe of 4-1:1.2 failed with error -1[ 3407.650695] usbcore: registered new interface driver usbserial
[ 3407.650725] USB Serial support registered for generic
[ 3407.650819] usbcore: registered new interface driver usbserial_generic
[ 3407.650824] usbserial: USB Serial Driver core
[ 3407.663176] USB Serial support registered for GSM modem (1-port)
[ 3407.663293] option 4-1:1.0: GSM modem (1-port) converter detected
[ 3407.663458] usb 4-1: GSM modem (1-port) converter now attached to ttyUSB0
[ 3407.663478] option 4-1:1.1: GSM modem (1-port) converter detected
[ 3407.663576] usb 4-1: GSM modem (1-port) converter now attached to ttyUSB1
[ 3407.663609] usbcore: registered new interface driver option
[ 3407.663614] option: v0.7.2:USB Driver for GSM modems
.pre

^^ power

.pre
root@t61p:~/t61p/usb_modeswitch/usb_modeswitch-1.0.2# lsusb
Bus 004 Device 003: ID 12d1:1003 Huawei Technologies Co., Ltd. E220 HSDPA Modem / E270 HSDPA/HSUPA Modem
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

root@t61p:~/t61p/usb_modeswitch/usb_modeswitch-1.0.2# echo suspend >  /sys/bus/usb/devices/4-1/power/level
root@t61p:~/t61p/usb_modeswitch/usb_modeswitch-1.0.2# dmesg
.pre

^^ links

* http://www.draisberghof.de/usb_modeswitch/

{fetchrss: http://feeds.delicious.com/v2/rss/dpavlin/e220?count=15 full}

^ E171

.pre
Found modem         : E171
Model               : Huawei E171
IMEI                : 354807044078459
Serial NR.          : 4BA5TA10B2706637
Firmware            : 11.126.85.01.143
Compile date / time : Jun 21 2010 20:27:27
Dashboard version   : UTPS11.300.05.15.143_MAC11.301.09.01.143
Chipset             : Qualcomm MSM6290
Voice feature       : disabled
SIM Lock status     : unlocked
Wrong codes entered : 0 (unlock attempts left : 10)
.pre

^ E1752

.pre
Found modem         : E1752
Model               : Huawei E1752
IMEI                : 353145034241600
Serial NR.          : O47NAA19A1600110
Firmware            : 11.126.13.00.00
Compile date / time : Jul 05 2010 10:16:42
Dashboard version   : UTPS11.300.05.22.56_MAC11.300.08.19.56
Chipset             : Qualcomm MSM6290
Voice feature       : disabled
SIM Lock status     : unlocked
Wrong codes entered : 0 (unlock attempts left : 10)
.pre

.pre
AT^CVOICE=0 Enable Voice
AT^CVOICE=1 Disable Voice
AT^CVOICE=? Check status
=========
AT^U2DIAG=0 – switch the device in modem mode only
AT^U2DIAG=1 – device in modem mode + CD-ROM
AT^U2DIAG=255 – modem mode + CD-ROM + Card Reader
AT^U2DIAG=256 – modem mode + Card Reader
.pre
* http://github.com/dpavlin/Printer-EVOLIS
* http://www.evolis.com/eng/Drivers-Support/Product-support/Dualys-3
* http://git.rot13.org/?p=evolisprinter.git

{toc: }

^ Tehnical test card:

| Firmware | 0821 f:200 E |
| X-Y-Smart Offsets | 16 - 20 - 409 |
| Printed lines | 994 L / 636 W |

PageSize[243.84 155.52]

^ Upstream CUPS support

* http://www.evolis.com/eng/content/download/1521/12335/file/evolisprinter-2.2-1.src.rpm
* http://www.evolis.com/eng/content/download/1521/12335/file/evolisprinter-3.0.tar.gz

^ Programming guide

* {file: Programming_Guide_A5013_RevE.pdf}

^^ Encode the three tracks

.pre
Ss                                    // Sequence Start
Pmc;h                                 // Set the coercivity to Hico
Dm;1;EVOLISPEBBLE                     // Download EVOLISPEBBLE on track 1
Dm;2;1234567890                       // Download 12345679890 on track 2
Dm;3;0987654321                       // Download 9876543210 on track 3
Se                                    // Sequence eject
.pre

^^ Use the internal font and rotate them

.pre
Wcb ;k                                // Clear Monochrome Panel
Ss                                    // Sequence Start
Pwr ;0                                // Set the text orientation to 0
Wt ;100 ;300 ;0 ;10 ;Test rotations   // Write the Text "Test Rotation"
Wt ;500 ;250 ;0 ;50 ;0                // Write the text "0"
Pwr;90                                // Set the Text orientation to zero
Wt ;500 ;250 ;0 ;50 ;90               // Write the text "90"
Pwr;180                               // Set the Text orientation to 180
Wt ;500 ;250 ;0 ;50 ;180              // Write the text "180"
Pwr;270                               // Set the Text orientation to 270
Wt ;500 ;250 ;0 ;50 ;270              // // Write the text "270"
Se                                    // Sequence eject
.pre

^^ Print in an image in color

.pre
Pr;ymcko                              // Parameter ribbon ymcko
Pc;a;=;10                             // Set the contrast to 10 for all panel
Pl;a;=;10                             // Set the luminosity to 10 for all panel
Ps;k;=;0                              // Set the Speed for black panel to 0
Ss                                    // Sequence start
Db;y;32;xxxxxxxxxxxxxxx               // Download the data for yellow pannel
Db;m;32;xxxxxxxxxxxxxx                // Download the data for magenta pannel
Db;c;32;xxxxxxxxxxxxxxx               // Download the data for cyan pannel
Db;o;32;xxxxxxxxxxxxxxx               // Download the data for overlay pannel
Se
.pre

^^ Network administration

| Escape sequence | Syntax | Arguments |
| Read the printer's IP address | Rip |  |
| Set the IP address or DHCP | Rip;value | IP address in `xxx.yyy.ttt.uuu` format or `dhcp` |
| Read Hostname | Rehn |  |
| Set Hostname | Pehn;value | Hostname (16 characters max.) |
| Read Subnet mask | Renm |  |
| Set Subnet mask | Penm;value | Subnet mask in xxx.yyy.ttt.uuu format |
| Read the gateway address | Regw |  |
| Set the gateway address | Pegw;value | Gateway address in xxx.yyy.ttt.uuu format |
| Read the WINS server address | Rews |  |
| Read the WINS server address | Pews;value | WINS server address in xxx.yyy.ttt.uuu format |

^ Debian

* http://debian.rot13.org/binary/
* http://debian.rot13.org/source/

^^ apt-cache show evolisprinter

.pre
Package: evolisprinter
Status: install ok installed
Priority: extra
Section: checkinstall
Installed-Size: 160
Maintainer: root@klin
Architecture: i386
Version: 3.0-2
Provides: evolisprinter
Depends: cups
Description: New Pebble Card Printer CUPS driver
.pre

^ Compilation

.pre
apt-get install libcups2-dev libcupsimage2-dev
make
sudo checkinstall
.pre

^ dmesg

.pre
[88415.288187] usb 2-4.3: new full speed USB device using ehci_hcd and address 10
[88415.381054] usb 2-4.3: New USB device found, idVendor=058f, idProduct=9254
[88415.381058] usb 2-4.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[88415.381061] usb 2-4.3: Product: Generic USB Hub
[88415.381063] usb 2-4.3: Manufacturer: ALCOR
[88415.381149] usb 2-4.3: configuration #1 chosen from 1 choice
[88415.381333] hub 2-4.3:1.0: USB hub found
[88415.381555] hub 2-4.3:1.0: 4 ports detected
[88415.652178] usb 2-4.3.1: new full speed USB device using ehci_hcd and address 11
[88415.745545] usb 2-4.3.1: New USB device found, idVendor=0f49, idProduct=0400
[88415.745549] usb 2-4.3.1: New USB device strings: Mfr=4, Product=18, SerialNumber=0
[88415.745552] usb 2-4.3.1: Product: Evolis Dualys
[88415.745554] usb 2-4.3.1: Manufacturer: EVOLIS
[88415.745639] usb 2-4.3.1: configuration #1 chosen from 1 choice
[88415.747080] usblp0: USB Bidirectional printer dev 11 if 0 alt 0 proto 2 vid 0x0F49 pid 0x0400

[90082.139083] rastertoevolis[8692]: segfault at 0 ip b7ddf657 sp bfd60bc8 error 6 in libc-2.9.so[b7d67000+158000]
[90122.522505] usb 2-4.3.1: USB disconnect, address 11
[90122.522690] usblp0: removed
[90133.216207] usb 2-4.3.1: new full speed USB device using ehci_hcd and address 13
[90133.309579] usb 2-4.3.1: New USB device found, idVendor=0f49, idProduct=0400
[90133.309582] usb 2-4.3.1: New USB device strings: Mfr=4, Product=18, SerialNumber=0
[90133.309585] usb 2-4.3.1: Product: Evolis Dualys
[90133.309587] usb 2-4.3.1: Manufacturer: EVOLIS
[90133.309676] usb 2-4.3.1: configuration #1 chosen from 1 choice
[90133.311236] usblp0: USB Bidirectional printer dev 13 if 0 alt 0 proto 2 vid 0x0F49 pid 0x0400
[94350.140355] gs[27363]: segfault at 197 ip b79fb9a6 sp bf9bf070 error 6 in libgs.so.8.70[b790d000+3fc000]
[94393.919251] gs[27502]: segfault at 197 ip b79be9a6 sp bfefe230 error 6 in libgs.so.8.70[b78d0000+3fc000]
[94459.139970] gs[27726]: segfault at 197 ip b78459a6 sp bfdbcb90 error 6 in libgs.so.8.70[b7757000+3fc000]
.pre

^ lsusb

.pre
Bus 002 Device 013: ID 0f49:0400  
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x0f49 
  idProduct          0x0400 
  bcdDevice            6.02
  iManufacturer           4 EVOLIS
  iProduct               18 Evolis Dualys
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration         52 Standard Configuration
    bmAttributes         0x40
      (Missing must-be-set bit!)
      Self Powered
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         7 Printer
      bInterfaceSubClass      1 Printer
      bInterfaceProtocol      2 Bidirectional
      iInterface             98 Printer Interface
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
Device Status:     0x0001
  Self Powered
.pre

^ CUPS

^^ printer options

.pre
dpavlin@klin:~$ lpoptions -p EVOLIS_Dualys -l
ColorModel/Output Mode: *RGB
PageSize/Media Size: *Card
Collate/Collate: *True False
MediaType/Media Type: *Blank
InkType/Ink Type: YMCKO YMCKOS YMCKOK KO *Black Blue Gold Green Red Silver White Scratch BlackWax Hologram
Duplex/Two-sided Printing: None *DuplexNoTumble
Brightness/Luminosity: 0 1 2 3 4 5 6 7 8 9 *10 11 12 13 14 15 16 17 18 19 20
Contrast/Contrast: 0 1 2 3 4 5 6 7 8 9 *10 11 12 13 14 15 16 17 18 19 20
BlackIn/Black Panel : *N Y
TreatementK/Effect: *G L
SensibilityK/Intensity black panel: 0 1 2 3 4 5 6 7 8 9 *10 11 12 13 14 15 16 17 18 19 20
OverlayPannel/Define : *FO SCI SCA MS NO
SensibilityO/Intensity overlay panel: 0 1 2 3 4 5 6 7 8 9 *10 11 12 13 14 15 16 17 18 19 20
BrightnessV/Luminosity: 0 1 2 3 4 5 6 7 8 9 *10 11 12 13 14 15 16 17 18 19 20
ContrastV/Contrast: 0 1 2 3 4 5 6 7 8 9 *10 11 12 13 14 15 16 17 18 19 20
BlackInV/Black Back Panel : *N Y
TreatementKV/Effect: *G L
SensibilityKV/Intensity black panel: 0 1 2 3 4 5 6 7 8 9 *10 11 12 13 14 15 16 17 18 19 20
OverlayBackPannel/Define : FO SCI SCA MS NO
SensibilityOV/Intensity Overlay Back Panel: 0 1 2 3 4 5 6 7 8 9 *10 11 12 13 14 15 16 17 18 19 20
EjectCard/Specific Action : *None iSmart iCtless Eject Reject Test TestTech Clean
Coercivity/Coercivity: *None Hico Loco JIS
Track1/Track1 : *1 2 3 4 5 8 6 7
Track2/Track2 : 1 *2 3 4 5 8 6 7
Track3/Track3 : 1 2 *3 4 5 8 6 7
.pre

^^ duplex printing

.pre
dpavlin@klin:~$ lpoptions -p EVOLIS_Dualys -l | grep Duplex
Duplex/Two-sided Printing: None *DuplexNoTumble

dpavlin@klin:~/klin/evolis-dualys-3$ lpr  -Pdualys3 -o Duplex=DuplexNoTumble out/200900000042.print-duplex.pdf 
.pre

^^ cups raster

* http://www.easysw.com/~mike/rasterview/index.html

.pre
sudo apt-get install libfltk1.1-dev libcups2-dev libcupsimage2-dev

.pre

^^ gs cups rasterizator

.pre
/usr/bin/gs -dQUIET -dPARANOIDSAFER -dNOPAUSE -dBATCH -sDEVICE=cups -sstdout=%stderr -sOutputFile=%stdout -I/usr/share/cups/fonts -sMediaColor=k -sMediaType=Card -r300x300 -dDEVICEWIDTHPOINTS=243 -dDEVICEHEIGHTPOINTS=155 -dcupsBitsPerColor=8 -dcupsColorOrder=0 -dcupsColorSpace=1 -scupsPageSizeName=Card -c -f -
.pre

^^ evolis rasterizator

.pre
/usr/lib/cups/filter/rastertoevolis 42 dpavlin foobar 0 Duplex=DuplexNoTumble duplex.ras > foo.evolis
.pre
{toc: }

^ links

* bios upgrade http://www-307.ibm.com/pc/support/site.wss/document.do?sitestyle=lenovo&lndocid=MIGR-70652
* hard drive firmware http://www-307.ibm.com/pc/support/site.wss/document.do?lndocid=MIGR-63685
* http://www.thinkwiki.org/wiki/BIOS_update_without_optical_disk

^ grub2 memdisk config

.pre
menuentry "HD firmware update" {
  linux16 /memdisk iso
  initrd16 /fwsh33.iso
}

menuentry "BIOS update" {
  linux16 /memdisk iso
  initrd16 /7wuj39uc.iso
}
.pre

^ mount image

.pre
dpavlin@x200:~$ sudo fdisk -l -u /boot/bios.img 
You must set cylinders.
You can do this from the extra functions menu.

Disk /boot/bios.img: 0 MB, 0 bytes
64 heads, 32 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

         Device Boot      Start         End      Blocks   Id  System
/boot/bios.img1   *          32       47103       23536    4  FAT16 <32M
.pre

calculate offset

.pre
dpavlin@x200:~$ echo '32*512' | bc
16384
.pre

and mount it

.pre
dpavlin@x200:~$ sudo mount /boot/bios.img /tmp/bios/ -o loop,offset=16384 -t vfat
.pre
.pre
Bus 003 Device 002: ID 093a:2600 Pixart Imaging, Inc. Typhoon Easycam USB 330K (newer)/Typhoon Easycam USB 2.0 VGA 1.3M/Sansun SN-508
.pre

* http://moinejf.free.fr/
* http://moinejf.free.fr/svv.c

.pre
dpavlin@t61p:~$ grep gcc svv.c 
gcc -Wall svv.c -o svv $(pkg-config gtk+-2.0 --cflags --libs) -lv4lconvert

dpavlin@t61p:~$ sh -c "`grep gcc svv.c`"
dpavlin@t61p:~$ ./svv 
raw pixfmt: PJPG 640x480
pixfmt: RGB3 640x480
mmap method
.pre
{toc: }

^ Links

* http://wiki.debian.org/Smartcards

^ lsusb

.pre
dpavlin@klin:~$ sudo lsusb -v -d 076b:

Bus 003 Device 011: ID 076b:5321 OmniKey AG 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x076b OmniKey AG
  idProduct          0x5321 
  bcdDevice            5.00
  iManufacturer           1 OMNIKEY
  iProduct                2 Smart Card Reader USB
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           93
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          3 CCID
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              250mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass        11 Chip/SmartCard
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      ** UNRECOGNIZED:  36 21 00 01 00 07 03 00 00 00 c0 12 00 00 40 1f 00 00 04 00 2a 00 00 e7 4c 06 00 6a fe 00 00 00 07 00 00 00 00 00 00 00 b2 07 02 00 0f 01 00 00 ff ff 00 00 00 01
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              24
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x05  EP 5 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
Device Status:     0x0000
  (Bus Powered)
.pre

^ PCSC

^^ Install

.pre
dpavlin@klin:~$ sudo apt-get install pcsc-omnikey pcsc-tools
.pre

^^ Usage

read RFID card in reader's range...

.pre
dpavlin@klin:~$ pcsc_scan 
PC/SC device scanner
V 1.4.16 (c) 2001-2009, Ludovic Rousseau <ludovic.rousseau@free.fr>
Compiled with PC/SC lite version: 1.5.5
Scanning present readers...
0: OMNIKEY CardMan 5x21 00 00
1: OMNIKEY CardMan 5x21 00 01

Mon Jan 18 13:59:04 2010
 Reader 0: OMNIKEY CardMan 5x21 00 00
  Card state: Card removed, 

Mon Jan 18 13:59:04 2010
 Reader 1: OMNIKEY CardMan 5x21 00 01
  Card state: Card removed, 

Mon Jan 18 13:59:08 2010
 Reader 1: OMNIKEY CardMan 5x21 00 01
  Card state: Card inserted, Shared Mode, 
  ATR: 3B 8F 80 01 80 4F 0C A0 00 00 03 06 0B 00 14 00 00 00 00 77

ATR: 3B 8F 80 01 80 4F 0C A0 00 00 03 06 0B 00 14 00 00 00 00 77
+ TS = 3B --> Direct Convention
+ T0 = 8F, Y(1): 1000, K: 15 (historical bytes)
  TD(1) = 80 --> Y(i+1) = 1000, Protocol T = 0 
-----
  TD(2) = 01 --> Y(i+1) = 0000, Protocol T = 1 
-----
+ Historical bytes: 80 4F 0C A0 00 00 03 06 0B 00 14 00 00 00 00
  Category indicator byte: 80 (compact TLV data object)
    Tag: 4, len: F (initial access data)
      Initial access data: 0C A0 00 00 03 06 0B 00 14 00 00 00 00
+ TCK = 77 (correct checksum)

Possibly identified card (using /usr/share/pcsc/smartcard_list.txt):
3B 8F 80 01 80 4F 0C A0 00 00 03 06 0B 00 14 00 00 00 00 77
        Philips ICode
        RFID - ISO 15693 - Philips Semiconductors

Mon Jan 18 13:59:11 2010
 Reader 1: OMNIKEY CardMan 5x21 00 01
  Card state: Card removed, 
.pre

^ librfid

* http://openmrtd.org/projects/librfid/

^^ build from source

.pre
# build dependency
dpavlin@klin:/rest/cvs/librfid$ sudo apt-get install libusb-dev

# checkout source
dpavlin@klin:/rest/cvs$ svn co https://svn.gnumonks.org/trunk/librfid/
dpavlin@klin:/rest/cvs$ cd librfid/
dpavlin@klin:/rest/cvs/librfid$ ./autogen.sh

# build
dpavlin@klin:/rest/cvs/librfid$ ./configure --enable-ccid
dpavlin@klin:/rest/cvs/librfid$ make
.pre

^^ test

.pre
# test
dpavlin@klin:/rest/cvs/librfid$ sudo ./utils/librfid-tool -s
lt-librfid-tool - (C) 2005-2008 by Harald Welte
This program is Free Software and has ABSOLUTELY NO WARRANTY

initializing librfid
opening reader handle OpenPCD, CM5x21
No OpenPCD found
scanning for RFID token...
Layer 2 success (ISO 15693):  eb 6e 77 1f 00 01 04 e0
.pre

^^ read tag

.pre
dpavlin@klin:/rest/cvs/librfid$ sudo ./utils/librfid-tool -r -1
lt-librfid-tool - (C) 2005-2008 by Harald Welte
This program is Free Software and has ABSOLUTELY NO WARRANTY

initializing librfid
opening reader handle OpenPCD, CM5x21
No OpenPCD found
Layer2 init ok
Layer 2 success (ISO 15693)[8]: ' eb 6e 77 1f 00 01 04 e0'
block[  0:00]sec:0x8 data(4):  04 11 00 01
block[  1:01]sec:0x8 data(4):  31 33 30 32
block[  2:02]sec:0x8 data(4):  30 32 39 37
block[  3:03]sec:0x8 data(4):  31 30 00 00
block[  4:04]sec:0x8 data(4):  00 00 00 00
block[  5:05]sec:0x8 data(4):  00 00 00 00
block[  6:06]sec:0x8 data(4):  00 00 00 00
block[  7:07]sec:0x8 data(4):  00 00 00 00
block[  8:08]sec:0x8 data(4):  00 00 00 00
block[  9:09]sec:0x8 data(4):  00 00 00 00
block[ 10:0a]sec:0x8 data(4):  00 00 00 00
block[ 11:0b]sec:0x8 data(4):  00 00 00 00
block[ 12:0c]sec:0x8 data(4):  00 00 00 00
block[ 13:0d]sec:0x8 data(4):  00 00 00 00
block[ 14:0e]sec:0x8 data(4):  00 00 00 00
block[ 15:0f]sec:0x8 data(4):  00 00 00 00
block[ 16:10]sec:0x8 data(4):  00 00 00 00
block[ 17:11]sec:0x8 data(4):  00 00 00 00
block[ 18:12]sec:0x8 data(4):  00 00 00 00
block[ 19:13]sec:0x8 data(4):  00 00 00 00
block[ 20:14]sec:0x8 data(4):  00 00 00 00
block[ 21:15]sec:0x8 data(4):  00 00 00 00
block[ 22:16]sec:0x8 data(4):  00 00 00 00
block[ 23:17]sec:0x8 data(4):  00 00 00 00
block[ 24:18]sec:0x8 data(4):  00 00 00 00
block[ 25:19]sec:0x8 data(4):  00 00 00 00
block[ 26:1a]sec:0x8 data(4):  00 00 00 00
block[ 27:1b]sec:0x8 data(4):  57 5f 4f 4b
no data(read_block(28)>> -1)
.pre
.pre
[1389052.244110] usb 3-4.4: new full speed USB device using ehci_hcd and address 8
[1389052.342462] usb 3-4.4: New USB device found, idVendor=03f0, idProduct=0a01
[1389052.342467] usb 3-4.4: New USB device strings: Mfr=1, Product=2, SerialNumber=12
[1389052.342470] usb 3-4.4: Product: hp scanjet scanner
[1389052.342472] usb 3-4.4: Manufacturer: Hewlett-Packard
[1389052.342475] usb 3-4.4: SerialNumber: CN42TS61M3
[1389052.342570] usb 3-4.4: configuration #1 chosen from 1 choice
.pre

.pre
dpavlin@klin:~$ sudo scanimage -L
device `genesys:libusb:003:008' is a Hewlett Packard ScanJet 2400c flatbed scanner
.pre

* http://www.sane-project.org/unsupported/hp-scanjet-2400c.html
* http://indexdata.com.br/Linux/Drivers/Scanner/HP/hp2400c/
D-Link DNS-323 network attached storage

{toc: }

^ Overview

{file: dmesg.txt}

.pre
dlink-DFDADE:~# uname -a
Linux dlink-DFDADE 2.6.12.6-arm1 #30 Mon Aug 18 14:19:14 CST 2008 armv5tejl GNU/Linux

dlink-DFDADE:~# free
            total      used      free    shared   buffers    cached
Mem:        61904     54808      7096         0     11824     30592
-/+ buffers/cache:     12392     49512
Swap:     1060208         0   1060208

dlink-DFDADE:~# cat /proc/cpuinfo 
Processor      : ARM926EJ-Sid(wb) rev 0 (v5l)
BogoMIPS       : 331.77
Features       : swp half thumb fastmult edsp java 
CPU implementer : 0x41
CPU architecture: 5TEJ
CPU variant    : 0x0
CPU part       : 0x926
CPU revision   : 0
Cache type     : write-back
Cache clean    : cp15 c7 ops
Cache lockdown : format C
Cache format   : Harvard
I size         : 32768
I assoc        : 1
I line length  : 32
I sets         : 1024
D size         : 32768
D assoc        : 1
D line length  : 32
D sets         : 1024

Hardware       : MV-88fxx81
Revision       : 0000
Serial         : 0000000000000000
.pre

^ RAID

.pre
Personalities : [linear] [raid0] [raid1] 
md0 : active raid0 sda2[0] sdb2[1]
      2925532672 blocks 64k chunks
      
unused devices: <none>
dlink-DFDADE:~# hdparm -tT /dev/sda /dev/sdb /dev/md0

/dev/sda:
 Timing cached reads:   210 MB in  2.01 seconds = 104.48 MB/sec
 Timing buffered disk reads:   72 MB in  3.00 seconds =  24.00 MB/sec

/dev/sdb:
 Timing cached reads:   212 MB in  2.01 seconds = 105.47 MB/sec
 Timing buffered disk reads:  104 MB in  3.03 seconds =  34.32 MB/sec

/dev/md0:
 Timing cached reads:   208 MB in  2.01 seconds = 103.48 MB/sec
 BLKGETSIZE failed: File too large

dlink-DFDADE:~# dd_rescue /dev/sda /dev/null
dd_rescue: (info): ipos:   1044480.0k, opos:   1044480.0k, xferd:   1044480.0k
                   errs:      0, errxfer:         0.0k, succxfer:   1044480.0k
             +curr.rate:    37169kB/s, avg.rate:    32123kB/s, avg.load: 60.7%

dlink-DFDADE:~# dd_rescue /dev/md0 /dev/null
dd_rescue: (info): ipos:    729536.0k, opos:    729536.0k, xferd:    729536.0k
                   errs:      0, errxfer:         0.0k, succxfer:    729536.0k
             +curr.rate:    37176kB/s, avg.rate:    37502kB/s, avg.load: 76.5%
.pre

^ Debian

* http://www.cyrius.com/debian/orion/d-link/dns-323/install.html

^^ 2.6.26-2-orion5x

^^^ raid0

.pre
Linux dlink-DFDADE 2.6.26-2-orion5x #1 Thu Aug 20 05:04:03 UTC 2009 armv5tel GNU/Linux
Personalities : [raid1] [raid6] [raid5] [raid4] [raid0] 
md1 : active raid0 dm-1[1] dm-0[0]
      2097024 blocks 64k chunks
      
md0 : active raid1 sda4[0] sdb4[1]
      513984 blocks [2/2] [UU]
      
unused devices: <none>

/dev/sda:
 Timing cached reads:   212 MB in  2.01 seconds = 105.39 MB/sec
 Timing buffered disk reads:   72 MB in  3.05 seconds =  23.58 MB/sec

/dev/sdb:
 Timing cached reads:   218 MB in  2.01 seconds = 108.26 MB/sec
 Timing buffered disk reads:   88 MB in  3.00 seconds =  29.33 MB/sec

/dev/md1:
 Timing cached reads:   208 MB in  2.01 seconds = 103.46 MB/sec
 Timing buffered disk reads:   60 MB in  3.07 seconds =  19.57 MB/sec
.pre



.pre
Linux dlink-DFDADE 2.6.26-2-orion5x #1 Thu Aug 20 05:04:03 UTC 2009 armv5tel GNU/Linux
Personalities : [raid1] [raid6] [raid5] [raid4] [raid0]
md1 : active (auto-read-only) raid1 dm-1[1] dm-0[0]
      1048512 blocks [2/2] [UU]
        resync=PENDING

md0 : active raid1 sda4[0] sdb4[1]
      513984 blocks [2/2] [UU]

unused devices: <none>

/dev/sda:
 Timing cached reads:   220 MB in  2.00 seconds = 109.73 MB/sec
 Timing buffered disk reads:   82 MB in  3.01 seconds =  27.22 MB/sec

/dev/sdb:
 Timing cached reads:   216 MB in  2.02 seconds = 107.12 MB/sec
 Timing buffered disk reads:   90 MB in  3.09 seconds =  29.14 MB/sec

/dev/md1:
 Timing cached reads:   208 MB in  2.02 seconds = 103.19 MB/sec
 Timing buffered disk reads:   52 MB in  3.05 seconds =  17.06 MB/sec
.pre

^^ 2.6.30

http://www.cyrius.com/journal/debian/orion/d-link/dns-323/dns-323-fan-control

.pre
dlink-DFDADE:~/mdadm# ./test.sh 
+ ./remove.md1.sh
+ mdadm --manage --stop /dev/md1
mdadm: error opening /dev/md1: No such file or directory
+ mdadm --manage --remove /dev/md1
mdadm: error opening /dev/md1: No such file or directory
+ yes
+ mdadm --create --verbose /dev/md1 --level=0 --raid-devices=2 --force /dev/vga/raid.a /dev/vgb/raid.b
mdadm: chunk size defaults to 64K
mdadm: /dev/vga/raid.a appears to be part of a raid array:
    level=raid1 devices=2 ctime=Sat Sep  5 14:54:52 2009
mdadm: /dev/vgb/raid.b appears to be part of a raid array:
    level=raid1 devices=2 ctime=Sat Sep  5 14:54:52 2009
Continue creating array? mdadm: array /dev/md1 started.
+ ./hdparm-test.sh
+ test -d out
+ uname -a
+ cat /proc/mdstat
+ hdparm -tT /dev/sda /dev/sdb /dev/md1
++ date +%Y%m%d_%H%M%S
+ tee out/20090905_151032
Linux dlink-DFDADE 2.6.30-1-orion5x #1 Tue Aug 18 04:19:30 UTC 2009 armv5tel GNU/Linux
Personalities : [raid1] [raid0] 
md1 : active raid0 dm-0[1] dm-1[0]
      2097024 blocks 64k chunks
      
md0 : active raid1 sda4[0] sdb4[1]
      513984 blocks [2/2] [UU]
      
unused devices: <none>

/dev/sda:
 Timing cached reads:   246 MB in  2.01 seconds = 122.14 MB/sec
 Timing buffered disk reads:  132 MB in  3.00 seconds =  43.93 MB/sec

/dev/sdb:
 Timing cached reads:   242 MB in  2.01 seconds = 120.27 MB/sec
 Timing buffered disk reads:  138 MB in  3.01 seconds =  45.87 MB/sec

/dev/md1:
 Timing cached reads:   234 MB in  2.01 seconds = 116.15 MB/sec
 Timing buffered disk reads:  130 MB in  3.03 seconds =  42.85 MB/sec
.pre

.pre
+ ./remove.md1.sh
+ mdadm --manage --stop /dev/md1
mdadm: stopped /dev/md1
+ mdadm --manage --remove /dev/md1
+ yes
+ mdadm --create --verbose /dev/md1 --level=1 --raid-devices=2 --spare-devices=0 --force /dev/vga/raid.a /dev/vgb/raid.b
mdadm: /dev/vga/raid.a appears to be part of a raid array:
    level=raid0 devices=2 ctime=Sat Sep  5 15:10:31 2009
mdadm: /dev/vgb/raid.b appears to be part of a raid array:
    level=raid0 devices=2 ctime=Sat Sep  5 15:10:31 2009
mdadm: size set to 1048512K
Continue creating array? mdadm: array /dev/md1 started.
+ ./hdparm-test.sh
+ test -d out
+ uname -a
++ date +%Y%m%d_%H%M%S
+ cat /proc/mdstat
+ hdparm -tT /dev/sda /dev/sdb /dev/md1
+ tee out/20090905_151114
Linux dlink-DFDADE 2.6.30-1-orion5x #1 Tue Aug 18 04:19:30 UTC 2009 armv5tel GNU/Linux
Personalities : [raid1] [raid0] 
md1 : active (auto-read-only) raid1 dm-0[1] dm-1[0]
      1048512 blocks [2/2] [UU]
        resync=PENDING
      
md0 : active raid1 sda4[0] sdb4[1]
      513984 blocks [2/2] [UU]
      
unused devices: <none>

/dev/sda:
 Timing cached reads:   116 MB in  2.01 seconds =  57.84 MB/sec
 Timing buffered disk reads:  118 MB in  3.00 seconds =  39.32 MB/sec

/dev/sdb:
 Timing cached reads:   114 MB in  2.01 seconds =  56.79 MB/sec
 Timing buffered disk reads:  140 MB in  3.03 seconds =  46.27 MB/sec

/dev/md1:
 Timing cached reads:   234 MB in  2.02 seconds = 116.07 MB/sec
 Timing buffered disk reads:  110 MB in  3.01 seconds =  36.49 MB/sec
.pre


^^ updates

{fetchatom http://www.cyrius.com/journal/index.atom full}