summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
398b854)
uint8_t enhancedFxn;
} cp2103_port_config_t;
uint8_t enhancedFxn;
} cp2103_port_config_t;
+int cpConnect(char* device)
- int fd = open("/dev/usb/tts/0", O_RDWR);
+ int fd = open(device, O_RDWR);
if (fd < 0) {
fprintf(stderr, "cannot open tty\n");
return -1;
if (fd < 0) {
fprintf(stderr, "cannot open tty\n");
return -1;
+int main(int argc, char* argv[])
{
int fd;
cp2103_port_config_t config;
{
int fd;
cp2103_port_config_t config;
- if ((fd = cpConnect()) < 0)
+ if (argc != 2) {
+ fprintf(stderr, "usage: %s <tty>\n", argv[0]);
+ return 1;
+ }
+
+ /* open */
+ if ((fd = cpConnect(argv[1])) < 0)
return 1;
/* Read the current port configuration */
return 1;
/* Read the current port configuration */
printf("disconnected\n");
for (i = 0; i < 10; i++) {
sleep(1);
printf("disconnected\n");
for (i = 0; i < 10; i++) {
sleep(1);
- if ((fd = cpConnect()) >= 0)
+ if ((fd = cpConnect(argv[1])) >= 0)