Lines Matching +full:trigger +full:- +full:name

1 // SPDX-License-Identifier: GPL-2.0-only
12 * generic_buffer -n <device_name> -t <trigger_name>
13 * If trigger name is not specified the program assumes you want a dataready
14 * trigger associated with the device and goes looking for it.
38 * enum autochan - state for the automatic channel enabling mechanism
47 * size_from_channelarray() - calculate the storage size of a scan
66 channels[i].location = bytes - bytes % channels[i].bytes in size_from_channelarray()
79 bytes += max - misalignment; in size_from_channelarray()
90 input >>= info->shift; in print1byte()
91 input &= info->mask; in print1byte()
92 if (info->is_signed) { in print1byte()
93 int8_t val = (int8_t)(input << (8 - info->bits_used)) >> in print1byte()
94 (8 - info->bits_used); in print1byte()
95 printf("%05f ", ((float)val + info->offset) * info->scale); in print1byte()
97 printf("%05f ", ((float)input + info->offset) * info->scale); in print1byte()
104 if (info->be) in print2byte()
113 input >>= info->shift; in print2byte()
114 input &= info->mask; in print2byte()
115 if (info->is_signed) { in print2byte()
116 int16_t val = (int16_t)(input << (16 - info->bits_used)) >> in print2byte()
117 (16 - info->bits_used); in print2byte()
118 printf("%05f ", ((float)val + info->offset) * info->scale); in print2byte()
120 printf("%05f ", ((float)input + info->offset) * info->scale); in print2byte()
127 if (info->be) in print4byte()
136 input >>= info->shift; in print4byte()
137 input &= info->mask; in print4byte()
138 if (info->is_signed) { in print4byte()
139 int32_t val = (int32_t)(input << (32 - info->bits_used)) >> in print4byte()
140 (32 - info->bits_used); in print4byte()
141 printf("%05f ", ((float)val + info->offset) * info->scale); in print4byte()
143 printf("%05f ", ((float)input + info->offset) * info->scale); in print4byte()
150 if (info->be) in print8byte()
159 input >>= info->shift; in print8byte()
160 input &= info->mask; in print8byte()
161 if (info->is_signed) { in print8byte()
162 int64_t val = (int64_t)(input << (64 - info->bits_used)) >> in print8byte()
163 (64 - info->bits_used); in print8byte()
165 if (info->scale == 1.0f && info->offset == 0.0f) in print8byte()
169 ((float)val + info->offset) * info->scale); in print8byte()
171 printf("%05f ", ((float)input + info->offset) * info->scale); in print8byte()
176 * process_scan() - print out the values in SI units
222 scanelemdir[sizeof(scanelemdir)-1] = '\0'; in enable_disable_all_channels()
228 return -EIO; in enable_disable_all_channels()
231 ret = -ENOENT; in enable_disable_all_channels()
233 if (iioutils_check_suffix(ent->d_name, "_en")) { in enable_disable_all_channels()
236 ent->d_name); in enable_disable_all_channels()
237 ret = write_sysfs_int(ent->d_name, scanelemdir, in enable_disable_all_channels()
241 ent->d_name); in enable_disable_all_channels()
245 if (closedir(dp) == -1) { in enable_disable_all_channels()
248 return -errno; in enable_disable_all_channels()
257 " -a Auto-activate all available channels\n" in print_usage()
258 " -A Force-activate ALL channels\n" in print_usage()
259 " -b <n> The buffer which to open (by index), default 0\n" in print_usage()
260 " -c <n> Do n conversions, or loop forever if n < 0\n" in print_usage()
261 " -e Disable wait for event (new data)\n" in print_usage()
262 " -g Use trigger-less mode\n" in print_usage()
263 " -l <n> Set buffer length to n samples\n" in print_usage()
264 " --device-name -n <name>\n" in print_usage()
265 " --device-num -N <num>\n" in print_usage()
266 " Set device by name or number (mandatory)\n" in print_usage()
267 " --trigger-name -t <name>\n" in print_usage()
268 " --trigger-num -T <num>\n" in print_usage()
269 " Set trigger by name or number\n" in print_usage()
270 " -w <n> Set delay between reads in us (event-less mode)\n"); in print_usage()
283 /* Disable trigger */ in cleanup()
285 /* Disconnect the trigger - just write a dummy name. */ in cleanup()
286 ret = write_sysfs_string("trigger/current_trigger", in cleanup()
289 fprintf(stderr, "Failed to disable trigger: %s\n", in cleanup()
290 strerror(-ret)); in cleanup()
299 strerror(-ret)); in cleanup()
302 /* Disable channels if auto-enabled */ in cleanup()
315 exit(-signum); in sig_handler()
328 exit(-1); in register_cleanup()
334 { "device-name", 1, 0, 'n' },
335 { "device-num", 1, 0, 'N' },
336 { "trigger-name", 1, 0, 't' },
337 { "trigger-num", 1, 0, 'T' },
352 int fd = -1; in main()
353 int buf_fd = -1; in main()
360 int dev_num = -1, trig_num = -1; in main()
373 NULL)) != -1) { in main()
386 ret = -errno; in main()
390 ret = -ERANGE; in main()
399 ret = -errno; in main()
414 ret = -errno; in main()
426 ret = -errno; in main()
437 return -errno; in main()
443 ret = -errno; in main()
449 ret = -1; in main()
458 ret = -1; in main()
461 fprintf(stderr, "Only one of --device-num or --device-name needs to be set\n"); in main()
463 ret = -1; in main()
477 return -ENOMEM; in main()
482 ret = -ENOMEM; in main()
485 ret = read_sysfs_string("name", dev_dir_name, device_name); in main()
487 fprintf(stderr, "Failed to read name of device %d\n", dev_num); in main()
493 printf("trigger-less mode selected\n"); in main()
498 return -ENOMEM; in main()
502 ret = -ENOMEM; in main()
505 ret = read_sysfs_string("name", trig_dev_name, trigger_name); in main()
508 fprintf(stderr, "Failed to read trigger%d name from\n", trig_num); in main()
511 printf("iio trigger number being used is %d\n", trig_num); in main()
515 * Build the trigger name. If it is device associated in main()
516 * its name is <device_name>_dev[n] where n matches in main()
520 "%s-dev%d", device_name, dev_num); in main()
522 ret = -ENOMEM; in main()
527 /* Look for this "-devN" trigger */ in main()
528 trig_num = find_type_by_name(trigger_name, "trigger"); in main()
530 /* OK try the simpler "-trigger" suffix instead */ in main()
533 "%s-trigger", device_name); in main()
535 ret = -ENOMEM; in main()
540 trig_num = find_type_by_name(trigger_name, "trigger"); in main()
542 fprintf(stderr, "Failed to find the trigger %s\n", in main()
548 printf("iio trigger number being used is %d\n", trig_num); in main()
563 fprintf(stderr, "Auto-channels selected but some channels " in main()
591 "auto-enabling, giving up\n"); in main()
601 "/*_en or pass -a to autoenable channels and " in main()
603 ret = -ENOENT; in main()
608 * Construct the directory name for the associated buffer. in main()
615 ret = -ENOMEM; in main()
622 ret = -errno; in main()
628 ret = -EFAULT; in main()
635 * Set the device trigger to be the data ready trigger found in main()
638 ret = write_sysfs_string_and_verify("trigger/current_trigger", in main()
650 ret = -ENOMEM; in main()
656 if (fd == -1) { /* TODO: If it isn't there make the node */ in main()
657 ret = -errno; in main()
666 if (ret == -1 || buf_fd == -1) { in main()
667 ret = -errno; in main()
668 if (ret == -ENODEV || ret == -EINVAL) in main()
687 buf_dir_name, strerror(-ret)); in main()
696 ret = -EFAULT; in main()
703 ret = -ENOMEM; in main()
715 if (read_size > -1 || errno != EBUSY) { in main()
716 ret = -EFAULT; in main()
723 if (close(fd) == -1) in main()
725 fd = -1; in main()
734 ret = poll(&pfd, 1, -1); in main()
736 ret = -errno; in main()
765 if (fd >= 0 && close(fd) == -1) in main()
767 if (buf_fd >= 0 && close(buf_fd) == -1) in main()
772 for (i = num_channels - 1; i >= 0; i--) { in main()
773 free(channels[i].name); in main()