Changeset 85f2064 in mainline for uspace/app/sportdmp/sportdmp.c


Ignore:
Timestamp:
2012-04-12T14:21:46Z (12 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bb8f69d
Parents:
751cabc (diff), d11a181 (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 mainline changes

File:
1 edited

Legend:

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

    r751cabc r85f2064  
    2727 */
    2828
     29#include <device/char_dev.h>
    2930#include <errno.h>
     31#include <ipc/serial_ctl.h>
     32#include <loc.h>
    3033#include <stdio.h>
    31 #include <devman.h>
    32 #include <ipc/devman.h>
    33 #include <device/char_dev.h>
    34 #include <ipc/serial_ctl.h>
    3534
    3635#define BUF_SIZE 1
    3736
    38 static void syntax_print() {
    39         fprintf(stderr, "Usage: sportdmp <baud> <device_path>\n");
     37static void syntax_print(void)
     38{
     39        fprintf(stderr, "Usage: sportdmp <baud> <device_service>\n");
    4040}
    4141
    4242int main(int argc, char **argv)
    4343{
    44         const char* devpath = "/hw/pci0/00:01.0/com1/a";
     44        const char* svc_path = "devices/\\hw\\pci0\\00:01.0\\com1\\a";
    4545        sysarg_t baud = 9600;
    4646       
     
    5656       
    5757        if (argc > 2) {
    58                 devpath = argv[2];
     58                svc_path = argv[2];
    5959        }
    6060       
     
    6464        }
    6565       
    66         devman_handle_t device;
    67         int rc = devman_fun_get_handle(devpath, &device, IPC_FLAG_BLOCKING);
     66        service_id_t svc_id;
     67        int rc = loc_service_get_id(svc_path, &svc_id, IPC_FLAG_BLOCKING);
    6868        if (rc != EOK) {
    69                 fprintf(stderr, "Cannot open device %s\n", devpath);
     69                fprintf(stderr, "Cannot find device service %s\n", svc_path);
    7070                return 1;
    7171        }
    7272       
    73         async_sess_t *sess = devman_device_connect(EXCHANGE_SERIALIZE, device,
     73        async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE, svc_id,
    7474            IPC_FLAG_BLOCKING);
    7575        if (!sess) {
    76                 fprintf(stderr, "Cannot connect device\n");
     76                fprintf(stderr, "Failed connecting to service %s\n", svc_path);
    7777        }
    7878       
     
    8383       
    8484        if (rc != EOK) {
    85                 fprintf(stderr, "Cannot set serial properties\n");
     85                fprintf(stderr, "Failed setting serial properties\n");
    8686                return 2;
    8787        }
     
    8989        uint8_t *buf = (uint8_t *) malloc(BUF_SIZE);
    9090        if (buf == NULL) {
    91                 fprintf(stderr, "Cannot allocate buffer\n");
     91                fprintf(stderr, "Failed allocating buffer\n");
    9292                return 3;
    9393        }
Note: See TracChangeset for help on using the changeset viewer.