config_ioctl() now returns the actual error as returned by the config manager,
as pointed out by Jerome. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10284 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,18 +1,18 @@
|
|||||||
/* config driver
|
/* config driver
|
||||||
** provides userland access to the device configuration manager
|
* provides userland access to the device configuration manager
|
||||||
**
|
*
|
||||||
** Copyright 2002, Axel Doerfler. All rights reserved.
|
* Copyright 2002-2004, Axel Doerfler. All rights reserved.
|
||||||
** Distributed under the terms of the OpenBeOS License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
//#include <Errors.h>
|
|
||||||
#include <Drivers.h>
|
#include <Drivers.h>
|
||||||
#include <drivers/config_manager.h>
|
#include <drivers/config_manager.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "config_driver.h"
|
#include "config_driver.h"
|
||||||
|
|
||||||
|
|
||||||
#define DEVICE_NAME "misc/config"
|
#define DEVICE_NAME "misc/config"
|
||||||
|
|
||||||
int32 api_version = B_CUR_DRIVER_API_VERSION;
|
int32 api_version = B_CUR_DRIVER_API_VERSION;
|
||||||
@@ -54,38 +54,33 @@ config_ioctl(void *cookie, uint32 op, void *buffer, size_t len)
|
|||||||
if (params == NULL || params->magic != op)
|
if (params == NULL || params->magic != op)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
|
// ToDo: the access of the params is not safe!
|
||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case CM_GET_NEXT_DEVICE_INFO:
|
case CM_GET_NEXT_DEVICE_INFO:
|
||||||
gConfigManager->get_next_device_info(params->bus, ¶ms->cookie,
|
return gConfigManager->get_next_device_info(params->bus, ¶ms->cookie,
|
||||||
(struct device_info *)params->data, params->data_len);
|
(struct device_info *)params->data, params->data_len);
|
||||||
break;
|
|
||||||
case CM_GET_DEVICE_INFO_FOR:
|
case CM_GET_DEVICE_INFO_FOR:
|
||||||
gConfigManager->get_device_info_for(params->cookie,
|
return gConfigManager->get_device_info_for(params->cookie,
|
||||||
(struct device_info *)params->data, params->data_len);
|
(struct device_info *)params->data, params->data_len);
|
||||||
break;
|
|
||||||
case CM_GET_SIZE_OF_CURRENT_CONFIGURATION_FOR:
|
case CM_GET_SIZE_OF_CURRENT_CONFIGURATION_FOR:
|
||||||
gConfigManager->get_size_of_current_configuration_for(params->cookie);
|
return gConfigManager->get_size_of_current_configuration_for(params->cookie);
|
||||||
break;
|
|
||||||
case CM_GET_CURRENT_CONFIGURATION_FOR:
|
case CM_GET_CURRENT_CONFIGURATION_FOR:
|
||||||
gConfigManager->get_current_configuration_for(params->cookie,
|
return gConfigManager->get_current_configuration_for(params->cookie,
|
||||||
(struct device_configuration *)params->data, params->data_len);
|
(struct device_configuration *)params->data, params->data_len);
|
||||||
break;
|
|
||||||
case CM_GET_SIZE_OF_POSSIBLE_CONFIGURATIONS_FOR:
|
case CM_GET_SIZE_OF_POSSIBLE_CONFIGURATIONS_FOR:
|
||||||
gConfigManager->get_size_of_possible_configurations_for(params->cookie);
|
return gConfigManager->get_size_of_possible_configurations_for(params->cookie);
|
||||||
break;
|
|
||||||
case CM_GET_POSSIBLE_CONFIGURATIONS_FOR:
|
case CM_GET_POSSIBLE_CONFIGURATIONS_FOR:
|
||||||
gConfigManager->get_possible_configurations_for(params->cookie,
|
return gConfigManager->get_possible_configurations_for(params->cookie,
|
||||||
(struct possible_device_configurations *)params->data, params->data_len);
|
(struct possible_device_configurations *)params->data, params->data_len);
|
||||||
break;
|
|
||||||
case CM_COUNT_RESOURCE_DESCRIPTORS_OF_TYPE:
|
case CM_COUNT_RESOURCE_DESCRIPTORS_OF_TYPE:
|
||||||
gConfigManager->count_resource_descriptors_of_type(params->config, params->type);
|
return gConfigManager->count_resource_descriptors_of_type(params->config, params->type);
|
||||||
break;
|
|
||||||
case CM_GET_NTH_RESOURCE_DESCRIPTOR_OF_TYPE:
|
case CM_GET_NTH_RESOURCE_DESCRIPTOR_OF_TYPE:
|
||||||
gConfigManager->get_nth_resource_descriptor_of_type(params->config, params->n,
|
return gConfigManager->get_nth_resource_descriptor_of_type(params->config, params->n,
|
||||||
params->type, (resource_descriptor *)params->data, params->data_len);
|
params->type, (resource_descriptor *)params->data, params->data_len);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return B_NOT_ALLOWED;
|
|
||||||
|
return B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user