|
Re: LCD screen for your dockstar (cheap! <$5) January 22, 2013 05:57AM |
Registered: 13 years ago Posts: 365 |
|
joelbl
Re: LCD screen for your dockstar (cheap! <$5) January 22, 2013 09:04AM |
|
Re: LCD screen for your dockstar (cheap! <$5) January 22, 2013 10:11AM |
Registered: 13 years ago Posts: 365 |
|
joelbl
Re: LCD screen for your dockstar (cheap! <$5) January 22, 2013 10:52AM |
|
joelbl
Re: LCD screen for your dockstar (cheap! <$5) January 22, 2013 04:03PM |
/// <summary>
/// The command sent in the dpf hack
/// </summary>
static byte[] g_excmdBytes = {
0xcd, 0, 0, 0,
0, 6, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0
};
private void btnTestDataSend_Click(object sender, EventArgs e)
{
ErrorCode ec = ErrorCode.None;
try
{
// Find and open the usb device.
MyUsbDevice = UsbDevice.OpenUsbDevice(MyUsbFinder);
// If the device is open and ready
if (MyUsbDevice == null) throw new Exception("Device Not Found.");
// If this is a "whole" usb device (libusb-win32, linux libusb)
// it will have an IUsbDevice interface. If not (WinUSB) the
// variable will be null indicating this is an interface of a
// device.
IUsbDevice wholeUsbDevice = MyUsbDevice as IUsbDevice;
if (!ReferenceEquals(wholeUsbDevice, null))
{
// This is a "whole" USB device. Before it can be used,
// the desired configuration and interface must be selected.
// Select config #1
wholeUsbDevice.SetConfiguration(1);
// Claim interface #0.
wholeUsbDevice.ClaimInterface(0);
}
// open read endpoint 1.
UsbEndpointReader reader = MyUsbDevice.OpenEndpointReader(ReadEndpointID.Ep01);
// open write endpoint 1.
UsbEndpointWriter writer = MyUsbDevice.OpenEndpointWriter(WriteEndpointID.Ep01);
//if (!String.IsNullOrEmpty(cmdLine))
if (File.Exists(Environment.CurrentDirectory + "\\test.bmp"))
{
//Bitmap test = Bitmap.FromFile(Environment.CurrentDirectory + "\\test.bmp");
Bitmap source = (Bitmap)Bitmap.FromFile(Environment.CurrentDirectory + "\\test.bmp");
//Creat a 16 bit copy of it using the graphics class
Bitmap dest = new Bitmap(source.Width, source.Height, System.Drawing.Imaging.PixelFormat.Format16bppRgb565);
using (Graphics g = Graphics.FromImage(dest))
{
g.DrawImageUnscaled(source, 0, 0);
}
//Get a copy of the byte array you need to send to your tft
Rectangle r = new Rectangle(0, 0, dest.Width, dest.Height);
BitmapData bd = dest.LockBits(r, System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format16bppRgb565);
byte[] TftData = new byte[dest.Width * dest.Height * 2];
Marshal.Copy(bd.Scan0, TftData, 0, TftData.Length);
dest.UnlockBits(bd);
//A 16 bit copy of the data you need to send to your tft is now sitting in the TftData array.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int bytesWritten;
//This writing passes with no errors, but nothing is returned
ec = writer.Write(g_excmdBytes, 2000, out bytesWritten);
if (ec != ErrorCode.None) throw new Exception(UsbDevice.LastErrorString);
Console.WriteLine("Done Command");
//this line get written
byte[] readBuffer = new byte[1024];
while (ec == ErrorCode.None)
{
int bytesRead;
// If the device hasn't sent data in the last 100 milliseconds,
// a timeout error (ec = IoTimedOut) will occur.
ec = reader.Read(readBuffer, 100, out bytesRead);
if (bytesRead == 0) { Console.WriteLine("No more bytes!"); break; }
// Write that output to the console.
Console.WriteLine(Encoding.Default.GetString(readBuffer, 0, bytesRead));
}
//no problem untill here:
//PASS RGB565 image from earlier encoding
ec = writer.Write(TftData, 2000, out bytesWritten);
if (ec != ErrorCode.None) throw new Exception(UsbDevice.LastErrorString);
//A first chance exception of type 'System.Exception' occurred in USB_LCD.exe
//Win32Error:Win32Error:GetOverlappedResult Ep 0x01
//31:
//The thread '<No Name>' (0x1b28) has exited with code 0 (0x0).
//exception was thrown so doesn't get here.....
//byte[] readBuffer = new byte[1024];
readBuffer = new byte[1024];
while (ec == ErrorCode.None)
{
int bytesRead;
// If the device hasn't sent data in the last 100 milliseconds,
// a timeout error (ec = IoTimedOut) will occur.
ec = reader.Read(readBuffer, 100, out bytesRead);
if (bytesRead == 0) { Console.WriteLine("No more bytes!"); break; };
// Write that output to the console.
Console.WriteLine(Encoding.Default.GetString(readBuffer, 0, bytesRead));
}
Console.WriteLine("\r\nDone!\r\n");
}
else
Console.WriteLine("Nothing to do.");
}
catch (Exception ex)
{
Console.WriteLine();
Console.WriteLine((ec != ErrorCode.None ? ec + ":" : String.Empty) + ex.Message);
}
finally
{
if (MyUsbDevice != null)
{
if (MyUsbDevice.IsOpen)
{
// If this is a "whole" usb device (libusb-win32, linux libusb-1.0)
// it exposes an IUsbDevice interface. If not (WinUSB) the
// 'wholeUsbDevice' variable will be null indicating this is
// an interface of a device; it does not require or support
// configuration and interface selection.
IUsbDevice wholeUsbDevice = MyUsbDevice as IUsbDevice;
if (!ReferenceEquals(wholeUsbDevice, null))
{
// Release interface #0.
wholeUsbDevice.ReleaseInterface(0);
}
MyUsbDevice.Close();
}
MyUsbDevice = null;
// Free usb resources
UsbDevice.Exit();
}
// Wait for user input..
//Console.ReadKey();
}
}
|
Re: LCD screen for your dockstar (cheap! <$5) January 23, 2013 03:41AM |
Registered: 13 years ago Posts: 365 |
//This writing passes with no errors, but nothing is returned
ec = writer.Write(g_excmdBytes, 2000, out bytesWritten);
. . . // ulx - first pixel coordinate on screen, x // uly - first pixel coordinate on screen, y // llx - last pixel coordinate on screen, x // lly - last pixel coordinate on screen, y g_excmdBytes[6] = 0x12; // = USBCMD_BLIT --> defined in include/usbuser.h g_excmdBytes[7] = ulx & 0xFF; g_excmdBytes[8] = ulx >> 8; g_excmdBytes[9] = uly & 0xFF; g_excmdBytes[10] = uly >> 8; g_excmdBytes[11] = (llx - 1) & 0xFF; g_excmdBytes[12] = (llx - 1) >> 8; g_excmdBytes[13] = (lly - 1) & 0xFF; g_excmdBytes[14] = (lly - 1) >> 8; g_excmdBytes[15] = 0; . . . ec = writer.Write(g_excmdBytes, 2000, out bytesWritten);After this you have to send (llx - urx) * (lly - ury) * 2 bytes of image data.
byte[] readBuffer = new byte[1024];
while (ec == ErrorCode.None)
{
.
.
.
}
can be removed.
|
joelbl
Re: LCD screen for your dockstar (cheap! <$5) January 23, 2013 07:25AM |
|
joelbl
Re: LCD screen for your dockstar (cheap! <$5) January 23, 2013 07:34AM |
|
Re: LCD screen for your dockstar (cheap! <$5) January 23, 2013 09:13AM |
Registered: 13 years ago Posts: 365 |
|
joelbl
Re: LCD screen for your dockstar (cheap! <$5) January 24, 2013 03:47PM |
|
joelbl
Re: LCD screen for your dockstar (cheap! <$5) January 24, 2013 03:50PM |
|
joelbl
Re: LCD screen for your dockstar (cheap! <$5) January 24, 2013 05:06PM |
|
Re: LCD screen for your dockstar (cheap! <$5) January 25, 2013 02:47AM |
Registered: 13 years ago Posts: 365 |
|
joelbl
Re: LCD screen for your dockstar (cheap! <$5) January 25, 2013 05:31AM |
|
joelbl
Re: LCD screen for your dockstar (cheap! <$5) January 25, 2013 06:56AM |
|
Re: LCD screen for your dockstar (cheap! <$5) January 25, 2013 07:08AM |
Registered: 13 years ago Posts: 365 |
|
joelbl
Re: LCD screen for your dockstar (cheap! <$5) January 25, 2013 09:29AM |
|
Re: LCD screen for your dockstar (cheap! <$5) January 26, 2013 04:26AM |
Registered: 13 years ago Posts: 365 |
|
joelbl
Re: LCD screen for your dockstar (cheap! <$5) January 26, 2013 08:00AM |
|
Re: LCD screen for your dockstar (cheap! <$5) January 26, 2013 10:15AM |
Registered: 13 years ago Posts: 365 |
Quote
... if you like to learn ax206 programmming / 8052 assembler / sdcc / etc. - your welcome! Just be prepared for some hard weeks of studying hardware manuals and source code, frustration, head scratching and bricked dpfs. At least that the way I learned it. :-)
|
joelbl
Re: LCD screen for your dockstar (cheap! <$5) January 26, 2013 10:25AM |
|
joelbl
Re: LCD screen for your dockstar (cheap! <$5) February 10, 2013 09:57AM |
|
Re: LCD screen for your dockstar (cheap! <$5) February 10, 2013 11:20AM |
Registered: 13 years ago Posts: 365 |
./identify.py dpf_dump.bin Looking for firmware.............: Found (coby, 128x128 px). Looking for Openwin..............: Found. Looking for LcdIniTbl............: None. Looking for known signatures.....: None. Looking for known version info...: None. Sorry, no matching dpf found. But following models have a partial signature match: [['abeyerr_black_2'], ['acme_1'], ['jovisa'], ['sunluxy']]Any of these may work. But to be sure I added a new one (abeyerr_black_3).
|
joelbl
Re: LCD screen for your dockstar (cheap! <$5) February 10, 2013 11:39AM |
|
Re: LCD screen for your dockstar (cheap! <$5) February 10, 2013 12:00PM |
Registered: 13 years ago Posts: 365 |
|
joelbl
Re: LCD screen for your dockstar (cheap! <$5) February 10, 2013 12:08PM |
|
joelbl
Re: LCD screen for your dockstar (cheap! <$5) February 10, 2013 03:39PM |
|
Re: LCD screen for your dockstar (cheap! <$5) February 12, 2013 03:21PM |
Registered: 12 years ago Posts: 4 |
sudo python ../fw/identify.py full.bin Looking for firmware.............: Found (buildwin, 128x128 px). Looking for Openwin..............: Found. Looking for LcdIniTbl............: Found. Looking for known signatures.....: None. Looking for known version info...: None. Sorry, no matching dpf found. But following models have a partial signature match: [['agk_violet'], ['dx27893'], ['eachdesk_tumbler']]
Bus 001 Device 007: ID 1908:0102 GEMBIRD
|
Re: LCD screen for your dockstar (cheap! <$5) February 13, 2013 08:26AM |
Registered: 13 years ago Posts: 365 |
|
Re: LCD screen for your dockstar (cheap! <$5) February 13, 2013 03:03PM |
Registered: 12 years ago Posts: 4 |
$ sudo ../fw/hiddetach
Detaching dpf at 2-1.2:1.0... done.
$ sudo python ../fw/restore.py fw_acme_3.bin -f
Found AX206 DPF (bootloader)
failed to open flash driver
Traceback (most recent call last):
File "../fw/restore.py", line 35, in <module>
size = detect.detect_flash(d)
File "[...]/dpf-ax/trunk/fw/detect.py", line 79, in detect_flash
manu, dev0, dev1 = d.probeFlash()
SystemError: 94:(ffffffff): Unknown error