Changeset f66ca57f in mainline for uspace/srv/hid/isdv4_tablet/main.c


Ignore:
Timestamp:
2012-08-15T15:10:53Z (12 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
affaf2e
Parents:
1499564
Message:

Rename wacomdump to isdv4_tablet and register with unique service name.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/isdv4_tablet/main.c

    r1499564 rf66ca57f  
    3535#include <abi/ipc/methods.h>
    3636#include <ipc/mouseev.h>
     37#include <inttypes.h>
    3738
    3839#include "isdv4.h"
    3940
    40 #define NAME "wacomdump"
     41#define NAME "isdv4_tablet"
    4142
    4243static async_sess_t *client_sess = NULL;
     
    4647static void syntax_print(void)
    4748{
    48         fprintf(stderr, "Usage: wacomdump [--baud=<baud>] [--print-events] [device_service]\n");
     49        fprintf(stderr, "Usage: %s [--baud=<baud>] [--print-events] [device_service]\n", NAME);
    4950}
    5051
     
    175176        sysarg_t baud = 38400;
    176177        service_id_t svc_id;
     178        char *serial_port_name = NULL;
    177179
    178180        int arg = 1;
     
    205207
    206208        if (argc > arg) {
    207                 rc = loc_service_get_id(argv[arg], &svc_id, 0);
     209                serial_port_name = argv[arg];
     210                rc = loc_service_get_id(serial_port_name, &svc_id, 0);
    208211                if (rc != EOK) {
    209212                        fprintf(stderr, "Cannot find device service %s\n",
     
    238241
    239242                svc_id = svc_ids[0];
     243
     244                rc = loc_service_get_name(svc_id, &serial_port_name);
     245                if (rc != EOK) {
     246                        fprintf(stderr, "Failed getting name of serial service\n");
     247                        return 1;
     248                }
     249
    240250                free(svc_ids);
    241251        }
     
    248258
    249259        fibril_mutex_initialize(&client_mutex);
     260
     261        printf(NAME ": Using serial port %s\n", serial_port_name);
    250262
    251263        async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE, svc_id,
     
    301313
    302314        service_id_t service_id;
    303         rc = loc_service_register("mouse/wacom", &service_id);
    304         if (rc != EOK) {
    305                 printf(NAME ": Unable to register device mouse/wacom.\n");
     315        char *service_name;
     316        rc = asprintf(&service_name, "mouse/isdv4-%" PRIun, svc_id);
     317        if (rc < 0) {
     318                printf(NAME ": Unable to create service name\n");
     319                return rc;
     320        }
     321
     322        rc = loc_service_register(service_name, &service_id);
     323        if (rc != EOK) {
     324                printf(NAME ": Unable to register service %s.\n", service_name);
    306325                return rc;
    307326        }
Note: See TracChangeset for help on using the changeset viewer.