product field added to struct capi_device.
capi_get_product() function added.
This commit is contained in:
parent
831792f3a5
commit
902069e19c
|
@ -420,6 +420,23 @@ capi_get_profile(int id, struct capi_profile* profile)
|
|||
}
|
||||
|
||||
|
||||
u8*
|
||||
capi_get_product(int id, u8 product[CAPI_PRODUCT_LEN])
|
||||
{
|
||||
if (id) {
|
||||
struct capi_device* dev = try_get_capi_device_by_id(id);
|
||||
if (!dev)
|
||||
return NULL;
|
||||
|
||||
memcpy(product, dev->product, CAPI_PRODUCT_LEN);
|
||||
up_read(&dev->sem);
|
||||
} else
|
||||
return NULL;
|
||||
|
||||
return product;
|
||||
}
|
||||
|
||||
|
||||
static int __init
|
||||
capicore_init(void)
|
||||
{
|
||||
|
@ -464,3 +481,4 @@ EXPORT_SYMBOL(capi_get_manufacturer);
|
|||
EXPORT_SYMBOL(capi_get_serial_number);
|
||||
EXPORT_SYMBOL(capi_get_version);
|
||||
EXPORT_SYMBOL(capi_get_profile);
|
||||
EXPORT_SYMBOL(capi_get_product);
|
||||
|
|
|
@ -52,10 +52,21 @@ show_version(struct class_device* cd, char* buf)
|
|||
CLASS_DEVICE_ATTR(version, S_IRUGO, show_version, NULL);
|
||||
|
||||
|
||||
static ssize_t
|
||||
show_product(struct class_device* cd, char* buf)
|
||||
{
|
||||
struct capi_device* dev = to_capi_device(cd);
|
||||
|
||||
return sprintf(buf, "%s\n", dev->product);
|
||||
}
|
||||
CLASS_DEVICE_ATTR(product, S_IRUGO, show_product, NULL);
|
||||
|
||||
|
||||
static struct class_device_attribute* attrs[] = {
|
||||
&class_device_attr_manufacturer,
|
||||
&class_device_attr_serial_number,
|
||||
&class_device_attr_version,
|
||||
&class_device_attr_product,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
#include <linux/isdn/capinfo.h>
|
||||
|
||||
|
||||
#define CAPI_PRODUCT_LEN KOBJ_NAME_LEN
|
||||
|
||||
|
||||
struct capi_appl;
|
||||
|
||||
|
||||
|
@ -101,10 +104,11 @@ capinfo_0x11 capi_get_message (struct capi_appl* appl, struct sk_buff** msg);
|
|||
capinfo_0x11 capi_peek_message (struct capi_appl* appl);
|
||||
capinfo_0x11 capi_isinstalled (void);
|
||||
|
||||
struct capi_version* capi_get_version (int dev, struct capi_version* version);
|
||||
u8* capi_get_serial_number (int dev, u8 serial[CAPI_SERIAL_LEN]);
|
||||
capinfo_0x11 capi_get_profile (int dev, struct capi_profile* profile);
|
||||
u8* capi_get_manufacturer (int dev, u8 manufacturer[CAPI_MANUFACTURER_LEN]);
|
||||
u8* capi_get_serial_number (int dev, u8 serial[CAPI_SERIAL_LEN]);
|
||||
struct capi_version* capi_get_version (int dev, struct capi_version* version);
|
||||
capinfo_0x11 capi_get_profile (int dev, struct capi_profile* profile);
|
||||
u8* capi_get_product (int id, u8 product[CAPI_PRODUCT_LEN]);
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ struct capi_driver {
|
|||
struct capi_device {
|
||||
unsigned short id;
|
||||
|
||||
u8 product[CAPI_PRODUCT_LEN];
|
||||
u8 manufacturer[CAPI_MANUFACTURER_LEN];
|
||||
u8 serial[CAPI_SERIAL_LEN];
|
||||
struct capi_version version;
|
||||
|
|
Loading…
Reference in New Issue