Maurizio wrote:
> Oh, sorry.
> I've looked at what the sportdmp application does to estabilish a
> connection to the serial port driver.
>
> const char* devpath = "/hw/pci0/00:01.0/com1/a";
> [...]
> int rc = devman_fun_get_handle(devpath, &device, IPC_FLAG_BLOCKING);
> [...]
I see. sportdmp does not follow the 'best practices' and needs fixing :-) I
think I should put some sample code on the wiki how to connect to device
services.
If you are connecting to a service with a user-supplied name, it should be
rather something like:
const char *svc_name = "devices/\hw\pci0\00:01.0\com1\a";
service_id_t svc_id;
rc = loc_service_get_id(svc_name, &svc_id, 0);
...
sess = loc_service_connect(EXCHANGE_SERIALIZE, kdev->svc_id, 0);
Or, if you are interested in all services in a category (e.g. like the input
server), you will skip the service names entirely:
category_id_t keyboard_cat;
service_id_t *svcs;
size_t count, i;
rc = loc_category_get_id("keyboard", &keyboard_cat, IPC_FLAG_BLOCKING);
....
rc = loc_category_get_svcs(keyboard_cat, &svcs, &count);
...
for (i = 0; i < count; i++) {
sess = loc_service_connect(EXCHANGE_SERIALIZE, svcs[i], 0);
...
}
Hope this helps
-Jiri
_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/cgi-bin/listinfo/helenos-devel