Add support for v2 API

Change-Id: I861e53db5446d2e3dc49935ea1cdd1607cff0a2a
Signed-off-by: Julien Danjou <julien@danjou.info>