Page 1 of 1

Define SELF_POWERED in run-time

Posted: Wed Jan 18, 2017 4:42 pm
by kasemann
Hi

We are making a USB audio product based on the usb audio framework... Our device can run on USB Power or with a battery attached. The thing I want to do is this:

- Detect whether battery power is used with a GPIO on startup.
- Depending on the GPIO-state report myself as a self-powered (or not self-powered) device via USB

The problem is that in the USB audio framework, the SELF_POWERED flag is defined in compile-time. Can anyone tell me where I'd have to apply changes to make it dynamic?

Markus

Re: Define SELF_POWERED in run-time

Posted: Thu Jan 19, 2017 2:43 pm
by larry
I think you'll need to write all device/configuration bytes at runtime that are currently under

Code: Select all

#ifdef SELF_POWERED