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

Changeset 979c5729 in mainline


Ignore:
Timestamp:
2011-12-09T17:32:42Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
f44ba92
Parents:
dd28c1a
Message:

i8042: Rework name assignment.

NOTE: The code still works as a device service.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/char/i8042/i8042.c

    rdd28c1a r979c5729  
    116116int main(int argc, char *argv[])
    117117{
    118         char name[16];
    119         int i, rc;
    120         const char dchar[MAX_DEVS] = { 'a', 'b' };
    121 
    122118        printf(NAME ": i8042 PS/2 port driver\n");
    123119
    124         rc = loc_server_register(NAME, i8042_connection);
     120        int rc = loc_server_register(NAME, i8042_connection);
    125121        if (rc < 0) {
    126122                printf(NAME ": Unable to register server.\n");
     
    131127                return -1;
    132128
    133         for (i = 0; i < MAX_DEVS; i++) {
     129        for (int i = 0; i < MAX_DEVS; i++) {
    134130                device.port[i].client_sess = NULL;
    135131
    136                 snprintf(name, 16, "%s/ps2%c", NAMESPACE, dchar[i]);
    137                 rc = loc_service_register(name, &device.port[i].service_id);
     132                static const char *names[MAX_DEVS] = {
     133                    NAMESPACE "/ps2a", NAMESPACE "/ps2b"};
     134                rc = loc_service_register(names[i], &device.port[i].service_id);
    138135                if (rc != EOK) {
    139                         printf(NAME ": Unable to register device %s.\n", name);
     136                        printf(NAME ": Unable to register device %s.\n",
     137                            names[i]);
    140138                        return rc;
    141139                }
    142                 printf(NAME ": Registered device %s\n", name);
     140                printf(NAME ": Registered device %s\n", names[i]);
    143141        }
    144142
Note: See TracChangeset for help on using the changeset viewer.