emsh.html
13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>iQue@Home Diagnostics</title>
</head>
<body>
<h2 align="center">iQue@Home Diagnostics (version 1.2)</h2>
<br>
<div align="center">$Revision: 1.4 $<br>
$Date: 2005/03/18 00:38:05 $<br>
</div>
<br>
The following files are included in the diagnostics package:
<ul>
<li>
<b>emsh.exe</b> - Command line program for communicating with the iQue Player
</li>
<li>
<b>ique_diag.exe</b> - Stripped down version of emsh.exe for IQue@Home diagnostics only
</li>
<li>
<b>diag.txt, diag1.txt, diag2.txt</b> - Scripts used by emsh for diagnostics
</li>
<li>
<b>diag.cont</b> - Test pattern for writing onto the card.
</li>
</ul>
<b>Supported Platforms</b>: Same as iQue@Home (Windows 98, Windows 2000, Windows XP).
<h3>Running the diagnostic test</h3>
To run the diagnostics test:
<ul>
<li>Unzip the files in the diagnostic package</li>
<li>Connect the iQue player to the PC and power on the iQue player</li>
<li>Run <code>emsh -d -x diag.txt -l <logfile></code>
</ul>
This will run the commands in <i>diag.txt</i> and write the log to <<i>logfile</i>>. The diagnostic test will do the following:
<ul>
<li>
Provide information about the PC configuration (CPU, memory, OS, USB).
<br>
Sample log output:
<pre>
Mon Nov 01 16:55:37 2004 INFO System diagnostics:
Mon Nov 01 16:55:37 2004 INFO Number of processors: 1
Mon Nov 01 16:55:37 2004 INFO CPU 0: x86 Family 15 Model 2 Stepping 7
Intel(R) Pentium(R) 4 CPU 2.53GHz
Mon Nov 01 16:55:37 2004 INFO Memory: Installed RAM 510MB, avail 115440KB, used 77%
Mon Nov 01 16:55:37 2004 INFO OS: Microsoft Windows XP Professional Service
Pack 2 (Build 2600)
Mon Nov 01 16:55:37 2004 INFO BIOS: DELL - 7 Phoenix ROM BIOS PLUS Version 1.10 A03 09/19/03
Mon Nov 01 16:55:37 2004 INFO BBC USB Diagnostics
Mon Nov 01 16:55:37 2004 INFO USB Controller: Intel(r) 82801DB/DBM USB Universal Host Controller - 24C2 version 5.1.2600.1106 date 7-1-2001 provided by Microsoft
Mon Nov 01 16:55:38 2004 INFO IQue Driver: IQue Player version 1.0.0.0 date
7-1-2004 provided by IQue
Mon Nov 01 16:55:38 2004 INFO Hash: 8fec80426f8c059473fe4e38e10a974dbd4c15dd (sha1) C:\WINDOWS\system32\DRIVERS\iquebb.sys
</pre>
</li>
<li>
Test communication with the iQue player (runs <i>diag1.txt</i> 10 times).
</li>
<li>
Retrieve id.sys, ticket.sys, and depot.sys from the card.
</li>
<li>
Basic media check on the card and list blocks marked bad by manufacturer, or with DBE.
Any inconsistency between these bad blocks and those marked bad by the FAT will be
reported as blocks with a bad marking in the FAT only (see last column). If the
"FAT only" column is not zero, then the card has this inconsistency. To correct it,
please use "F 1" to reformat the card and clear the bad block markings in the FAT.
<br><b>NOTE</b>: This may take up to 4-5 minutes for a 64MB card.
<br>
Sample log output:
<pre>
Mon Nov 18 16:55:46 2004 WARN __BBC_ScanBadBlocks_diag: blk 64 in FS marked bad by MFG - FAT already marked
Mon Nov 18 16:57:49 2004 WARN __BBC_ScanBadBlocks_diag: blk 1939 in FS read DBE (ok) - FAT already marked
Mon Nov 18 17:04:13 2004 INFO __BBC_ScanBadBlocks_diag: Bad blocks summary
Mon Nov 18 17:04:13 2004 INFO SKSA: MFG=0 (0 marked in FAT), DBE=0 (0 marked in FAT), FIXED DBE=0, FAT only = 0
Mon Nov 18 17:04:13 2004 INFO FAT: MFG=0 (0 marked in FAT), DBE=0 (0 marked in FAT), FIXED DBE=0, FAT only = 0
Mon Nov 18 17:04:13 2004 INFO FS: MFG=62 (62 marked in FAT), DBE=9 (9 marked in FAT), FIXED DBE=0, FAT only = 0
Mon Nov 18 17:04:13 2004 INFO TOTAL: MFG=62 (62 marked in FAT), DBE=9 (9 marked in FAT), FIXED DBE=0, FAT only = 0
Mon Nov 18 17:04:13 2004 INFO Read 8192 blocks (134217728 bytes) in 504558 ms</pre>
</li>
<li>
Read the FAT table and report bad blocks marked by the FAT.
<br>
Sample log output:
<pre>
Mon Nov 01 17:04:14 2004 INFO BBCStats: blk 64 in FS marked bad
Mon Nov 01 17:04:16 2004 INFO BBCStats: files 22, free 4478, used 3563, bad 71 (threshold 128) reserved 80
Mon Nov 01 17:04:17 2004 INFO BBCStats: bad in SKSA 0, FS 71, FAT 0
Mon Nov 01 17:04:17 2004 INFO Total sys file size: 26 blks</pre>
</li>
<li>
Dump inode table and list of blocks attached to each file.
</li>
<li>
Report the sha1 hash of each block in the SKSA area.
<br>
Sample log output:
<pre>
Mon Nov 01 17:04:17 2004 INFO BBCDiagSKSABlocksHash: sha1 hash for SKSA blocks
Mon Nov 01 17:04:21 2004 INFO __bbc_read_system_area: read 966656 bytes in 3625 ms (260.4 KB/s)
Mon Nov 01 17:04:21 2004 INFO SKSA sha1 block 0: hash 15310aca860698d5596a7b3</pre>
</li>
<li>
Test storing sample content diag.cont as content ffffffff on to the card
(runs <i>diag2.txt</i> 10 times). The content ffffffff is automatically removed after
the test is finished.
</li>
</ul>
<h3>Using emsh</h3>
Emsh provides an command line interface for communicating with the
iQue player. Please make sure that the iQue player is plugged in, turned on, and properly recognized by Windows before running emsh. To run emsh in diagnostics mode (more commands are available than in non-diagnostics mode), use '<code>emsh -d</code>'.
<p>Some simple commands to get started are:
<ul>
<li>
Use 'h' to get the <a href="#help">list of commands</a> you can run in emsh.
</li>
<li>
Use 'q' to quit from emsh.
</li>
<li>
Use 'B' to connect to the iQue Player and 'Q' to disconnect. You must connect
to the iQue Player before using any other command. Otherwise, you will get
a BBC_BADHANDLE (-7) error. If the iQue player is physically disconnected or
powered off, then you will to disconnect ('Q') and reconnect ('B') to the
iQue Player.
</li>
<li>
After switching cards, you must disconnect ('Q') and reconnect ('B')
to the iQue Player before you can access the card again.
Otherwise, you will get a BBC_CARDCHANGE (-5) error each time you attempt
to access the card.
</li>
<li>
To reformat a card, use 'F'. <br><b>NOTE:</b> This will destroy all files on the card.
If some blocks were erroneously marked as BAD in the FAT, Use 'F 1' to reformat the
card restore bad block markings to only include those marked bad by the manufacturer.
</li>
<li>
If the card has double bit errors (DBEs), use 'w 1' to try to fix these DBEs by
rewritting those blocks. <br><b>NOTE:</b> This command is only available in diagnostics
mode, and can take up to 4-5 minutes on a 64MB card.
</li>
<li>
To update the SKSA on the BBcard, use the 'V' command.
<br>
The SKSA is composed of three parts:
<ul>
<li>SK - The Secure Kernel</li>
<li>SA1 - The loader, used to connect to iQue@Home via USB or to launch the viewer</li>
<li>SA2 - The viewer - main console application on the BBplayer for launching games</li>
</ul>
Normally, only the SA2 portion of the SKSA need to updated. To ensure that the SK
and SA1 are not rewritten unnecessarily, use 'V 0' to just update SA2.
<br><br>
A short summary of the 'V' command in emsh is given below:
<pre>
V file [force]- BBCVerifySKSA with file
force - If SKSA on BBCard is to be checked and replaced
0: Replaces only the SA2 (viewer) part of the SKSA
Will return error if either SK or SA1 differs
1: Checks SKSA, if different, replaces SKSA starting
at first differing block
2: Checks SKSA, if different, replaces entire SKSA
3: Don't check SKSA, always replace entire SKSA
</pre>
</li>
</ul>
<a name="options"></a>
<h3>Emsh command line options</h3>
<pre>
Usage: emsh [-d] [-x file] [-l file]
-d Diagnostics mode
-x file Runs emsh commands in file
-l file Writes the libbbc log to file
</pre>
<a name="help"></a>
<h3>Emsh commands</h3>
These commands are available through the emsh help ('h' in emsh).
<pre>
BBC Commands:
B - BBCInit for current BBC device
A - BBCCardPresent
C - BBCStats
W bbid file - BBAuthChallenge
I - BBCGetPlayerIdentity
GI [file] - BBCGetIdentity [to file]
PI file - BBCStoreIdentity from file
GC [file] - BBCGetCert [to file]
PC file - BBCStoreCert from file
GP [file] - BBCGetPrivateData [to file]
PP file - BBCStorePrivateData from file
GR [file] - BBCGetCrls [to file]
PR file - BBCStoreCrls from file
GT [file] - BBCGetTickets [to file]
PT file - BBCStoreTickets from file
GU [file] - BBCGetUserData [to file]
PU file - BBCStoreUserData from file
F [clear] - BBCFormatCard
clear - if bad block markings should be cleared from FAT
H ledval - BBCSetLed
J - BBCSetTime
L - BBCGetContentList
U file cid - BBCGetContent file content-id
M file cid - BBCStoreContent file content-id
R cid - BBCRemoveContent content-id
V file [force]- BBCVerifySKSA with file
X cid - BBCListContentFiles - list files related to cid
E - BBCGetStateList
Y cid - BBCGetState cid
Z ocid ncid - BBCRenameState old-cid new-cid
Q - BBCClose
Diagnostic commands
i - list system information
w [rewrite] - scan card for bad blocks (manufacturer and DBE)
rewrite - attempt to fix DBE by rewriting block or not
n - list sha1 hash for each block in SKSA
v [blkno] - read blkno as a FAT and dump inode tables
Emsh control commands
h - help
run file [n stop] - Run commands in file n times
stop specifies if the test should stop upon error
q - quit
</pre>
<a name="Error"></a>
<h3>Error codes</h3>
<table align="center" cellspacing="3" cellpadding="3" border="1">
<tbody>
<tr>
<td>BBC_NOFORMAT</td>
<td>-1</td>
<td>Card has errors and requires reformat</td>
</tr>
<tr>
<td>BBC_NOID</td>
<td>-2</td>
<td>BBID is not present on Card</td>
</tr>
<tr>
<td>BBC_NOSPACE</td>
<td>-3</td>
<td>No space left on Card</td>
</tr>
<tr>
<td>BBC_NOCARD</td>
<td>-4</td>
<td>Card has been removed</td>
</tr>
<tr>
<td>BBC_CARDCHANGE</td>
<td>-5</td>
<td>BBCInit() has not been called after card change</td>
</tr>
<tr>
<td>BBC_TOOMANY</td>
<td>-6</td>
<td>Too many active handles</td>
</tr>
<tr>
<td>BBC_BADHANDLE</td>
<td>-7</td>
<td>Invalid handle (has BBCInit been called?)</td>
</tr>
<tr>
<td>BBC_BADLENGTH</td>
<td>-8 </td>
<td> Invalid object length </td>
</tr>
<tr>
<td>BBC_CARDFAILED</td><td>-9 </td><td> Card has too many bad blks or is unusable </td>
</tr><tr><td>BBC_ERROR</td><td>-10 </td><td> Generic error </td>
</tr><tr><td>BBC_EIO</td><td>-11 </td><td> IO error (USB unplugged) </td>
</tr><tr><td>BBC_DATAERR</td><td>-12 </td><td> Block read with DB ecc error </td>
</tr><tr><td>BBC_NODEV</td><td>-13 </td><td> Device not connected </td>
</tr><tr><td>BBC_NOFILE</td><td>-14 </td><td> File does not exist on Card </td>
</tr><tr><td>BBC_BADBLK</td><td>-15 </td><td> Block marked bad (status != 0xff) </td>
</tr><tr><td>BBC_SA1DIFFERS</td><td>-16 </td><td> BBCVerifySKSA2 finds SA1 different </td>
</tr><tr><td>BBC_MULTIPLE_BB</td><td>-17 </td><td> BBCInit() found multiple BB connection </td>
</tr><tr><td>BBC_MULTIPLE_FILE</td><td>-18 </td><td> cid mapped to both .app and .rec files </td>
</tr><tr><td>BBC_SYNCLOST</td><td>-19 </td><td> Protocol synchronization lost </td>
</tr><tr><td>BBC_NOMEM</td><td>-20 </td><td> Unable to allocate memory </td>
</tr><tr><td>BBC_BADARG</td><td>-21 </td><td> Invalid argument </td>
</tr><tr><td>BBC_DEVBUSY</td><td>-22 </td><td> Device already opened </td>
</tr><tr><td>BBC_DEVERR</td><td>-23 </td><td> Device error </td>
</tr><tr><td>BBC_TIMEOUT</td><td>-24 </td><td> Timeout </td>
</tr><tr><td>BBC_SKWRITEFAIL</td><td>-25 </td><td> Write error during update of SK </td>
</tr><tr><td>BBC_VERIFYFAIL</td><td>-26 </td><td> Data not written correctly to card </td>
</tbody>
</table>
<h3>Change History</h3>
<h4>Changes from v1.1 to v1.2</h4>
<ul>
<li>Fixed BBCRenameState so existing state files with the new cid are not deleted</li>
<li>Include auxillary state files in BBCGetStateList and space calculation</li>
</ul>
<h4>Changes from v1.0 to v1.1</h4>
<ul>
<li>Added <i>ique_diag.exe</i> to package</li>
<li>Updated free space calculation to allow for a maximum of 70 bad blocks</li>
<li>Report number of commands that failed at the end of a test</li>
</ul>
</body>
</html>