49 fprintf(stderr,
"Could not get register.\n");
59 fprintf(stderr,
"Could not set register.\n");
65 int usage(
int argc,
char **argv)
67 fprintf(stderr,
"Usage: %s <camera_url> # Read all imager register\n", argv[0]);
68 fprintf(stderr,
" %s <camera_url> <register> # Read an imager registers\n", argv[0]);
69 fprintf(stderr,
" %s <camera_url> <register> <value> # Write an imager register\n", argv[0]);
70 fprintf(stderr,
" %s <camera_url> stresstest <register> # Repeatedly reads imager register\n", argv[0]);
71 fprintf(stderr,
" %s <camera_url> stresstest <register> <value> # Repeatedly writes value to imager register\n", argv[0]);
72 fprintf(stderr,
"Notes:\n");
73 fprintf(stderr,
"- All <register> and <value> values are in hexadecimal.\n");
74 fprintf(stderr,
"- This tool will never reconfigure the camera's IP address to allow its use during image streaming.\n");
75 fprintf(stderr,
"- Register accesses during image streaming may cause interruptions in the streaming.\n");
79 int main(
int argc,
char** argv)
84 char **nextarg = argv + 1;
90 if (nextarg == endarg || !strcmp(*nextarg,
"--help"))
91 return usage(argc, argv);
92 const char *camera_url = *nextarg++;
100 fprintf(stderr,
"Matching URL %s : %s\n", camera_url, errmsg);
104 if (nextarg == endarg)
106 for (
int i = 0; i < 256; i++)
109 fprintf(stderr,
"%02x: ", i);
112 fprintf(stderr,
"- ");
116 fprintf(stderr,
"??");
118 fprintf(stderr,
"%04x ", value);
120 if ((i + 1) % 16 == 0)
121 fprintf(stderr,
"\n");
126 if (!strcmp(*nextarg,
"stresstest"))
129 if (++nextarg == endarg)
130 return usage(argc, argv);
137 sscanf(*nextarg++,
"%hhx", ®);
139 if (nextarg != endarg)
141 sscanf(*nextarg++,
"%hx", &val);
145 if (nextarg != endarg)
146 return usage(argc, argv);
148 if (stress && !write)
154 fprintf(stderr,
"Count %i reg %02x read: %04x\n", count++, reg, oldval);
165 fprintf(stderr,
"Count %i Reg %02x was: %04x set: %04x read: %04x\n", count++, reg, oldval, val, newval);
176 fprintf(stderr,
"Reg %02x was: %04x set: %04x read: %04x\n", reg, oldval, val, newval);
179 fprintf(stderr,
"Reg %02x read: %04x\n", reg, oldval);
int sensorwrite(IpCamList *camera, uint8_t reg, uint16_t val)
int sensorread(IpCamList *camera, uint8_t reg)
int wge100ReliableSensorRead(const IpCamList *camInfo, uint8_t reg, uint16_t *data, int *retries)
int wge100ReliableSensorWrite(const IpCamList *camInfo, uint8_t reg, uint16_t data, int *retries)
int wge100FindByUrl(const char *url, IpCamList *camera, unsigned wait_us, const char **errmsg)
int main(int argc, char **argv)
int usage(int argc, char **argv)