2008-02-12

Lock Code on n800 - Followup

Okay, it turns out that performing a user-level OS flash does unlock the device, it just doesn't reset the lock code. Now I am off to see if I can figure out where to find the lock code in /dev/mtd* per a posting on the Internet Tablet Talk forums.

EDIT:

Here is a script that can be used to retrieve the lock code if you have access to xterm on the device (as in it isn't currently locked) or if you have SSH access. If the device is locked and you don't have SSH, you will probably have to reflash your device (unless you can come up with another way to unlock it - I couldn't).

#!/usr/bin/perl
#
# Extract lock code from n800 - requires access to /dev/mtd1
#
# This is so that if you set your lock code and then forget it, you can recover
# it. This will require that either the n800 is not locked or you have access
# to the n800 via SSH. If you have locked the device and you don't have
# access via SSH, you will need to reflash the device in order to unlock it
# (which will mean that you will lose any data on the device) and then you can
# use this script to determine what the code is (since it is not reset by
# flashing the device).
#
# Usage:
# getLockCode.pl (MTD1_DUMP)
#
# MTD1_DUMP - Dump of /dev/mtd1 (use cat /dev/mtd1). If not specified,
# the script will simply look at /dev/mtd1
#
# Mysticode
# http://mysticode.blogspot.com/
# February 12, 2008

use strict;
use POSIX;

# Constants
my $LOCK_OFFSET = 0x41028;
my $LOCK_LENGTH = 10;

# Determine if Dump File Specified
my $mtd1File = "/dev/mtd1";
if ($#ARGV >= 0)
{
$mtd1File = $ARGV[0];
}

# Open File
my $openRet = open(INFILE, $mtd1File);
if (!$openRet)
{
print "Error opening " . $mtd1File . "\n";
exit -1;
}

# Move to Offset
seek(INFILE, $LOCK_OFFSET, POSIX::SEEK_SET);

# Read Lock Code
my $lockCode;
read(INFILE, $lockCode, $LOCK_LENGTH);

# Display Lock Code
printf("Lock Code: %s\n", $lockCode);

# Close File
close(INFILE);

1 comment:

joaoluisgm said...

Hi MistiCode,

I have had this n800's lock code problem. So, i dropped your perl script and ran it.

First, i guess if i inform a parm the script will create the file, isn't it ? Then i received a opening file error cause the file doesn't exist.

After it, i ran without the parm and the script seems to finish ok and shows:
Lock Code: -40

How do i interpret it ??

Thanks a lot, and congratulations for the script, it is a rare solution in the whole web.

[]s

JL