-diff -Nur xilprg-0.5/makefile xilprg-new/makefile
+diff -Nur xilprg-0.5/makefile xilprg-patched/makefile
--- xilprg-0.5/makefile 2006-08-23 07:41:20.000000000 +0200
-+++ xilprg-new/makefile 2007-04-07 17:09:16.000000000 +0200
++++ xilprg-patched/makefile 2007-09-04 20:59:03.000000000 +0200
@@ -40,6 +40,7 @@
$(SRC_DIR)/prgfile.cpp \\r
$(SRC_DIR)/chip.cpp \\r
$(SRC_DIR)/cable.cpp \\r
$(SRC_DIR)/digilent.cpp \\r
$(SRC_DIR)/xilinx.cpp\r
-diff -Nur xilprg-0.5/src/cable.cpp xilprg-new/src/cable.cpp
+diff -Nur xilprg-0.5/src/cable.cpp xilprg-patched/src/cable.cpp
--- xilprg-0.5/src/cable.cpp 2006-08-23 07:38:34.000000000 +0200
-+++ xilprg-new/src/cable.cpp 2007-04-07 17:20:55.000000000 +0200
++++ xilprg-patched/src/cable.cpp 2007-09-04 20:59:03.000000000 +0200
@@ -49,6 +49,7 @@
#include "chip.h"\r
#include "cmdline.h"\r
{\r
msgf(STR_INVALID_CABLE_DEF);\r
return NULL;\r
-diff -Nur xilprg-0.5/src/onbusb.cpp xilprg-new/src/onbusb.cpp
+diff -Nur xilprg-0.5/src/onbusb.cpp xilprg-patched/src/onbusb.cpp
--- xilprg-0.5/src/onbusb.cpp 1970-01-01 01:00:00.000000000 +0100
-+++ xilprg-new/src/onbusb.cpp 2007-04-07 17:15:34.000000000 +0200
-@@ -0,0 +1,113 @@
++++ xilprg-patched/src/onbusb.cpp 2007-09-04 22:12:47.000000000 +0200
+@@ -0,0 +1,124 @@
+/*\r
+ * onboard usb\r
+ *\r
-+ * author: till & frank zirkelbach\r
++ * author: till, hunz, koppi, hackbard\r
+ *\r
+ */\r
+\r
+#include "utils.h"\r
+#include "onbusb.h"\r
+\r
++#define GET_TDO 0x20\r
++\r
+onbusb::onbusb()\r
+{\r
+ handle=NULL;\r
+ dev=bus->devices;\r
+ while(dev) {\r
+ if(dev->descriptor.idVendor==USB_VENDOR_ID &&\r
-+ dev->descriptor.idProduct==USB_PRODUCT_ID)\r
-+ /* found the device */\r
-+ return 0;\r
-+ dev=dev->next;\r
-+ }\r
-+ bus=bus->next;\r
-+ }\r
++ dev->descriptor.idProduct==USB_PRODUCT_ID) {\r
+\r
-+ return -1;\r
++ /* found the device */\r
++ handle=usb_open(dev);\r
++ if(handle==NULL)\r
++ goto cleanup;\r
+\r
-+ handle=usb_open(dev);\r
-+ if(handle==NULL)\r
-+ goto cleanup;\r
++ if(usb_set_configuration(handle,1)<0)\r
++ goto cleanup;\r
+\r
-+ if(usb_set_configuration(handle,1)<0)\r
-+ goto cleanup;\r
++ if(usb_claim_interface(handle,0)<0)\r
++ goto cleanup;\r
+\r
-+ if(usb_claim_interface(handle,0)<0)\r
-+ goto cleanup;\r
++ if(usb_set_altinterface(handle,1)<0)\r
++ goto cleanup;\r
+\r
-+ if(usb_set_altinterface(handle,1)<0)\r
-+ goto cleanup;\r
++ data = 0x10;\r
+\r
-+ data = 0x10;\r
++ reset_tap_state();\r
+\r
-+ reset_tap_state();\r
++ return 0;\r
++ }\r
++ dev=dev->next;\r
++ }\r
++ bus=bus->next;\r
++ }\r
+\r
-+ return 0;\r
++ return -1;\r
+\r
+cleanup:\r
+\r
+ close();\r
+\r
-+ return 1;\r
++ printf("usb init failed!\n");\r
++\r
++ return -1;\r
+\r
+}\r
+\r
+int onbusb::get_description(string& desc)\r
+{\r
+ char s[256];\r
-+ sprintf(s, "onboard usb bitbanging");\r
++ sprintf(s, "onboard usb bitbanging (till, hunz, koppi, hackbard)");\r
+ desc = s;\r
+ return 0;\r
+}\r
+void onbusb::set_tdi(int bit)\r
+{\r
+ if (bit) data |= 0x04; else data &= ~0x04;\r
-+ data|=0xa0;\r
+ usb_bulk_write(handle,0x01,&data,1,0);\r
+}\r
+\r
+void onbusb::set_tck(int bit)\r
+{\r
+ if (bit) data |= 0x10; else data &= ~0x10;\r
-+ data|=0xa0;\r
+ usb_bulk_write(handle,0x01,&data,1,0);\r
+}\r
+\r
+void onbusb::set_tms(int bit)\r
+{\r
+ if (bit) data |= 0x08; else data &= ~0x08;\r
-+ data|=0xa0;\r
+ usb_bulk_write(handle,0x01,&data,1,0);\r
+}\r
+\r
+int onbusb::get_tdo()\r
+{\r
++int i;
++ /* send get tdo command */\r
++ //data=GET_TDO;\r
++ //usb_bulk_write(handle,0x01,&data,1,0);\r
++ /* receive tdo */\r
++ // dirty! 1 dummy read is enough. my guess:
++ // - either we have to wait that time for correct state at tdi
++ // - or/and it's due to the EP1INBUF=1 (buf size?) todo: ez-usb doc!
++ // - initial wrong states don't harm
++ for(i=0;i<1;i++) usb_bulk_read(handle,0x81,&data,1,1);
+ usb_bulk_read(handle,0x81,&data,1,0);\r
+ return data & 0x01 ? 1 : 0;\r
+}\r
-diff -Nur xilprg-0.5/src/onbusb.h xilprg-new/src/onbusb.h
+diff -Nur xilprg-0.5/src/onbusb.h xilprg-patched/src/onbusb.h
--- xilprg-0.5/src/onbusb.h 1970-01-01 01:00:00.000000000 +0100
-+++ xilprg-new/src/onbusb.h 2007-04-07 17:14:07.000000000 +0200
++++ xilprg-patched/src/onbusb.h 2007-09-04 20:59:03.000000000 +0200
@@ -0,0 +1,43 @@
+/*\r
+ * onboard usb\r
+ *\r
-+ * author: till & frank zirkelbach\r
++ * author: till, hunz, koppi, hackbard\r
+ *\r
+ */\r
+\r
+};\r
+\r
+#endif\r
-diff -Nur xilprg-0.5/src/strtable.cpp xilprg-new/src/strtable.cpp
+diff -Nur xilprg-0.5/src/strtable.cpp xilprg-patched/src/strtable.cpp
--- xilprg-0.5/src/strtable.cpp 2006-08-23 07:38:34.000000000 +0200
-+++ xilprg-new/src/strtable.cpp 2007-04-07 16:56:25.000000000 +0200
++++ xilprg-patched/src/strtable.cpp 2007-09-04 20:59:03.000000000 +0200
@@ -137,7 +137,7 @@
//STR_CMD_CABLE\r
"cable\0" \r