Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 8354ca6 in mainline


Ignore:
Timestamp:
2012-04-04T17:00:23Z (10 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master
Children:
aeb49e9
Parents:
f7a0779
Message:

date: Do not use devman_* functions to connect to the device

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/date/date.c

    rf7a0779 r8354ca6  
    4444        size_t svc_cnt;
    4545        service_id_t  *svc_ids = NULL;
     46        service_id_t svc_id;
    4647        char *svc_name = NULL;
    47         char *devpath;
    48         devman_handle_t devh;
    4948        struct tm t;
    5049
     
    7877        }
    7978
    80         const char delim = '/';
    81         devpath = str_chr(svc_name, delim);
    82 
    83         if (!devpath) {
    84                 printf(NAME ": Device name format not recognized\n");
     79        /* Get the service id for the device */
     80        rc = loc_service_get_id(svc_name, &svc_id, 0);
     81        if (rc != EOK) {
     82                printf(NAME ": Cannot get the service id for device %s",
     83                    svc_name);
    8584                goto exit;
    8685        }
    8786
    88         /* Skip the delimiter */
    89         devpath++;
    90 
    91         printf("Found device %s\n", devpath);
    92 
    93         /* Get the device's handle */
    94         rc = devman_fun_get_handle("/hw/pci0/00:01.0/cmos-rtc/a", &devh,
    95             IPC_FLAG_BLOCKING);
    96         if (rc != EOK) {
    97                 printf(NAME ": Cannot open the device\n");
    98                 goto exit;
    99         }
    100 
    101         /* Now connect to the device */
    102         async_sess_t *sess = devman_device_connect(EXCHANGE_SERIALIZE,
    103             devh, IPC_FLAG_BLOCKING);
     87        /* Connect to the device */
     88        async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE,
     89            svc_id, 0);
    10490        if (!sess) {
    10591                printf(NAME ": Cannot connect to the device\n");
     
    10793        }
    10894
    109         /* Read the current date */
     95        /* Read the current date/time */
    11096        rc = clock_dev_time_get(sess, &t);
    11197        if (rc != EOK) {
Note: See TracChangeset for help on using the changeset viewer.