core: detect PCMCIA manfid and cardid
These aren't added to the udev device database by anything yet (though they should be) so grab them manually.
This commit is contained in:
@@ -891,7 +891,7 @@ mm_plugin_base_get_device_ids (MMPluginBase *self,
|
|||||||
{
|
{
|
||||||
MMPluginBasePrivate *priv;
|
MMPluginBasePrivate *priv;
|
||||||
GUdevDevice *device = NULL, *parent = NULL;
|
GUdevDevice *device = NULL, *parent = NULL;
|
||||||
const char *vid, *pid, *parent_subsys;
|
const char *vid = NULL, *pid = NULL, *parent_subsys;
|
||||||
gboolean success = FALSE;
|
gboolean success = FALSE;
|
||||||
|
|
||||||
g_return_val_if_fail (self != NULL, FALSE);
|
g_return_val_if_fail (self != NULL, FALSE);
|
||||||
@@ -909,21 +909,34 @@ mm_plugin_base_get_device_ids (MMPluginBase *self,
|
|||||||
if (!device)
|
if (!device)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* Bluetooth devices report the VID/PID of the BT adapter here, which
|
|
||||||
* isn't really what we want. Just return null IDs instead.
|
|
||||||
*/
|
|
||||||
parent = g_udev_device_get_parent (device);
|
parent = g_udev_device_get_parent (device);
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parent_subsys = g_udev_device_get_subsystem (parent);
|
parent_subsys = g_udev_device_get_subsystem (parent);
|
||||||
if (parent_subsys && !strcmp (parent_subsys, "bluetooth")) {
|
if (parent_subsys) {
|
||||||
success = TRUE;
|
if (!strcmp (parent_subsys, "bluetooth")) {
|
||||||
goto out;
|
/* Bluetooth devices report the VID/PID of the BT adapter here,
|
||||||
|
* which isn't really what we want. Just return null IDs instead.
|
||||||
|
*/
|
||||||
|
success = TRUE;
|
||||||
|
goto out;
|
||||||
|
} else if (!strcmp (parent_subsys, "pcmcia")) {
|
||||||
|
/* For PCMCIA devices we need to grab the PCMCIA subsystem's
|
||||||
|
* manfid and cardid, since any IDs on the tty device itself
|
||||||
|
* may be from PCMCIA controller or something else.
|
||||||
|
*/
|
||||||
|
vid = g_udev_device_get_sysfs_attr (parent, "manf_id");
|
||||||
|
pid = g_udev_device_get_sysfs_attr (parent, "card_id");
|
||||||
|
if (!vid || !pid)
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vid = g_udev_device_get_property (device, "ID_VENDOR_ID");
|
if (!vid)
|
||||||
|
vid = g_udev_device_get_property (device, "ID_VENDOR_ID");
|
||||||
if (!vid)
|
if (!vid)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (strncmp (vid, "0x", 2) == 0)
|
if (strncmp (vid, "0x", 2) == 0)
|
||||||
vid += 2;
|
vid += 2;
|
||||||
if (strlen (vid) != 4)
|
if (strlen (vid) != 4)
|
||||||
@@ -934,11 +947,13 @@ mm_plugin_base_get_device_ids (MMPluginBase *self,
|
|||||||
*vendor |= (guint16) ((utils_hex2byte (vid) & 0xFF) << 8);
|
*vendor |= (guint16) ((utils_hex2byte (vid) & 0xFF) << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
pid = g_udev_device_get_property (device, "ID_MODEL_ID");
|
if (!pid)
|
||||||
|
pid = g_udev_device_get_property (device, "ID_MODEL_ID");
|
||||||
if (!pid) {
|
if (!pid) {
|
||||||
*vendor = 0;
|
*vendor = 0;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp (pid, "0x", 2) == 0)
|
if (strncmp (pid, "0x", 2) == 0)
|
||||||
pid += 2;
|
pid += 2;
|
||||||
if (strlen (pid) != 4) {
|
if (strlen (pid) != 4) {
|
||||||
|
Reference in New Issue
Block a user