int main(int argc, char **argv) { char c, *device; uint8_t buf[1]; int grids, i; monome_t mk; struct option arguments[] = { {"help", no_argument, 0, 'h'}, {"device", required_argument, 0, 'd'}, {"active-grids", required_argument, 0, 'g'} }; grids = 0; device = NULL; i = 0; while( (c = getopt_long(argc, argv, "hd:g:", arguments, &i)) > 0 ) switch( c ) { case 'h': usage(argv[0]); return 1; case 'd': device = optarg; break; case 'g': grids = atoi(optarg); break; } if( !device || !grids ) { usage(argv[0]); exit(EXIT_FAILURE); } memset(&mk, '\0', sizeof(monome_t)); /* monome_platform_open() needs a devmap to check if it has any quirks. &mapping[3] is the device entry for the mk. */ if( monome_platform_open(&mk, &mapping[3], device) ) exit(EXIT_FAILURE); buf[0] = (PROTO_MK_GRIDS << 4) | (grids & 0xF); monome_platform_write(&mk, buf, 1); printf("successfully set active grids on %s\n", device); monome_platform_close(&mk); return EXIT_SUCCESS; }
static int proto_series_close(monome_t *monome) { return monome_platform_close(monome); }
static int proto_chronome_close(monome_t *monome) { return monome_platform_close(monome); }
static int proto_tinycyst_close(monome_t *monome) { return monome_platform_close(monome); }