include <libswd.libswd.h> include <stdio.h> int main(){ swd_ctx_t *swdctx; int res, idcode; swdctx=swd_init(); if (swdctx==NULL) return -1; swdctx->driver->device=... //might be necessary to access external driver res=swd_dap_detect(swdctx, SWD_OPERATION_EXECUTE, &idcode); if (res<0){ printf("ERROR: %s\n", swd_error_string(res)); return res; } swd_deinit(swdctx); return idcode; }