libftdi Archives

Subject: Re: EEPROM: Battery powered field

From: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Fri, 24 Sep 2010 12:04:16 +0200
On Friday, 24. September 2010 11:54:44 Thomas Jarosch wrote:
> The old code states addr 08, bit 04 is "battery powered", I am
> wondering where that came from...

From this patch (Juergen Beisert):

Index: src/ftdi.c
===================================================================
--- src/ftdi.c.orig
+++ src/ftdi.c
@@ -1097,14 +1097,17 @@ int ftdi_eeprom_build(struct ftdi_eeprom
         output[0x07] = 0x02;
 
     // Addr 08: Config descriptor
-    // Bit 1: remote wakeup if 1
-    // Bit 0: self powered if 1
+    // Bit 7: always 1
+    // Bit 6: 1 if this device is self powered, 0 if bus powered
+    // Bit 5: 1 if this device uses remote wakeup
+    // Bit 4: 1 if this device is battery powered
     //
-    j = 0;
+    //
+    j = 0x80;
     if (eeprom->self_powered == 1)
-        j = j | 1;
+        j |= 0x40;
     if (eeprom->remote_wakeup == 1)
-        j = j | 2;
+        j |= 0x20;
     output[0x08] = j;
 
     // Addr 09: Max power consumption: max power = value * 2 mA

-> The "battery powered" comment was an easter egg ;)

Thomas

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx

Current Thread