Thanks again all for comments so far. Changes in v4: - rework set/get into single command - add more cmd arg checking Changes in v3: - fix minor typos - remove unused 'error' var in pwm_get Changes in v2: - remove '-n' option to specify device by number - fix freeing resources on all return paths - add pwm_get command