* Initial support for n810

- Fix set_altinterface workaround which seems to be checked by nolo 1.7
- n810 has the same USBID than n770
* Define some nolo commands used in query.c in nolo.h
* Get SW version with -i too
This commit is contained in:
pancake committed 2008-02-18 01:25:00 +01:00
1 parent fc6bacdb94
commit 32a59f4279
6 files changed
+23 -15

No files matched your search

+2 -1
View File
@@ -1,6 +1,6 @@
/*
* 0xFFFF - Open Free Fiasco Firmware Flasher
* Copyright (C) 2007 pancake <pancake@youterm.com>
* Copyright (C) 2007, 2008 pancake <pancake@youterm.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -46,6 +46,7 @@ void cmd_help(char *line)
void cmd_info(char *line)
{
get_sw_version();
get_hw_revision(); // get hardware revision:
get_root_device(); // only for flashing
get_usb_mode();
+1 -1
View File
@@ -37,7 +37,7 @@
struct devices supported_devices[SUPPORTED_DEVICES] = {
{ "FFFF", 0x000, 0x0000, 0x0000 }, // dummy
{ "unkn", 0x421, 0x3f00, 0x0000 }, // probably a development board
{ "n770", 0x421, 0x0105, 0x0001 }, // my n770
{ "n770/n810", 0x421, 0x0105, 0x0001 }, // my n770
{ "n800", 0x421, 0x04c3, 0x0001 }, // a n800
{ 0 },
{ 0 }
+3 -3
View File
@@ -175,8 +175,8 @@ int connect_via_usb()
return 1;
}
if ( usb_claim_interface(dev,
device->config->interface->altsetting->bInterfaceNumber) < 0) { // 2 or 0
if ( usb_claim_interface(dev, 2) < 0) {
//device->config->interface->altsetting->bInterfaceNumber) < 0) { // 2 or 0
D perror("usb_claim_interface");
// Something is broken if closing fails.
@@ -191,7 +191,7 @@ int connect_via_usb()
continue;
}
if (usb_set_altinterface(dev, device->config->interface->altsetting->bAlternateSetting) < 0) {
if (usb_set_altinterface(dev, 1) <0) { //device->config->interface->altsetting->bAlternateSetting) < 0) {
D perror("usb_set_altinterface");
// Something is broken if closing fails.
+1 -3
View File
@@ -3,6 +3,7 @@
#define _INCLUDE_MAIN_H_
#include "hash.h"
#include "nolo.h"
#define _FILE_OFFSET_BITS 64
#define _GNU_SOURCE
@@ -51,9 +52,6 @@ extern int verbose;
#define CMD_WRITE 64
#define CMD_QUERY 192
#define NOLO_GET_STATUS 1
#define NOLO_GET_BOARD_ID 2
#define NOLO_GET_VERSION 3
struct piece_t {
char *name;
+7
View File
@@ -0,0 +1,7 @@
#define NOLO_GET_STATUS 1
#define NOLO_GET_BOARD_ID 2
#define NOLO_GET_VERSION 3
#define NOLO_GET_HWVERSION 4
#define NOLO_SET_RDFLAGS 16
#define NOLO_GET_RDFLAGS 17
+9 -7
View File
@@ -118,7 +118,7 @@ int set_rd_mode(unsigned short mode)
if (((short)mode)==-1)
return 1;
if (usb_control_msg(dev, CMD_WRITE, 16, mode, 0, 0, 0, 2000) == -1) {
if (usb_control_msg(dev, CMD_WRITE, NOLO_SET_RDFLAGS, mode, 0, 0, 0, 2000) == -1) {
fprintf(stderr, "Cannot set R&D flags.\n");
return 1;
}
@@ -136,7 +136,8 @@ int get_hw_revision()
unsigned char string[512];
int i = 0;
if (usb_control_msg(dev, CMD_QUERY, 4, 0, 0, (char *)string, 512, 2000) == -1) {
memset(string,'\0',512);
if (usb_control_msg(dev, CMD_QUERY, NOLO_GET_HWVERSION, 0, 0, (char *)string, 512, 2000) == -1) {
fprintf(stderr, "Cannot query hw revision.\n");
return -1;
}
@@ -159,7 +160,7 @@ int get_rd_mode()
{
char isrd = 1;
if (usb_control_msg(dev, CMD_QUERY, 17, 0, 0, (char *)&isrd, 1, 2000) == -1) {
if (usb_control_msg(dev, CMD_QUERY, NOLO_GET_RDFLAGS, 0, 0, (char *)&isrd, 1, 2000) == -1) {
fprintf(stderr, "Cannot query rd mode.\n");
return -1;
}
@@ -172,7 +173,7 @@ int get_root_device()
{
unsigned char opcode;
if (usb_control_msg(dev, CMD_QUERY, 17, 0, 1, (char *)&opcode, 1, 2000) < 0) {
if (usb_control_msg(dev, CMD_QUERY, NOLO_GET_RDFLAGS, 0, 1, (char *)&opcode, 1, 2000) < 0) {
fprintf(stderr, "Cannot query root device\n");
return -1;
}
@@ -199,7 +200,7 @@ int set_root_device(unsigned short root_device)
return -1;
}
if (usb_control_msg(dev, CMD_WRITE, 16, root_device, 1, 0, 0, 2000) == -1) {
if (usb_control_msg(dev, CMD_WRITE, NOLO_SET_RDFLAGS, root_device, 1, 0, 0, 2000) == -1) {
fprintf(stderr, "Cannot set root device\n");
return -1;
}
@@ -283,7 +284,7 @@ int get_rd_flags()
{
unsigned short flags = 0;
if (usb_control_msg(dev, CMD_QUERY, 17, 0, 3, (void *) &flags, sizeof(flags), 2000) == -1) {
if (usb_control_msg(dev, CMD_QUERY, NOLO_GET_RDFLAGS, 0, 3, (void *) &flags, sizeof(flags), 2000) == -1) {
fprintf(stderr, "Cannot get rd flags\n");
return -1;
}
@@ -303,7 +304,7 @@ int get_nolo_version()
unsigned int version; // ensure uint is at least 32 bits
//if (usb_control_msg(dev, CMD_QUERY, 3, 0, 1, (char *)&version, 4 , 2000) < 0) {
if (usb_control_msg(dev, CMD_QUERY, 3, 0, 0, (char *)&version, 4 , 2000) < 0) {
if (usb_control_msg(dev, CMD_QUERY, NOLO_GET_VERSION, 0, 0, (char *)&version, 4 , 2000) < 0) {
fprintf(stderr, "Cannot query nolo version. Old bootloader version?\n");
exit(1);
}
@@ -330,6 +331,7 @@ int get_sw_version()
fprintf(stderr, "error: cannot write query 18\n");
return 0;
}
bytes[0]='\0';
ret = usb_control_msg(dev, CMD_QUERY, 20, 0, 0, (char *)&bytes, 512, 2000);
if (ret<0) {
fprintf(stderr, "error: b0rken swversion read!\n");