Reported USB max power.

I'm doing an application with a MKRZERO that communicates with a phone via USB, also is powered from the phone. The consuption is not more than 25 mA.
In Android have not problems, the CDC serial port works ok, and the arduino is powered from the phone without problems.
When connected to an iPhone, the phone says "this device needs too much power, diconecting".
Connecting to a PC the command usb-devices says the device reports Max Power = 500 mA.

T:  Bus=05 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 20 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=2341 ProdID=804f Rev=01.00
S:  Manufacturer=Arduino LLC
S:  Product=Arduino MKRZero
S:  SerialNumber=FDAF4D37514D50364E4A2020FF01221E
C:  #Ifs= 2 Cfg#= 1 Atr=a0 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=02 Prot=00 Driver=cdc_acm
I:  If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm

This is a USB reported data, not the real used power.
I use a customized bootloader, and in bootloader mode reports 98 mA. because the file sam_ba_usb.c has been modified to report a lower value.
Modifying the file platform.txt to add -DUSB_POWER={build.usb_power} to build.usb_flags and boards.txt to ad does not solve the problem, the compile sketch still reports 500 mA.
Is there any way to change this?

USBCore.h might be the place to look.

// bMaxPower in Configuration Descriptor
#define USB_CONFIG_POWER_MA(mA)                ((mA)/2)
 #define USB_CONFIG_POWER                      (500)

Perfect, thats the correct place.
I've changed

#define USB_CONFIG_POWER                      (500)


#define USB_CONFIG_POWER                      (25)

And now it reports 25 mA. as needed power.
Thanks a lot. :slight_smile: