Adding dynamic USB power support
- Each scan module now has a current change callback which passes the available current as a parameter - No longer attempts to use the max 500 mA immediately, starts with 100 mA then goes to 500 mA after enumeration - If enumeration fails due to bMaxPower of 500 mA, then attempt again at 100 mA (might also be possible to go even lower to 20 mA in certain cases) - Now working with the Apple Ipad (no over-power messages) - Fixed Wake-up behaviour on Apple Ipad (and likely other iOS devices) - More effecient set_feature/clear_feature handling (device handler) - Initial power handling via Interconnect (still needs work to get it more dynamic)
This commit is contained in:
parent
62ba0c558b
commit
aaae9bc0f2
29 changed files with 503 additions and 48 deletions
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014-2015 by Jacob Alexander
|
||||
/* Copyright (C) 2014-2016 by Jacob Alexander
|
||||
*
|
||||
* This file is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -470,6 +470,14 @@ uint8_t Connect_receive_CableCheck( uint8_t byte, uint16_t *pending_bytes, uint8
|
|||
}
|
||||
else
|
||||
{
|
||||
// Lower current requirement during errors
|
||||
// USB minimum
|
||||
// Only if this is not the master node
|
||||
if ( Connect_id != 0 )
|
||||
{
|
||||
Output_update_external_current( 100 );
|
||||
}
|
||||
|
||||
Connect_cableFaultsMaster++;
|
||||
Connect_cableOkMaster = 0;
|
||||
print(" Master ");
|
||||
|
@ -489,6 +497,12 @@ uint8_t Connect_receive_CableCheck( uint8_t byte, uint16_t *pending_bytes, uint8
|
|||
}
|
||||
else
|
||||
{
|
||||
// If we already have an Id, then set max current again
|
||||
if ( Connect_id != 255 && Connect_id != 0 )
|
||||
{
|
||||
// TODO reset to original negotiated current
|
||||
Output_update_external_current( 500 );
|
||||
}
|
||||
Connect_cableChecksMaster++;
|
||||
}
|
||||
}
|
||||
|
@ -560,6 +574,14 @@ uint8_t Connect_receive_IdEnumeration( uint8_t id, uint16_t *pending_bytes, uint
|
|||
// Send reponse back to master
|
||||
Connect_send_IdReport( id );
|
||||
|
||||
// Node now enumerated, set external power to USB Max
|
||||
// Only set if this is not the master node
|
||||
// TODO Determine power slice for each node as part of protocol
|
||||
if ( Connect_id != 0 )
|
||||
{
|
||||
Output_update_external_current( 500 );
|
||||
}
|
||||
|
||||
// Propogate next Id if the connection is ok
|
||||
if ( Connect_cableOkSlave )
|
||||
{
|
||||
|
@ -1177,6 +1199,13 @@ void Connect_scan()
|
|||
}
|
||||
|
||||
|
||||
// Called by parent Scan module whenever the available current changes
|
||||
void Connect_currentChange( unsigned int current )
|
||||
{
|
||||
// TODO - Any potential power saving here?
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ----- CLI Command Functions -----
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014-2015 by Jacob Alexander
|
||||
/* Copyright (C) 2014-2016 by Jacob Alexander
|
||||
*
|
||||
* This file is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -168,3 +168,5 @@ void Connect_reset();
|
|||
void Connect_send_ScanCode( uint8_t id, TriggerGuide *scanCodeStateList, uint8_t numScanCodes );
|
||||
void Connect_send_RemoteCapability( uint8_t id, uint8_t capabilityIndex, uint8_t state, uint8_t stateType, uint8_t numArgs, uint8_t *args );
|
||||
|
||||
void Connect_currentChange( unsigned int current );
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue