Skip to content

Commit cc7a102

Browse files
cromwelldevcromwelldev
cromwelldev
authored and
cromwelldev
committed
Added debug stuff in USB
Cleaned Webserver a bit
1 parent 7a4cffc commit cc7a102

File tree

14 files changed

+90
-61
lines changed

14 files changed

+90
-61
lines changed

Diff for: drivers/usb/core/hcd-pci.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
6767
struct usb_hcd *hcd;
6868
int retval, region;
6969
char buf [8];
70-
//char *bufp = buf;
70+
#ifdef DEBUG_MODE
71+
char *bufp = buf;
72+
#endif
7173

7274
if (usb_disabled())
7375
return -ENODEV;

Diff for: drivers/usb/core/hub.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static pid_t khubd_pid = 0; /* PID of khubd */
5656
static DECLARE_COMPLETION(khubd_exited);
5757

5858
#ifdef DEBUG
59-
/*
59+
6060
static inline char *portspeed (int portstatus)
6161
{
6262
if (portstatus & (1 << USB_PORT_FEAT_HIGHSPEED))
@@ -66,7 +66,7 @@ static inline char *portspeed (int portstatus)
6666
else
6767
return "12 Mb/s";
6868
}
69-
*/
69+
7070
#endif
7171

7272
/* for dev_info, dev_dbg, etc */

Diff for: drivers/usb/core/usb.c

+4
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,7 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
950950
switch (dev->speed) {
951951
case USB_SPEED_HIGH: /* fixed at 64 */
952952
i = 64;
953+
debugSPIPrint("USB_SPEED_HIGH device");
953954
break;
954955
case USB_SPEED_FULL: /* 8, 16, 32, or 64 */
955956
/* to determine the ep0 maxpacket size, read the first 8
@@ -1053,7 +1054,10 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
10531054
/* put into sysfs, with device and config specific files */
10541055
err = device_add (&dev->dev);
10551056
if (err)
1057+
{
1058+
debugSPIPrint("Error during device_add");
10561059
return err;
1060+
}
10571061
usb_create_driverfs_dev_files (dev);
10581062

10591063
/* Register all of the interfaces for this device with the driver core.

Diff for: drivers/usb/host/ohci-dbg.c

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99

1010
/*-------------------------------------------------------------------------*/
11+
//#define DEBUG
1112

1213
#ifdef DEBUG
1314

Diff for: drivers/usb/sys/xpad.c

+38-38
Original file line numberDiff line numberDiff line change
@@ -128,44 +128,44 @@ static void xpad_disconnect(struct usb_interface *intf)
128128
/*------------------------------------------------------------------------*/
129129
//Taken from X-CHanger 2.5 source code. Will add mine in the future, I promise...
130130
static struct usb_device_id xpad_ids [] = {
131-
{ USB_DEVICE(0x044f, 0x0f07) },//Thrustmaster, Inc. Controller
132-
{ USB_DEVICE(0x045e, 0x0202) },//Microsoft Xbox Controller
133-
{ USB_DEVICE(0x045e, 0x0285) },//Microsoft Xbox Controller S
134-
{ USB_DEVICE(0x045e, 0x0287) },//Microsoft XBox Controller S
135-
{ USB_DEVICE(0x045e, 0x0289) },//Microsoft Xbox Controller S
136-
{ USB_DEVICE(0x046d, 0xca84) },//Logitech Cordless Controller for Xbox
137-
{ USB_DEVICE(0x046d, 0xca88) },//Logitech Compact Controller for Xbox
138-
{ USB_DEVICE(0x05fd, 0x1007) },//???Mad Catz Controller???
139-
{ USB_DEVICE(0x05fd, 0x107a) },//InterAct PowerPad Pro
140-
{ USB_DEVICE(0x0738, 0x4516) },//Mad Catz Control Pad
141-
{ USB_DEVICE(0x0738, 0x4522) },//Mad Catz LumiCON
142-
{ USB_DEVICE(0x0738, 0x4526) },//Mad Catz Control Pad Pro
143-
{ USB_DEVICE(0x0738, 0x4536) },//Mad Catz MicroCON
144-
{ USB_DEVICE(0x0738, 0x4540) },//Mad Catz Beat Pad
145-
{ USB_DEVICE(0x0738, 0x4556) },//Mad Catz Lynx Wireless Controller
146-
{ USB_DEVICE(0x0738, 0x6040) },//Mad Catz Beat Pad pro
147-
{ USB_DEVICE(0x0c12, 0x8802) },//Zeroplus, Hama, Bigben
148-
{ USB_DEVICE(0x0c12, 0x8809) },//Level Six Xbox DDR Dancepad
149-
{ USB_DEVICE(0x0c12, 0x880a) },//2-Tech Crystal Controller
150-
{ USB_DEVICE(0x0c12, 0x8810) },//Zeroplus Xbox Controller
151-
{ USB_DEVICE(0x0c12, 0x9902) },//HAMA VibraX - *FAULTY HARDWARE*
152-
{ USB_DEVICE(0x0e4c, 0x1097) },//Radica Gamester Controller
153-
{ USB_DEVICE(0x0e4c, 0x2390) },//Radica Games Jtech Controller
154-
{ USB_DEVICE(0x0e6f, 0x0003) },//Logic3 Freebird wireless Controller
155-
{ USB_DEVICE(0x0e6f, 0x0005) },//Eclipse wireless Controller
156-
{ USB_DEVICE(0x0e6f, 0x0006) },//Edge wireless Controller
157-
{ USB_DEVICE(0x0e8f, 0x0201) },//SmartJoy Frag Xpad/PS2 adaptor", 0, XTYPE_XBOX },
158-
{ USB_DEVICE(0x0e8f, 0x3008) },//Generic xbox control (dealextreme)", 0, XTYPE_XBOX },
159-
{ USB_DEVICE(0x0f30, 0x0107) },//Hama Thunder
160-
{ USB_DEVICE(0x0f30, 0x0202) },//Joytech Advanced Controller
161-
{ USB_DEVICE(0x0f30, 0x0208) },//Hama Thunder
162-
{ USB_DEVICE(0x0f30, 0x8888) },//BigBen XBMiniPad Controller", 0, XTYPE_XBOX },
163-
{ USB_DEVICE(0x102c, 0xff0c) },//Joytech Wireless Advanced Controller
164-
{ USB_DEVICE(0x10c6, 0x8015) },//Intec Cyber Shock
165-
{ USB_DEVICE(0x12ab, 0x8809) },//Xbox DDR dancepad
166-
{ USB_DEVICE(0xffff, 0xffff) },//Chinese-made Xbox Controller
167-
{ USB_DEVICE(0x0000, 0x0000) }, // nothing detected - FAIL
168-
{ } /* Terminating entry */
131+
{ USB_DEVICE(0x044f, 0x0f07) },//Thrustmaster, Inc. Controller
132+
{ USB_DEVICE(0x045e, 0x0202) },//Microsoft Xbox Controller
133+
{ USB_DEVICE(0x045e, 0x0285) },//Microsoft Xbox Controller S
134+
{ USB_DEVICE(0x045e, 0x0287) },//Microsoft XBox Controller S
135+
{ USB_DEVICE(0x045e, 0x0289) },//Microsoft Xbox Controller S
136+
{ USB_DEVICE(0x046d, 0xca84) },//Logitech Cordless Controller for Xbox
137+
{ USB_DEVICE(0x046d, 0xca88) },//Logitech Compact Controller for Xbox
138+
{ USB_DEVICE(0x05fd, 0x1007) },//???Mad Catz Controller???
139+
{ USB_DEVICE(0x05fd, 0x107a) },//InterAct PowerPad Pro
140+
{ USB_DEVICE(0x0738, 0x4516) },//Mad Catz Control Pad
141+
{ USB_DEVICE(0x0738, 0x4522) },//Mad Catz LumiCON
142+
{ USB_DEVICE(0x0738, 0x4526) },//Mad Catz Control Pad Pro
143+
{ USB_DEVICE(0x0738, 0x4536) },//Mad Catz MicroCON
144+
{ USB_DEVICE(0x0738, 0x4540) },//Mad Catz Beat Pad
145+
{ USB_DEVICE(0x0738, 0x4556) },//Mad Catz Lynx Wireless Controller
146+
{ USB_DEVICE(0x0738, 0x6040) },//Mad Catz Beat Pad pro
147+
{ USB_DEVICE(0x0c12, 0x8802) },//Zeroplus, Hama, Bigben
148+
{ USB_DEVICE(0x0c12, 0x8809) },//Level Six Xbox DDR Dancepad
149+
{ USB_DEVICE(0x0c12, 0x880a) },//2-Tech Crystal Controller
150+
{ USB_DEVICE(0x0c12, 0x8810) },//Zeroplus Xbox Controller
151+
{ USB_DEVICE(0x0c12, 0x9902) },//HAMA VibraX - *FAULTY HARDWARE*
152+
{ USB_DEVICE(0x0e4c, 0x1097) },//Radica Gamester Controller
153+
{ USB_DEVICE(0x0e4c, 0x2390) },//Radica Games Jtech Controller
154+
{ USB_DEVICE(0x0e6f, 0x0003) },//Logic3 Freebird wireless Controller
155+
{ USB_DEVICE(0x0e6f, 0x0005) },//Eclipse wireless Controller
156+
{ USB_DEVICE(0x0e6f, 0x0006) },//Edge wireless Controller
157+
{ USB_DEVICE(0x0e8f, 0x0201) },//SmartJoy Frag Xpad/PS2 adaptor", 0, XTYPE_XBOX },
158+
{ USB_DEVICE(0x0e8f, 0x3008) },//Generic xbox control (dealextreme)", 0, XTYPE_XBOX },
159+
{ USB_DEVICE(0x0f30, 0x0107) },//Hama Thunder
160+
{ USB_DEVICE(0x0f30, 0x0202) },//Joytech Advanced Controller
161+
{ USB_DEVICE(0x0f30, 0x0208) },//Hama Thunder
162+
{ USB_DEVICE(0x0f30, 0x8888) },//BigBen XBMiniPad Controller", 0, XTYPE_XBOX },
163+
{ USB_DEVICE(0x102c, 0xff0c) },//Joytech Wireless Advanced Controller
164+
{ USB_DEVICE(0x10c6, 0x8015) },//Intec Cyber Shock
165+
{ USB_DEVICE(0x12ab, 0x8809) },//Xbox DDR dancepad
166+
{ USB_DEVICE(0xffff, 0xffff) },//Chinese-made Xbox Controller
167+
{ USB_DEVICE(0x0000, 0x0000) }, // nothing detected - FAIL
168+
{ } /* Terminating entry */
169169
};
170170

171171

Diff for: include/linux_wrapper.h

+2
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,8 @@ void my_wait_for_completion(struct completion*);
524524
/*------------------------------------------------------------------------*/
525525
/* Debug output */
526526
/*------------------------------------------------------------------------*/
527+
//#define DEBUG_MODE
528+
#include "lib/LPCMod/xblastDebug.h"
527529
#ifdef DEBUG_MODE
528530
#define dev_printk(lvl,x,f,arg...) debugSPIPrint(f, ## arg)
529531
#define dev_dbg(x,f,arg...) debugSPIPrint(f, ## arg)

Diff for: include/lpcmod_v1.h

-6
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,5 @@
155155
#define ADR_LCDSTRING0 0xFF14C
156156
*/
157157

158-
#define BIOS_NETFLASH 0
159-
#define EEPROM_NETFLASH 1
160-
#define HDD0LOCK_NETFLASH 2
161-
#define HDD1LOCK_NETFLASH 3
162-
163-
164158

165159
#endif

Diff for: lwip/WebServerOps.h

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* WebServerOps.h
3+
*
4+
* Created on: Oct 8, 2016
5+
* Author: cromwelldev
6+
*/
7+
8+
#ifndef LWIP_WEBSERVEROPS_H_
9+
#define LWIP_WEBSERVEROPS_H_
10+
11+
typedef enum
12+
{
13+
WebServerOps_BIOSFlash = 0U,
14+
WebServerOps_EEPROMFlash,
15+
WebServerOps_HDD0Lock,
16+
WebServerOps_HDD1Lock
17+
}WebServerOps;
18+
19+
extern WebServerOps currentWebServerOp;
20+
21+
#endif /* LWIP_WEBSERVEROPS_H_ */

Diff for: lwip/ethernetif.c

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
#include <stdarg.h>
6666

6767
bool netFlashOver;
68+
WebServerOps currentWebServerOp;
6869

6970
/* Define those to better describe your network interface. */
7071
#define IFNAME0 'e'

Diff for: lwip/httpd.h

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
#ifndef __HTTPD_H__
3333
#define __HTTPD_H__
3434

35+
#include "WebServerOps.h"
36+
3537
extern bool netFlashOver;
3638

3739
void httpd_init(unsigned char flashType);

Diff for: lwip/webserver.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -135,19 +135,19 @@ static void close_conn(struct tcp_pcb *pcb, struct http_state *hs) {
135135
busyLED();
136136
//printk ("\nGot BIOS-image over http, %d bytes\n", hs->bios_len);
137137
switch(pcb->flashType){
138-
case BIOS_NETFLASH:
138+
case WebServerOps_BIOSFlash:
139139
fileBuf = (unsigned char *) malloc (1024 * 1024); //1MB buffer(max BIOS size)
140140
memset(fileBuf, 0x00, 1024 * 1024); //Fill with 0.
141141
memcpy(fileBuf, hs->bios_start, hs->bios_len);
142142
netFlashOver = FlashFileFromBuffer(fileBuf, hs->bios_len, 0); //0 because we don't want to show confirmDialog screens.
143143
free(fileBuf);
144144
break;
145-
case EEPROM_NETFLASH:
145+
case WebServerOps_EEPROMFlash:
146146
updateEEPROMEditBufferFromInputBuffer(hs->bios_start, hs->bios_len, true);
147147
netFlashOver = 1;
148148
UIFooter();
149149
break;
150-
case HDD0LOCK_NETFLASH:
150+
case WebServerOps_HDD0Lock:
151151
if((tsaHarddiskInfo[0].m_securitySettings &0x0002)==0x0002) { //Drive is already locked
152152
UnlockHDD(0, 1, (unsigned char *)hs->bios_start, false); //Attempt Unlock only if SECURITY_UNLOCK was successful.
153153
}
@@ -156,7 +156,7 @@ static void close_conn(struct tcp_pcb *pcb, struct http_state *hs) {
156156
}
157157
netFlashOver = 1;
158158
break;
159-
case HDD1LOCK_NETFLASH:
159+
case WebServerOps_HDD1Lock:
160160
if((tsaHarddiskInfo[1].m_securitySettings &0x0002)==0x0002) { //Drive is already locked
161161
UnlockHDD(1, 1, (unsigned char *)hs->bios_start,false); //Attempt Unlock only if SECURITY_UNLOCK was successful.
162162
}
@@ -262,7 +262,7 @@ handle_line(struct tcp_pcb *pcb, struct http_state *hs)
262262
if (fno > 2) {
263263
fno = 3; /* 404 */
264264
}
265-
if(pcb->flashType == HDD0LOCK_NETFLASH || pcb->flashType == HDD1LOCK_NETFLASH){
265+
if(pcb->flashType == WebServerOps_HDD0Lock || pcb->flashType == WebServerOps_HDD1Lock){
266266
fileSelect = 8;
267267
}
268268
else{
@@ -372,7 +372,7 @@ handle_post(struct http_state *hs, unsigned char flashType)
372372
len = end - start;
373373

374374
switch(flashType){
375-
case BIOS_NETFLASH:
375+
case WebServerOps_BIOSFlash:
376376
if(len != 256*1024 && len != 512*1024 && len != 1024*1024){
377377
hs->file = http_files[2].data;
378378
hs->left = http_files[2].len;
@@ -382,7 +382,7 @@ handle_post(struct http_state *hs, unsigned char flashType)
382382
hs->file = http_files[1].data;
383383
hs->left = http_files[1].len;
384384
break;
385-
case EEPROM_NETFLASH:
385+
case WebServerOps_EEPROMFlash:
386386
if(len != 256){
387387
hs->file = http_files[7].data;
388388
hs->left = http_files[7].len;
@@ -392,8 +392,8 @@ handle_post(struct http_state *hs, unsigned char flashType)
392392
hs->file = http_files[6].data;
393393
hs->left = http_files[6].len;
394394
break;
395-
case HDD0LOCK_NETFLASH:
396-
case HDD1LOCK_NETFLASH:
395+
case WebServerOps_HDD0Lock:
396+
case WebServerOps_HDD1Lock:
397397
if(len != 256){
398398
hs->file = http_files[10].data;
399399
hs->left = http_files[10].len;

Diff for: menu/actions/HDDMenuActions.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "FlashMenuActions.h"
1717
#include "Gentoox.h"
1818
#include "menu/misc/ConfirmDialog.h"
19+
#include "WebServerOps.h"
1920

2021
void AssertLockUnlock(void *itemPtr){
2122
TEXTMENUITEM * tempItemPtr = (TEXTMENUITEM *)itemPtr;
@@ -43,14 +44,13 @@ void AssertLockUnlock(void *itemPtr){
4344
void AssertLockUnlockFromNetwork(void *itemPtr){
4445
TEXTMENUITEM * tempItemPtr = (TEXTMENUITEM *)itemPtr;
4546
unsigned char nIndexDrive = 1; //Toggle slave by default.
46-
char temp = HDD1LOCK_NETFLASH;
47+
char temp = WebServerOps_HDD1Lock;
4748
unsigned char *eepromPtr;
4849

4950
//Not that cool to do but I don't want to change the function call in textmenu.c...
5051
nIndexDrive = (unsigned char)tempItemPtr->szParameter[50];
5152
if(nIndexDrive == 0)
52-
temp = HDD0LOCK_NETFLASH;
53-
53+
temp = WebServerOps_HDD0Lock;
5454
enableNetflash((void *)&temp);
5555

5656
if((tsaHarddiskInfo[nIndexDrive].m_securitySettings &0x0002)==0x0002) {

Diff for: menu/textmenu/BankSelectMenuInit.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "boot.h"
1616
#include "string.h"
1717
#include "lib/LPCMod/BootLPCMod.h"
18+
#include "WebServerOps.h"
1819

1920

2021
TEXTMENU *BankSelectMenuInit(void * bank) {
@@ -153,7 +154,7 @@ TEXTMENU* BankSelectInit(void * bank) {
153154
sprintf(itemPtr->szCaption,"Net Flash");
154155
itemPtr->functionPtr= enableNetflash;
155156
itemPtr->functionDataPtr= malloc(sizeof(unsigned char));
156-
*(unsigned char *)itemPtr->functionDataPtr= BIOS_NETFLASH;
157+
*(unsigned char *)itemPtr->functionDataPtr= WebServerOps_BIOSFlash;
157158
TextMenuAddItem(menuPtr, itemPtr);
158159
#ifdef DEV_FEATURES
159160
itemPtr = (TEXTMENUITEM*)malloc(sizeof(TEXTMENUITEM));

Diff for: menu/textmenu/EepromEditMenuInit.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "lpcmod_v1.h"
1313
#include "FlashMenuActions.h"
1414
#include "string.h"
15+
#include "WebServerOps.h"
1516

1617
TEXTMENU* EEPROMFileRestoreMenuInit(void);
1718

@@ -70,7 +71,7 @@ TEXTMENU *eepromEditMenuInit(void) {
7071
strcpy(itemPtr->szCaption, "Restore from network");
7172
itemPtr->functionPtr= enableNetflash;
7273
itemPtr->functionDataPtr= malloc(sizeof(unsigned char));
73-
*(unsigned char *)itemPtr->functionDataPtr= EEPROM_NETFLASH;
74+
*(unsigned char *)itemPtr->functionDataPtr= WebServerOps_EEPROMFlash;
7475
itemPtr->functionDataPtrMemAlloc = true;
7576
TextMenuAddItem(menuPtr, itemPtr);
7677

0 commit comments

Comments
 (0)