Created
December 1, 2012 15:53
-
-
Save cheery/4182978 to your computer and use it in GitHub Desktop.
simple openwf test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
CFLAGS="-I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads" | |
LDFLAGS="-L/opt/vc/lib/ -lWFC -lGLESv2 -lvcos" | |
gcc enum.c -o bin/enum $CFLAGS $LDFLAGS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "bcm_host.h" | |
#include "WF/wfc.h" | |
#include <stdio.h> | |
int main() { | |
bcm_host_init(); | |
int dids[10]; | |
int count = wfcEnumerateDevices(dids, 10, NULL); | |
int i; | |
printf("[\n"); | |
for (i = 0; i < count; i++) { | |
int did = dids[i]; | |
WFCDevice dev = wfcCreateDevice(did, NULL); | |
if (dev == 0) continue; | |
printf(" {\n"); | |
printf(" \"id\": %i,\n", did); | |
int cls = wfcGetDeviceAttribi(dev, WFC_DEVICE_CLASS); | |
switch (cls) { | |
case WFC_DEVICE_CLASS_FULLY_CAPABLE: | |
printf(" \"class\": \"DEVICE_CLASS_FULLY_CAPABLE\",\n"); | |
break; | |
case WFC_DEVICE_CLASS_OFF_SCREEN_ONLY: | |
printf(" \"class\": \"DEVICE_CLASS_OFF_SCREEN_ONLY\",\n"); | |
break; | |
default: | |
printf(" \"class\": %i,\n", cls); | |
} | |
wfcDestroyDevice(dev); | |
printf(" }\n"); | |
} | |
printf("]\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment