Changeset 19a1800 in mainline for uspace/app


Ignore:
Timestamp:
2011-03-01T22:20:56Z (15 years ago)
Author:
Matej Klonfar <maklf@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e24e7b1
Parents:
976f546 (diff), ac8285d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge with the current development

Location:
uspace/app
Files:
4 added
1 deleted
37 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/cat/cat.c

    r976f546 r19a1800  
    144144                        return CMD_SUCCESS;
    145145                case 'H':
    146                         printf(cat_oops);
     146                        printf("%s", cat_oops);
    147147                        return CMD_FAILURE;
    148148                case 't':
    149                         printf(cat_oops);
     149                        printf("%s", cat_oops);
    150150                        return CMD_FAILURE;
    151151                case 'b':
    152                         printf(cat_oops);
     152                        printf("%s", cat_oops);
    153153                        break;
    154154                case 'm':
    155                         printf(cat_oops);
     155                        printf("%s", cat_oops);
    156156                        return CMD_FAILURE;
    157157                }
  • uspace/app/bdsh/cmds/modules/rm/rm.c

    r976f546 r19a1800  
    227227                }
    228228                memset(buff, 0, sizeof(buff));
    229                 snprintf(buff, len, argv[i]);
     229                snprintf(buff, len, "%s", argv[i]);
    230230
    231231                scope = rm_scope(buff);
  • uspace/app/init/init.c

    r976f546 r19a1800  
    3737#include <stdio.h>
    3838#include <unistd.h>
    39 #include <ipc/ipc.h>
    4039#include <vfs/vfs.h>
    4140#include <bool.h>
  • uspace/app/klog/klog.c

    r976f546 r19a1800  
    3636
    3737#include <stdio.h>
    38 #include <ipc/ipc.h>
    3938#include <async.h>
    40 #include <ipc/services.h>
    4139#include <as.h>
    42 #include <sysinfo.h>
     40#include <ddi.h>
    4341#include <event.h>
    4442#include <errno.h>
    4543#include <str_error.h>
    4644#include <io/klog.h>
     45#include <sysinfo.h>
    4746
    4847#define NAME       "klog"
     
    7978int main(int argc, char *argv[])
    8079{
    81         size_t klog_pages;
    82         if (sysinfo_get_value("klog.pages", &klog_pages) != EOK) {
    83                 printf("%s: Error getting klog address\n", NAME);
    84                 return -1;
     80        size_t pages;
     81        int rc = sysinfo_get_value("klog.pages", &pages);
     82        if (rc != EOK) {
     83                fprintf(stderr, "%s: Unable to get number of klog pages\n",
     84                    NAME);
     85                return rc;
    8586        }
    8687       
    87         size_t klog_size = klog_pages * PAGE_SIZE;
    88         klog_length = klog_size / sizeof(wchar_t);
    89        
    90         klog = (wchar_t *) as_get_mappable_page(klog_size);
    91         if (klog == NULL) {
    92                 printf("%s: Error allocating memory area\n", NAME);
    93                 return -1;
     88        uintptr_t faddr;
     89        rc = sysinfo_get_value("klog.faddr", &faddr);
     90        if (rc != EOK) {
     91                fprintf(stderr, "%s: Unable to get klog physical address\n",
     92                    NAME);
     93                return rc;
    9494        }
    9595       
    96         int res = async_share_in_start_1_0(PHONE_NS, (void *) klog,
    97             klog_size, SERVICE_MEM_KLOG);
    98         if (res != EOK) {
    99                 printf("%s: Error initializing memory area\n", NAME);
    100                 return -1;
     96        size_t size = pages * PAGE_SIZE;
     97        klog_length = size / sizeof(wchar_t);
     98       
     99        klog = (wchar_t *) as_get_mappable_page(size);
     100        if (klog == NULL) {
     101                fprintf(stderr, "%s: Unable to allocate virtual memory area\n",
     102                    NAME);
     103                return ENOMEM;
    101104        }
    102105       
    103         if (event_subscribe(EVENT_KLOG, 0) != EOK) {
    104                 printf("%s: Error registering klog notifications\n", NAME);
    105                 return -1;
     106        rc = physmem_map((void *) faddr, (void *) klog, pages,
     107            AS_AREA_READ | AS_AREA_CACHEABLE);
     108        if (rc != EOK) {
     109                fprintf(stderr, "%s: Unable to map klog\n", NAME);
     110                return rc;
     111        }
     112       
     113        rc = event_subscribe(EVENT_KLOG, 0);
     114        if (rc != EOK) {
     115                fprintf(stderr, "%s: Unable to register klog notifications\n",
     116                    NAME);
     117                return rc;
    106118        }
    107119       
     
    109121         * Mode "a" would be definitively much better here, but it is
    110122         * not well supported by the FAT driver.
    111          *
    112123         */
    113124        log = fopen(LOG_FNAME, "w");
  • uspace/app/ping/ping.c

    r976f546 r19a1800  
    3535 */
    3636
     37#include <async.h>
    3738#include <stdio.h>
    3839#include <str.h>
    3940#include <task.h>
    4041#include <time.h>
    41 #include <ipc/ipc.h>
    4242#include <ipc/services.h>
    4343#include <str_error.h>
     
    340340            config.dest_str, config.size, config.size);
    341341       
    342         int icmp_phone = icmp_connect_module(SERVICE_ICMP, ICMP_CONNECT_TIMEOUT);
     342        int icmp_phone = icmp_connect_module(ICMP_CONNECT_TIMEOUT);
    343343        if (icmp_phone < 0) {
    344344                fprintf(stderr, "%s: Unable to connect to ICMP service (%s)\n", NAME,
     
    355355                            str_error(ret));
    356356                       
    357                         ipc_hangup(icmp_phone);
     357                        async_hangup(icmp_phone);
    358358                        return ret;
    359359                }
     
    370370                            str_error(ret));
    371371                       
    372                         ipc_hangup(icmp_phone);
     372                        async_hangup(icmp_phone);
    373373                        return ret;
    374374                }
     
    390390        }
    391391       
    392         ipc_hangup(icmp_phone);
     392        async_hangup(icmp_phone);
    393393       
    394394        return 0;
  • uspace/app/stats/stats.c

    r976f546 r19a1800  
    11/*
    22 * Copyright (c) 2010 Stanislav Kozina
     3 * Copyright (c) 2010 Martin Decky
    34 * All rights reserved.
    45 *
     
    3637
    3738#include <stdio.h>
     39#include <task.h>
     40#include <thread.h>
    3841#include <stats.h>
    39 #include <sys/time.h>
     42#include <errno.h>
     43#include <stdlib.h>
     44#include <malloc.h>
    4045#include <inttypes.h>
    41 #include <malloc.h>
    42 
    43 #define NAME  "sysstat"
     46#include <bool.h>
     47#include <str.h>
     48#include <arg_parse.h>
     49
     50#define NAME  "stats"
    4451
    4552#define DAY     86400
     
    4754#define MINUTE  60
    4855
    49 int main(int argc, char *argv[])
    50 {
    51         struct timeval time;
    52         if (gettimeofday(&time, NULL) != 0) {
    53                 fprintf(stderr, "%s: Cannot get time of day\n", NAME);
    54                 return -1;
    55         }
    56        
    57         uint64_t sec = time.tv_sec;
    58         printf("%02" PRIu64 ":%02" PRIu64 ":%02" PRIu64,
    59             (sec % DAY) / HOUR, (sec % HOUR) / MINUTE, sec % MINUTE);
    60        
     56static void list_tasks(void)
     57{
     58        size_t count;
     59        stats_task_t *stats_tasks = stats_get_tasks(&count);
     60       
     61        if (stats_tasks == NULL) {
     62                fprintf(stderr, "%s: Unable to get tasks\n", NAME);
     63                return;
     64        }
     65       
     66        printf("[taskid] [thrds] [resident] [virtual] [ucycles]"
     67            " [kcycles] [name\n");
     68       
     69        size_t i;
     70        for (i = 0; i < count; i++) {
     71                uint64_t resmem, virtmem, ucycles, kcycles;
     72                char resmem_suffix, virtmem_suffix, usuffix, ksuffix;
     73               
     74                order_suffix(stats_tasks[i].resmem, &resmem, &resmem_suffix);
     75                order_suffix(stats_tasks[i].virtmem, &virtmem, &virtmem_suffix);
     76                order_suffix(stats_tasks[i].ucycles, &ucycles, &usuffix);
     77                order_suffix(stats_tasks[i].kcycles, &kcycles, &ksuffix);
     78               
     79                printf("%-8" PRIu64 " %7zu %9" PRIu64 "%c %8" PRIu64 "%c"
     80                    " %8" PRIu64 "%c %8" PRIu64 "%c %s\n",
     81                    stats_tasks[i].task_id, stats_tasks[i].threads,
     82                    resmem, resmem_suffix, virtmem, virtmem_suffix,
     83                    ucycles, usuffix, kcycles, ksuffix, stats_tasks[i].name);
     84        }
     85       
     86        free(stats_tasks);
     87}
     88
     89static void list_threads(task_id_t task_id, bool all)
     90{
     91        size_t count;
     92        stats_thread_t *stats_threads = stats_get_threads(&count);
     93       
     94        if (stats_threads == NULL) {
     95                fprintf(stderr, "%s: Unable to get threads\n", NAME);
     96                return;
     97        }
     98       
     99        printf("[taskid] [threadid] [state ] [prio] [cpu ] [ucycles] [kcycles]\n");
     100       
     101        size_t i;
     102        for (i = 0; i < count; i++) {
     103                if ((all) || (stats_threads[i].task_id == task_id)) {
     104                        uint64_t ucycles, kcycles;
     105                        char usuffix, ksuffix;
     106                       
     107                        order_suffix(stats_threads[i].ucycles, &ucycles, &usuffix);
     108                        order_suffix(stats_threads[i].kcycles, &kcycles, &ksuffix);
     109                       
     110                        printf("%-8" PRIu64 " %-10" PRIu64 " %-8s %6d ",
     111                            stats_threads[i].task_id, stats_threads[i].thread_id,
     112                            thread_get_state(stats_threads[i].state),
     113                            stats_threads[i].priority);
     114                       
     115                        if (stats_threads[i].on_cpu)
     116                                printf("%6u ", stats_threads[i].cpu);
     117                        else
     118                                printf("(none) ");
     119                       
     120                        printf("%8" PRIu64"%c %8" PRIu64"%c\n",
     121                            ucycles, usuffix, kcycles, ksuffix);
     122                }
     123        }
     124       
     125        free(stats_threads);
     126}
     127
     128static void list_cpus(void)
     129{
     130        size_t count;
     131        stats_cpu_t *cpus = stats_get_cpus(&count);
     132       
     133        if (cpus == NULL) {
     134                fprintf(stderr, "%s: Unable to get CPU statistics\n", NAME);
     135                return;
     136        }
     137       
     138        printf("[id] [MHz     ] [busy cycles] [idle cycles]\n");
     139       
     140        size_t i;
     141        for (i = 0; i < count; i++) {
     142                printf("%-4u ", cpus[i].id);
     143                if (cpus[i].active) {
     144                        uint64_t bcycles, icycles;
     145                        char bsuffix, isuffix;
     146                       
     147                        order_suffix(cpus[i].busy_cycles, &bcycles, &bsuffix);
     148                        order_suffix(cpus[i].idle_cycles, &icycles, &isuffix);
     149                       
     150                        printf("%10" PRIu16 " %12" PRIu64 "%c %12" PRIu64 "%c\n",
     151                            cpus[i].frequency_mhz, bcycles, bsuffix,
     152                            icycles, isuffix);
     153                } else
     154                        printf("inactive\n");
     155        }
     156       
     157        free(cpus);
     158}
     159
     160static void print_load(void)
     161{
     162        size_t count;
     163        load_t *load = stats_get_load(&count);
     164       
     165        if (load == NULL) {
     166                fprintf(stderr, "%s: Unable to get load\n", NAME);
     167                return;
     168        }
     169       
     170        printf("%s: Load average: ", NAME);
     171       
     172        size_t i;
     173        for (i = 0; i < count; i++) {
     174                if (i > 0)
     175                        printf(" ");
     176               
     177                stats_print_load_fragment(load[i], 2);
     178        }
     179       
     180        printf("\n");
     181       
     182        free(load);
     183}
     184
     185static void print_uptime(void)
     186{
    61187        sysarg_t uptime = stats_get_uptime();
    62         printf(", up %" PRIun " days, %" PRIun " hours, "
    63             "%" PRIun " minutes, %" PRIun " seconds",
     188        printf("%s: Up %" PRIun " days, %" PRIun " hours, "
     189            "%" PRIun " minutes, %" PRIun " seconds\n", NAME,
    64190            uptime / DAY, (uptime % DAY) / HOUR,
    65191            (uptime % HOUR) / MINUTE, uptime % MINUTE);
    66        
    67         size_t count;
    68         load_t *load = stats_get_load(&count);
    69         if (load != NULL) {
    70                 printf(", load average: ");
    71                
    72                 size_t i;
    73                 for (i = 0; i < count; i++) {
    74                         if (i > 0)
    75                                 printf(" ");
    76                        
    77                         stats_print_load_fragment(load[i], 2);
    78                 }
    79                
    80                 free(load);
    81         }
    82        
    83         printf("\n");
     192}
     193
     194static void usage(const char *name)
     195{
     196        printf(
     197            "Usage: %s [-t task_id] [-a] [-c] [-l] [-u]\n" \
     198            "\n" \
     199            "Options:\n" \
     200            "\t-t task_id\n" \
     201            "\t--task=task_id\n" \
     202            "\t\tList threads of the given task\n" \
     203            "\n" \
     204            "\t-a\n" \
     205            "\t--all\n" \
     206            "\t\tList all threads\n" \
     207            "\n" \
     208            "\t-c\n" \
     209            "\t--cpus\n" \
     210            "\t\tList CPUs\n" \
     211            "\n" \
     212            "\t-l\n" \
     213            "\t--load\n" \
     214            "\t\tPrint system load\n" \
     215            "\n" \
     216            "\t-u\n" \
     217            "\t--uptime\n" \
     218            "\t\tPrint system uptime\n" \
     219            "\n" \
     220            "\t-h\n" \
     221            "\t--help\n" \
     222            "\t\tPrint this usage information\n"
     223            "\n" \
     224            "Without any options all tasks are listed\n",
     225            name
     226        );
     227}
     228
     229int main(int argc, char *argv[])
     230{
     231        bool toggle_tasks = true;
     232        bool toggle_threads = false;
     233        bool toggle_all = false;
     234        bool toggle_cpus = false;
     235        bool toggle_load = false;
     236        bool toggle_uptime = false;
     237       
     238        task_id_t task_id = 0;
     239       
     240        int i;
     241        for (i = 1; i < argc; i++) {
     242                int off;
     243               
     244                /* Usage */
     245                if ((off = arg_parse_short_long(argv[i], "-h", "--help")) != -1) {
     246                        usage(argv[0]);
     247                        return 0;
     248                }
     249               
     250                /* All threads */
     251                if ((off = arg_parse_short_long(argv[i], "-a", "--all")) != -1) {
     252                        toggle_tasks = false;
     253                        toggle_threads = true;
     254                        toggle_all = true;
     255                        continue;
     256                }
     257               
     258                /* CPUs */
     259                if ((off = arg_parse_short_long(argv[i], "-c", "--cpus")) != -1) {
     260                        toggle_tasks = false;
     261                        toggle_cpus = true;
     262                        continue;
     263                }
     264               
     265                /* Threads */
     266                if ((off = arg_parse_short_long(argv[i], "-t", "--task=")) != -1) {
     267                        // TODO: Support for 64b range
     268                        int tmp;
     269                        int ret = arg_parse_int(argc, argv, &i, &tmp, off);
     270                        if (ret != EOK) {
     271                                printf("%s: Malformed task_id '%s'\n", NAME, argv[i]);
     272                                return -1;
     273                        }
     274                       
     275                        task_id = tmp;
     276                       
     277                        toggle_tasks = false;
     278                        toggle_threads = true;
     279                        continue;
     280                }
     281               
     282                /* Load */
     283                if ((off = arg_parse_short_long(argv[i], "-l", "--load")) != -1) {
     284                        toggle_tasks = false;
     285                        toggle_load = true;
     286                        continue;
     287                }
     288               
     289                /* Uptime */
     290                if ((off = arg_parse_short_long(argv[i], "-u", "--uptime")) != -1) {
     291                        toggle_tasks = false;
     292                        toggle_uptime = true;
     293                        continue;
     294                }
     295        }
     296       
     297        if (toggle_tasks)
     298                list_tasks();
     299       
     300        if (toggle_threads)
     301                list_threads(task_id, toggle_all);
     302       
     303        if (toggle_cpus)
     304                list_cpus();
     305       
     306        if (toggle_load)
     307                print_load();
     308       
     309        if (toggle_uptime)
     310                print_uptime();
     311       
    84312        return 0;
    85313}
  • uspace/app/taskdump/taskdump.c

    r976f546 r19a1800  
    3333 */
    3434
     35#include <async.h>
    3536#include <stdio.h>
    3637#include <stdlib.h>
    3738#include <unistd.h>
    38 #include <ipc/ipc.h>
    3939#include <errno.h>
    4040#include <udebug.h>
     
    105105
    106106        udebug_end(phoneid);
    107         ipc_hangup(phoneid);
     107        async_hangup(phoneid);
    108108
    109109        return 0;
     
    114114        int rc;
    115115
    116         rc = ipc_connect_kbox(task_id);
     116        rc = async_connect_kbox(task_id);
    117117
    118118        if (rc == ENOTSUP) {
     
    126126        if (rc < 0) {
    127127                printf("Error connecting\n");
    128                 printf("ipc_connect_task(%" PRIu64 ") -> %d ", task_id, rc);
     128                printf("async_connect_kbox(%" PRIu64 ") -> %d ", task_id, rc);
    129129                return rc;
    130130        }
     
    406406        }
    407407
     408        rc = asprintf(&file_name, "/drv/%s/%s", app_name, app_name);
     409        if (rc < 0) {
     410                printf("Memory allocation failure.\n");
     411                exit(1);
     412        }
     413
     414        rc = symtab_load(file_name, &app_symtab);
     415        if (rc == EOK) {
     416                printf("Loaded symbol table from %s\n", file_name);
     417                free(file_name);
     418                return;
     419        }
     420
    408421        free(file_name);
    409422        printf("Failed autoloading symbol table.\n");
  • uspace/app/tester/Makefile

    r976f546 r19a1800  
    5353        loop/loop1.c \
    5454        mm/malloc1.c \
     55        mm/mapping1.c \
    5556        hw/misc/virtchar1.c \
    5657        hw/serial/serial1.c
  • uspace/app/tester/adt/usbaddrkeep.c

    r976f546 r19a1800  
    2929#include <stdio.h>
    3030#include <stdlib.h>
    31 #include <usb/hcd.h>
     31#include <usb/addrkeep.h>
    3232#include <errno.h>
    3333#include "../tester.h"
  • uspace/app/tester/hw/misc/virtchar1.c

    r976f546 r19a1800  
    4747#include "../../tester.h"
    4848
    49 #define DEVICE_PATH_NORMAL "/dev/devices/\\virt\\null"
     49#define DEVICE_PATH_NORMAL "/dev/devices/\\virt\\null\\a"
    5050#define DEVICE_PATH_CLASSES "/dev/class/virt-null\\1"
    5151#define BUFFER_SIZE 64
     
    8989        /* Clean-up. */
    9090        TPRINTF(" Closing phones and file descriptors\n");
    91         ipc_hangup(phone);
     91        async_hangup(phone);
    9292        close(fd);
    9393       
  • uspace/app/tester/hw/serial/serial1.c

    r976f546 r19a1800  
    3939#include <stdlib.h>
    4040#include <stdio.h>
    41 #include <ipc/ipc.h>
    4241#include <sys/types.h>
    4342#include <async.h>
     
    7574       
    7675        devman_handle_t handle;
    77         res = devman_device_get_handle("/hw/pci0/00:01.0/com1", &handle,
     76        res = devman_device_get_handle("/hw/pci0/00:01.0/com1/a", &handle,
    7877            IPC_FLAG_BLOCKING);
    7978        if (res != EOK)
     
    8887        char *buf = (char *) malloc(cnt + 1);
    8988        if (buf == NULL) {
    90                 ipc_hangup(phone);
     89                async_hangup(phone);
    9190                devman_hangup_phone(DEVMAN_CLIENT);
    9291                return "Failed to allocate input buffer";
     
    9897        sysarg_t old_word_size;
    9998       
    100         res = ipc_call_sync_0_4(phone, SERIAL_GET_COM_PROPS, &old_baud,
     99        res = async_req_0_4(phone, SERIAL_GET_COM_PROPS, &old_baud,
    101100            &old_par, &old_word_size, &old_stop);
    102101        if (res != EOK) {
    103102                free(buf);
    104                 ipc_hangup(phone);
     103                async_hangup(phone);
    105104                devman_hangup_phone(DEVMAN_CLIENT);
    106105                return "Failed to get old serial communication parameters";
    107106        }
    108107       
    109         res = ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, 1200,
     108        res = async_req_4_0(phone, SERIAL_SET_COM_PROPS, 1200,
    110109            SERIAL_NO_PARITY, 8, 1);
    111110        if (EOK != res) {
    112111                free(buf);
    113                 ipc_hangup(phone);
     112                async_hangup(phone);
    114113                devman_hangup_phone(DEVMAN_CLIENT);
    115114                return "Failed to set serial communication parameters";
     
    124123               
    125124                if (read < 0) {
    126                         ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
     125                        async_req_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
    127126                            old_par, old_word_size, old_stop);
    128127                        free(buf);
    129                         ipc_hangup(phone);
     128                        async_hangup(phone);
    130129                        devman_hangup_phone(DEVMAN_CLIENT);
    131130                        return "Failed read from serial device";
     
    133132               
    134133                if ((size_t) read > cnt - total) {
    135                         ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
     134                        async_req_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
    136135                            old_par, old_word_size, old_stop);
    137136                        free(buf);
    138                         ipc_hangup(phone);
     137                        async_hangup(phone);
    139138                        devman_hangup_phone(DEVMAN_CLIENT);
    140139                        return "Read more data than expected";
     
    155154                       
    156155                        if (written < 0) {
    157                                 ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
     156                                async_req_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
    158157                                    old_par, old_word_size, old_stop);
    159158                                free(buf);
    160                                 ipc_hangup(phone);
     159                                async_hangup(phone);
    161160                                devman_hangup_phone(DEVMAN_CLIENT);
    162161                                return "Failed write to serial device";
     
    164163                       
    165164                        if (written != read) {
    166                                 ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
     165                                async_req_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
    167166                                    old_par, old_word_size, old_stop);
    168167                                free(buf);
    169                                 ipc_hangup(phone);
     168                                async_hangup(phone);
    170169                                devman_hangup_phone(DEVMAN_CLIENT);
    171170                                return "Written less data than read from serial device";
     
    183182        ssize_t written = char_dev_write(phone, (void *) EOT, eot_size);
    184183       
    185         ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
     184        async_req_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
    186185            old_par, old_word_size, old_stop);
    187186        free(buf);
    188         ipc_hangup(phone);
     187        async_hangup(phone);
    189188        devman_hangup_phone(DEVMAN_CLIENT);
    190189       
  • uspace/app/tester/tester.c

    r976f546 r19a1800  
    6262#include "loop/loop1.def"
    6363#include "mm/malloc1.def"
     64#include "mm/mapping1.def"
    6465#include "hw/serial/serial1.def"
    6566#include "adt/usbaddrkeep.def"
  • uspace/app/tester/tester.h

    r976f546 r19a1800  
    3838#include <sys/types.h>
    3939#include <bool.h>
    40 #include <ipc/ipc.h>
    4140
    4241#define IPC_TEST_SERVICE  10240
     
    7978extern const char *test_loop1(void);
    8079extern const char *test_malloc1(void);
     80extern const char *test_mapping1(void);
    8181extern const char *test_serial1(void);
    8282extern const char *test_usbaddrkeep(void);
  • uspace/app/tetris/screen.h

    r976f546 r19a1800  
    4848
    4949#include <sys/types.h>
    50 #include <ipc/ipc.h>
    5150#include <async.h>
    5251#include <bool.h>
  • uspace/app/top/screen.c

    r976f546 r19a1800  
    3737
    3838#include <stdio.h>
    39 #include <ipc/ipc.h>
    4039#include <io/console.h>
    4140#include <io/style.h>
     
    274273{
    275274        screen_style_inverted();
    276         printf("[taskid] [threads] [virtual] [%%virt] [%%user]"
    277             " [%%kernel] [name");
     275        printf("[taskid] [thrds] [resident] [%%resi] [virtual] [%%virt]"
     276            " [%%user] [%%kern] [name");
    278277        screen_newline();
    279278        screen_style_normal();
     
    295294                perc_task_t *perc = data->tasks_perc + data->tasks_map[i];
    296295               
     296                uint64_t resmem;
     297                char resmem_suffix;
     298                order_suffix(task->resmem, &resmem, &resmem_suffix);
     299               
    297300                uint64_t virtmem;
    298301                char virtmem_suffix;
    299302                order_suffix(task->virtmem, &virtmem, &virtmem_suffix);
    300303               
    301                 printf("%-8" PRIu64 " %9zu %8" PRIu64 "%c ", task->task_id,
    302                     task->threads, virtmem, virtmem_suffix);
     304                printf("%-8" PRIu64 " %7zu %9" PRIu64 "%c ",
     305                    task->task_id, task->threads, resmem, resmem_suffix);
     306                print_percent(perc->resmem, 2);
     307                printf(" %8" PRIu64 "%c ", virtmem, virtmem_suffix);
    303308                print_percent(perc->virtmem, 2);
    304309                puts(" ");
    305310                print_percent(perc->ucycles, 2);
    306                 puts("   ");
     311                puts(" ");
    307312                print_percent(perc->kcycles, 2);
    308313                puts(" ");
  • uspace/app/top/top.c

    r976f546 r19a1800  
    195195       
    196196        uint64_t virtmem_total = 0;
     197        uint64_t resmem_total = 0;
    197198        uint64_t ucycles_total = 0;
    198199        uint64_t kcycles_total = 0;
     
    223224               
    224225                virtmem_total += new_data->tasks[i].virtmem;
     226                resmem_total += new_data->tasks[i].resmem;
    225227                ucycles_total += new_data->ucycles_diff[i];
    226228                kcycles_total += new_data->kcycles_diff[i];
     
    232234                FRACTION_TO_FLOAT(new_data->tasks_perc[i].virtmem,
    233235                    new_data->tasks[i].virtmem * 100, virtmem_total);
     236                FRACTION_TO_FLOAT(new_data->tasks_perc[i].resmem,
     237                    new_data->tasks[i].resmem * 100, resmem_total);
    234238                FRACTION_TO_FLOAT(new_data->tasks_perc[i].ucycles,
    235239                    new_data->ucycles_diff[i] * 100, ucycles_total);
  • uspace/app/top/top.h

    r976f546 r19a1800  
    7777typedef struct {
    7878        fixed_float virtmem;
     79        fixed_float resmem;
    7980        fixed_float ucycles;
    8081        fixed_float kcycles;
  • uspace/app/trace/ipc_desc.c

    r976f546 r19a1800  
    3333 */
    3434
     35#include <ipc/common.h>
    3536#include <stdlib.h>
    36 #include <ipc/ipc.h>
    3737#include "ipc_desc.h"
    3838
  • uspace/app/trace/ipcp.h

    r976f546 r19a1800  
    3636#define IPCP_H_
    3737
    38 #include <ipc/ipc.h>
    3938#include "proto.h"
    4039
  • uspace/app/trace/proto.c

    r976f546 r19a1800  
    3535#include <stdio.h>
    3636#include <stdlib.h>
    37 #include <ipc/ipc.h>
    3837#include <adt/hash_table.h>
    3938
  • uspace/app/trace/proto.h

    r976f546 r19a1800  
    3636#define PROTO_H_
    3737
     38#include <ipc/common.h>
    3839#include <adt/hash_table.h>
    39 #include <ipc/ipc.h>
    4040#include "trace.h"
    4141
  • uspace/app/trace/syscalls.c

    r976f546 r19a1800  
    6464    [SYS_IPC_POKE] = { "ipc_poke",                      0,      V_ERRNO },
    6565    [SYS_IPC_HANGUP] = { "ipc_hangup",                  1,      V_ERRNO },
    66     [SYS_IPC_REGISTER_IRQ] = { "ipc_register_irq",      4,      V_ERRNO },
    67     [SYS_IPC_UNREGISTER_IRQ] = { "ipc_unregister_irq",  2,      V_ERRNO },
    6866
    6967    [SYS_EVENT_SUBSCRIBE] = { "event_subscribe",        2,      V_ERRNO },
     
    7371    [SYS_PHYSMEM_MAP] = { "physmem_map",                4,      V_ERRNO },
    7472    [SYS_IOSPACE_ENABLE] = { "iospace_enable",          1,      V_ERRNO },
     73    [SYS_REGISTER_IRQ] = { "register_irq",      4,      V_ERRNO },
     74    [SYS_UNREGISTER_IRQ] = { "unregister_irq",  2,      V_ERRNO },
    7575
    7676    [SYS_SYSINFO_GET_TAG] = { "sysinfo_get_tag",                2,      V_INTEGER },
    7777    [SYS_SYSINFO_GET_VALUE] = { "sysinfo_get_value",            3,      V_ERRNO },
    7878    [SYS_SYSINFO_GET_DATA_SIZE] = { "sysinfo_get_data_size",    3,      V_ERRNO },
    79     [SYS_SYSINFO_GET_DATA] = { "sysinfo_get_data",              4,      V_ERRNO },
     79    [SYS_SYSINFO_GET_DATA] = { "sysinfo_get_data",              5,      V_ERRNO },
    8080
    8181    [SYS_DEBUG_ENABLE_CONSOLE] = { "debug_enable_console", 0,   V_ERRNO },
  • uspace/app/trace/trace.c

    r976f546 r19a1800  
    3636#include <stdlib.h>
    3737#include <unistd.h>
    38 #include <ipc/ipc.h>
    3938#include <fibril.h>
    4039#include <errno.h>
     
    149148        int rc;
    150149
    151         rc = ipc_connect_kbox(task_id);
     150        rc = async_connect_kbox(task_id);
    152151
    153152        if (rc == ENOTSUP) {
     
    745744        abort_trace = true;
    746745        udebug_end(phoneid);
    747         ipc_hangup(phoneid);
     746        async_hangup(phoneid);
    748747
    749748        ipcp_cleanup();
  • uspace/app/usbinfo/dump.c

    r976f546 r19a1800  
    2727 */
    2828
    29 /** @addtogroup usb
     29/** @addtogroup usbinfo
    3030 * @{
    3131 */
    3232/**
    3333 * @file
    34  * @brief USB querying.
     34 * USB querying.
    3535 */
    3636
     
    4343#include <usb/usb.h>
    4444#include <usb/descriptor.h>
     45#include <usb/debug.h>
     46#include <usb/classes/classes.h>
    4547
    4648#include "usbinfo.h"
     
    5052#define BYTES_PER_LINE 12
    5153
    52 #define BCD_INT(a) (((unsigned int)(a)) / 256)
    53 #define BCD_FRAC(a) (((unsigned int)(a)) % 256)
    5454
    55 #define BCD_FMT "%x.%x"
    56 #define BCD_ARGS(a) BCD_INT((a)), BCD_FRAC((a))
     55const char *get_indent(size_t level)
     56{
     57        static const char *indents[] = {
     58                INDENT,
     59                INDENT INDENT,
     60                INDENT INDENT INDENT,
     61                INDENT INDENT INDENT INDENT,
     62                INDENT INDENT INDENT INDENT INDENT
     63        };
     64        static size_t indents_count = sizeof(indents)/sizeof(indents[0]);
     65        if (level >= indents_count) {
     66                return indents[indents_count - 1];
     67        }
     68        return indents[level];
     69}
    5770
    58 void dump_buffer(const char *msg, const uint8_t *buffer, size_t length)
     71void dump_buffer(const char *msg, size_t indent,
     72    const uint8_t *buffer, size_t length)
    5973{
    60         printf("%s\n", msg);
     74        if (msg != NULL) {
     75                printf("%s\n", msg);
     76        }
    6177
    6278        size_t i;
     79        if (length > 0) {
     80                printf("%s", get_indent(indent));
     81        }
    6382        for (i = 0; i < length; i++) {
    64                 printf("  0x%02X", buffer[i]);
     83                printf("0x%02X", buffer[i]);
    6584                if (((i > 0) && (((i+1) % BYTES_PER_LINE) == 0))
    6685                    || (i + 1 == length)) {
    6786                        printf("\n");
     87                        if (i + 1 < length) {
     88                                printf("%s", get_indent(indent));
     89                        }
     90                } else {
     91                        printf("  ");
    6892                }
    6993        }
     94}
     95
     96void dump_usb_descriptor(uint8_t *descriptor, size_t size)
     97{
     98        printf("Device descriptor:\n");
     99        usb_dump_standard_descriptor(stdout, get_indent(0), "\n",
     100            descriptor, size);
    70101}
    71102
     
    83114}
    84115
    85 void dump_standard_device_descriptor(usb_standard_device_descriptor_t *d)
    86 {
    87         printf("Standard device descriptor:\n");
    88 
    89         printf(INDENT "bLength = %d\n", d->length);
    90         printf(INDENT "bDescriptorType = 0x%02x\n", d->descriptor_type);
    91         printf(INDENT "bcdUSB = %d (" BCD_FMT ")\n", d->usb_spec_version,
    92             BCD_ARGS(d->usb_spec_version));
    93         printf(INDENT "bDeviceClass = 0x%02x\n", d->device_class);
    94         printf(INDENT "bDeviceSubClass = 0x%02x\n", d->device_subclass);
    95         printf(INDENT "bDeviceProtocol = 0x%02x\n", d->device_protocol);
    96         printf(INDENT "bMaxPacketSize0 = %d\n", d->max_packet_size);
    97         printf(INDENT "idVendor = %d\n", d->vendor_id);
    98         printf(INDENT "idProduct = %d\n", d->product_id);
    99         printf(INDENT "bcdDevice = %d\n", d->device_version);
    100         printf(INDENT "iManufacturer = %d\n", d->str_manufacturer);
    101         printf(INDENT "iProduct = %d\n", d->str_product);
    102         printf(INDENT "iSerialNumber = %d\n", d->str_serial_number);
    103         printf(INDENT "bNumConfigurations = %d\n", d->configuration_count);
    104 }
    105 
    106 void dump_standard_configuration_descriptor(
    107     int index, usb_standard_configuration_descriptor_t *d)
    108 {
    109         bool self_powered = d->attributes & 64;
    110         bool remote_wakeup = d->attributes & 32;
    111        
    112         printf("Standard configuration descriptor #%d\n", index);
    113         printf(INDENT "bLength = %d\n", d->length);
    114         printf(INDENT "bDescriptorType = 0x%02x\n", d->descriptor_type);
    115         printf(INDENT "wTotalLength = %d\n", d->total_length);
    116         printf(INDENT "bNumInterfaces = %d\n", d->interface_count);
    117         printf(INDENT "bConfigurationValue = %d\n", d->configuration_number);
    118         printf(INDENT "iConfiguration = %d\n", d->str_configuration);
    119         printf(INDENT "bmAttributes = %d [%s%s%s]\n", d->attributes,
    120             self_powered ? "self-powered" : "",
    121             (self_powered & remote_wakeup) ? ", " : "",
    122             remote_wakeup ? "remote-wakeup" : "");
    123         printf(INDENT "MaxPower = %d (%dmA)\n", d->max_power,
    124             2 * d->max_power);
    125         // printf(INDENT " = %d\n", d->);
    126 }
    127 
    128116static void dump_tree_descriptor(uint8_t *descriptor, size_t depth)
    129117{
    130118        if (descriptor == NULL) {
    131119                return;
    132         }
    133         while (depth > 0) {
    134                 printf("  ");
    135                 depth--;
    136120        }
    137121        int type = (int) *(descriptor + 1);
     
    151135#undef _TYPE
    152136        }
    153         printf("0x%02x (%s)\n", type, name);
     137        printf("%s%s (0x%02X):\n", get_indent(depth), name, type);
     138        usb_dump_standard_descriptor(stdout, get_indent(depth), "\n",
     139            descriptor, descriptor[0]);
    154140}
    155141
     
    172158        uint8_t *ptr = data->data;
    173159        printf("Descriptor tree:\n");
    174         dump_tree_internal(parser, data, ptr, 1);
     160        dump_tree_internal(parser, data, ptr, 0);
    175161}
    176162
  • uspace/app/usbinfo/info.c

    r976f546 r19a1800  
    2727 */
    2828
    29 /** @addtogroup usb
     29/** @addtogroup usbinfo
    3030 * @{
    3131 */
    3232/**
    3333 * @file
    34  * @brief
     34 * Dumping of generic device properties.
    3535 */
    3636#include <stdio.h>
    3737#include <str_error.h>
    3838#include <errno.h>
    39 #include <usb/usbdrv.h>
     39#include <usb/pipes.h>
     40#include <usb/recognise.h>
     41#include <usb/request.h>
    4042#include "usbinfo.h"
    4143
    42 int dump_device(int hc_phone, usb_address_t address)
     44int dump_device(devman_handle_t hc_handle, usb_address_t address)
    4345{
     46        int rc;
     47        usb_device_connection_t wire;
     48        usb_endpoint_pipe_t ctrl_pipe;
     49
     50        /*
     51         * Initialize pipes.
     52         */
     53        rc = usb_device_connection_initialize(&wire, hc_handle, address);
     54        if (rc != EOK) {
     55                fprintf(stderr,
     56                    NAME ": failed to create connection to the device: %s.\n",
     57                    str_error(rc));
     58                goto leave;
     59        }
     60        rc = usb_endpoint_pipe_initialize_default_control(&ctrl_pipe, &wire);
     61        if (rc != EOK) {
     62                fprintf(stderr,
     63                    NAME ": failed to create default control pipe: %s.\n",
     64                    str_error(rc));
     65                goto leave;
     66        }
     67        rc = usb_endpoint_pipe_start_session(&ctrl_pipe);
     68        if (rc != EOK) {
     69                fprintf(stderr,
     70                    NAME ": failed to start session on control pipe: %s.\n",
     71                    str_error(rc));
     72                goto leave;
     73        }
     74
    4475        /*
    4576         * Dump information about possible match ids.
     
    4778        match_id_list_t match_id_list;
    4879        init_match_ids(&match_id_list);
    49         int rc = usb_drv_create_device_match_ids(hc_phone, &match_id_list, address);
     80        rc = usb_device_create_match_ids(&ctrl_pipe, &match_id_list);
    5081        if (rc != EOK) {
    5182                fprintf(stderr,
    5283                    NAME ": failed to fetch match ids of the device: %s.\n",
    5384                    str_error(rc));
    54                 return rc;
     85                goto leave;
    5586        }
    5687        dump_match_ids(&match_id_list);
     
    6091         */
    6192        usb_standard_device_descriptor_t device_descriptor;
    62         usb_dprintf(NAME, 1,
    63             "usb_drv_req_get_device_descriptor(%d, %d, %p)\n",
    64             hc_phone, (int) address, &device_descriptor);
    65 
    66         rc = usb_drv_req_get_device_descriptor(hc_phone, address,
    67             &device_descriptor);
     93        rc = usb_request_get_device_descriptor(&ctrl_pipe, &device_descriptor);
    6894        if (rc != EOK) {
    6995                fprintf(stderr,
    7096                    NAME ": failed to fetch standard device descriptor: %s.\n",
    7197                    str_error(rc));
    72                 return rc;
    73         }
    74         dump_standard_device_descriptor(&device_descriptor);
     98                goto leave;
     99        }
     100        dump_usb_descriptor((uint8_t *)&device_descriptor, sizeof(device_descriptor));
    75101
    76102        /*
     
    79105        usb_standard_configuration_descriptor_t config_descriptor;
    80106        int config_index = 0;
    81         usb_dprintf(NAME, 1,
    82             "usb_drv_req_get_bare_configuration_descriptor(%d, %d, %d, %p)\n",
    83             hc_phone, (int) address, config_index, &config_descriptor);
    84 
    85         rc = usb_drv_req_get_bare_configuration_descriptor(hc_phone, address,
    86             config_index, &config_descriptor );
     107        rc = usb_request_get_bare_configuration_descriptor(&ctrl_pipe,
     108            config_index, &config_descriptor);
    87109        if (rc != EOK) {
    88110                fprintf(stderr,
    89111                    NAME ": failed to fetch standard configuration descriptor: %s.\n",
    90112                    str_error(rc));
    91                 return rc;
    92         }
    93         dump_standard_configuration_descriptor(config_index,
    94             &config_descriptor);
     113                goto leave;
     114        }
     115        //dump_standard_configuration_descriptor(config_index, &config_descriptor);
    95116
    96117        void *full_config_descriptor = malloc(config_descriptor.total_length);
    97         usb_dprintf(NAME, 1,
    98             "usb_drv_req_get_full_configuration_descriptor(%d, %d, %d, %p, %zu)\n",
    99             hc_phone, (int) address, config_index,
    100             full_config_descriptor, config_descriptor.total_length);
    101 
    102         rc = usb_drv_req_get_full_configuration_descriptor(hc_phone, address,
     118        rc = usb_request_get_full_configuration_descriptor(&ctrl_pipe,
    103119            config_index,
    104120            full_config_descriptor, config_descriptor.total_length, NULL);
     
    107123                    NAME ": failed to fetch full configuration descriptor: %s.\n",
    108124                    str_error(rc));
    109                 return rc;
    110         }
    111         dump_buffer("Full configuration descriptor:",
    112             full_config_descriptor, config_descriptor.total_length);
     125                goto leave;
     126        }
    113127
    114128        dump_descriptor_tree(full_config_descriptor,
    115129            config_descriptor.total_length);
    116130
    117         return EOK;
     131        /*
     132         * Get supported languages of STRING descriptors.
     133         */
     134        l18_win_locales_t *langs;
     135        size_t langs_count;
     136        rc = usb_request_get_supported_languages(&ctrl_pipe,
     137            &langs, &langs_count);
     138        if (rc != EOK) {
     139                fprintf(stderr,
     140                    NAME ": failed to get list of supported languages: %s.\n",
     141                    str_error(rc));
     142                goto skip_strings;
     143        }
     144
     145        printf("String languages (%zu):", langs_count);
     146        size_t i;
     147        for (i = 0; i < langs_count; i++) {
     148                printf(" 0x%04x", (int) langs[i]);
     149        }
     150        printf(".\n");
     151
     152        /*
     153         * Dump all strings in all available langages;
     154         */
     155        for (i = 0; i < langs_count; i++) {
     156                l18_win_locales_t lang = langs[i];
     157
     158                printf("%sStrings for language 0x%04x:\n", get_indent(0),
     159                    (int) lang);
     160
     161                /*
     162                 * Try all indexes - we will see what pops-up ;-).
     163                 * However, to speed things up, we will stop after
     164                 * encountering several broken (or nonexistent ones)
     165                 * descriptors in line.
     166                 */
     167                size_t idx;
     168                size_t failed_count = 0;
     169                for (idx = 1; idx < 0xFF; idx++) {
     170                        char *string;
     171                        rc = usb_request_get_string(&ctrl_pipe, idx, lang,
     172                            &string);
     173                        if (rc != EOK) {
     174                                failed_count++;
     175                                if (failed_count > 3) {
     176                                        break;
     177                                }
     178                                continue;
     179                        }
     180                        printf("%sString #%zu: \"%s\"\n", get_indent(1),
     181                            idx, string);
     182                        free(string);
     183                        failed_count = 0; /* Reset failed counter. */
     184                }
     185        }
     186
     187
     188skip_strings:
     189
     190        rc = EOK;
     191
     192leave:
     193        /* Ignoring errors here. */
     194        usb_endpoint_pipe_end_session(&ctrl_pipe);
     195
     196        return rc;
    118197}
    119198
  • uspace/app/usbinfo/main.c

    r976f546 r19a1800  
    2727 */
    2828
    29 /** @addtogroup usb
     29/** @addtogroup usbinfo
    3030 * @{
    3131 */
    3232/**
    3333 * @file
    34  * @brief USB querying.
     34 * USB querying.
    3535 */
    3636
     
    4343#include <devman.h>
    4444#include <devmap.h>
    45 #include <usb/usbdrv.h>
    4645#include "usbinfo.h"
    4746
     
    7776}
    7877
    79 static int set_new_host_controller(int *phone, const char *path)
     78static int get_host_controller_handle(const char *path,
     79    devman_handle_t *hc_handle)
    8080{
    8181        int rc;
    82         int tmp_phone;
    8382
    84         if (path[0] != '/') {
    85                 int hc_class_index = (int) strtol(path, NULL, 10);
    86                 char *dev_path;
    87                 rc = asprintf(&dev_path, "class/usbhc\\%d", hc_class_index);
    88                 if (rc < 0) {
    89                         internal_error(rc);
    90                         return rc;
    91                 }
    92                 devmap_handle_t handle;
    93                 rc = devmap_device_get_handle(dev_path, &handle, 0);
    94                 if (rc < 0) {
    95                         fprintf(stderr,
    96                             NAME ": failed getting handle of `devman://%s'.\n",
    97                             dev_path);
    98                         free(dev_path);
    99                         return rc;
    100                 }
    101                 tmp_phone = devmap_device_connect(handle, 0);
    102                 if (tmp_phone < 0) {
    103                         fprintf(stderr,
    104                             NAME ": could not connect to `%s'.\n",
    105                             dev_path);
    106                         free(dev_path);
    107                         return tmp_phone;
    108                 }
    109                 free(dev_path);
    110         } else {
    111                 devman_handle_t handle;
    112                 rc = devman_device_get_handle(path, &handle, 0);
    113                 if (rc != EOK) {
    114                         fprintf(stderr,
    115                             NAME ": failed getting handle of `devmap::/%s'.\n",
    116                             path);
    117                         return rc;
    118                 }
    119                 tmp_phone = devman_device_connect(handle, 0);
    120                 if (tmp_phone < 0) {
    121                         fprintf(stderr,
    122                             NAME ": could not connect to `%s'.\n",
    123                             path);
    124                         return tmp_phone;
    125                 }
     83        if (str_cmp(path, "uhci") == 0) {
     84                path = "/hw/pci0/00:01.2/uhci";
    12685        }
    12786
    128         *phone = tmp_phone;
     87        devman_handle_t handle;
     88        rc = devman_device_get_handle(path, &handle, 0);
     89        if (rc != EOK) {
     90                fprintf(stderr,
     91                    NAME ": failed getting handle of `devman::/%s'.\n",
     92                    path);
     93                return rc;
     94        }
     95        *hc_handle = handle;
    12996
    13097        return EOK;
    13198}
    13299
    133 static int connect_with_address(int hc_phone, const char *str_address)
     100static int get_device_address(const char *str_address, usb_address_t *address)
    134101{
    135         usb_address_t address = (usb_address_t) strtol(str_address, NULL, 0);
    136         if ((address < 0) || (address >= USB11_ADDRESS_MAX)) {
     102        usb_address_t addr = (usb_address_t) strtol(str_address, NULL, 0);
     103        if ((addr < 0) || (addr >= USB11_ADDRESS_MAX)) {
    137104                fprintf(stderr, NAME ": USB address out of range.\n");
    138105                return ERANGE;
    139106        }
    140107
    141         if (hc_phone < 0) {
    142                 fprintf(stderr, NAME ": no active host controller.\n");
    143                 return ENOENT;
    144         }
    145 
    146         return dump_device(hc_phone, address);
     108        *address = addr;
     109        return EOK;
    147110}
    148111
     
    150113int main(int argc, char *argv[])
    151114{
    152         int hc_phone = -1;
     115        devman_handle_t hc_handle = (devman_handle_t) -1;
     116        usb_address_t device_address = (usb_address_t) -1;
    153117
    154118        if (argc <= 1) {
     
    175139                        case 'a':
    176140                        case ACTION_DEVICE_ADDRESS: {
    177                                 int rc = connect_with_address(hc_phone, optarg);
     141                                int rc = get_device_address(optarg,
     142                                    &device_address);
    178143                                if (rc != EOK) {
    179144                                        return rc;
     
    184149                        case 't':
    185150                        case ACTION_HOST_CONTROLLER: {
    186                                 int rc = set_new_host_controller(&hc_phone,
    187                                     optarg);
     151                                int rc = get_host_controller_handle(optarg,
     152                                   &hc_handle);
    188153                                if (rc != EOK) {
    189154                                        return rc;
     
    202167        } while (i != -1);
    203168
     169        if ((hc_handle == (devman_handle_t) -1)
     170            || (device_address == (usb_address_t) -1)) {
     171                fprintf(stderr, NAME ": no target specified.\n");
     172                return EINVAL;
     173        }
     174
     175        dump_device(hc_handle, device_address);
     176
    204177        return 0;
    205178}
  • uspace/app/usbinfo/usbinfo.h

    r976f546 r19a1800  
    2727 */
    2828
    29 /** @addtogroup usb
     29/** @addtogroup usbinfo
    3030 * @{
    3131 */
    3232/** @file
    33  * @brief Common header for usbinfo application.
     33 * Common header for usbinfo application.
    3434 */
    3535#ifndef USBINFO_USBINFO_H_
     
    4444#define NAME "usbinfo"
    4545
    46 void dump_buffer(const char *, const uint8_t *, size_t);
     46void dump_buffer(const char *, size_t, const uint8_t *, size_t);
     47const char *get_indent(size_t);
    4748void dump_match_ids(match_id_list_t *matches);
    48 void dump_standard_device_descriptor(usb_standard_device_descriptor_t *);
    49 void dump_standard_configuration_descriptor(int,
    50     usb_standard_configuration_descriptor_t *);
    51 int dump_device(int, usb_address_t);
     49void dump_usb_descriptor(uint8_t *, size_t);
     50int dump_device(devman_handle_t, usb_address_t);
    5251void dump_descriptor_tree(uint8_t *, size_t);
    5352
  • uspace/app/virtusbkbd/descriptor.h

    r976f546 r19a1800  
    2727 */
    2828
    29 /** @addtogroup usb
     29/** @addtogroup usbvirtkbd
    3030 * @{
    3131 */
  • uspace/app/virtusbkbd/items.h

    r976f546 r19a1800  
    2727 */
    2828
    29 /** @addtogroup usb
     29/** @addtogroup usbvirtkbd
    3030 * @{
    3131 */
  • uspace/app/virtusbkbd/kbdconfig.c

    r976f546 r19a1800  
    2727 */
    2828
    29 /** @addtogroup usb
     29/** @addtogroup usbvirtkbd
    3030 * @{
    3131 */
     
    6161        .endpoint_count = 1,
    6262        .interface_class = USB_CLASS_HID,
    63         .interface_subclass = 0,
     63        .interface_subclass = USB_HID_SUBCLASS_BOOT,
    6464        .interface_protocol = USB_HID_PROTOCOL_KEYBOARD,
    6565        .str_interface = 0
  • uspace/app/virtusbkbd/kbdconfig.h

    r976f546 r19a1800  
    2727 */
    2828
    29 /** @addtogroup usb
     29/** @addtogroup usbvirtkbd
    3030 * @{
    3131 */
  • uspace/app/virtusbkbd/keys.c

    r976f546 r19a1800  
    2727 */
    2828
    29 /** @addtogroup usb
     29/** @addtogroup usbvirtkbd
    3030 * @{
    3131 */
  • uspace/app/virtusbkbd/keys.h

    r976f546 r19a1800  
    2727 */
    2828
    29 /** @addtogroup usb
     29/** @addtogroup usbvirtkbd
    3030 * @{
    3131 */
     
    4040
    4141/** Maximum number of keys that can be pressed simultaneously. */
    42 #define KB_MAX_KEYS_AT_ONCE 4
     42#define KB_MAX_KEYS_AT_ONCE 6
    4343
    4444/** Key code type. */
  • uspace/app/virtusbkbd/report.h

    r976f546 r19a1800  
    2727 */
    2828
    29 /** @addtogroup usb
     29/** @addtogroup usbvirtkbd
    3030 * @{
    3131 */
  • uspace/app/virtusbkbd/stdreq.c

    r976f546 r19a1800  
    2727 */
    2828
    29 /** @addtogroup usb
     29/** @addtogroup usbvirtkbd
    3030 * @{
    3131 */
  • uspace/app/virtusbkbd/stdreq.h

    r976f546 r19a1800  
    2727 */
    2828
    29 /** @addtogroup usb
     29/** @addtogroup usbvirtkbd
    3030 * @{
    3131 */
  • uspace/app/virtusbkbd/virtusbkbd.c

    r976f546 r19a1800  
    2727 */
    2828
    29 /** @addtogroup usb
     29/** @addtogroup usbvirtkbd
    3030 * @{
    3131 */
     
    271271        printf("%s: Simulating keyboard events...\n", NAME);
    272272        fibril_sleep(10);
    273         while (1) {
     273        //while (1) {
    274274                kb_process_events(&status, keyboard_events, keyboard_events_count,
    275275                        on_keyboard_change);
    276         }
     276        //}
    277277       
    278278        printf("%s: Terminating...\n", NAME);
Note: See TracChangeset for help on using the changeset viewer.