Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 357048
b: refs/heads/master
c: 7a29ee2
h: refs/heads/master
v: v3
  • Loading branch information
Hans de Goede authored and Mauro Carvalho Chehab committed Dec 21, 2012
1 parent 0aae602 commit f3c079e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 143dd34597a2e051cb0938b28387b94742d4e4e4
refs/heads/master: 7a29ee2e37b3f9675f46c87998c67b68c315c54a
56 changes: 46 additions & 10 deletions trunk/drivers/media/usb/stkwebcam/stk-webcam.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <linux/errno.h>
#include <linux/slab.h>

#include <linux/dmi.h>
#include <linux/usb.h>
#include <linux/mm.h>
#include <linux/vmalloc.h>
Expand All @@ -38,12 +39,12 @@
#include "stk-webcam.h"


static bool hflip;
module_param(hflip, bool, 0444);
static int hflip = -1;
module_param(hflip, int, 0444);
MODULE_PARM_DESC(hflip, "Horizontal image flip (mirror). Defaults to 0");

static bool vflip;
module_param(vflip, bool, 0444);
static int vflip = -1;
module_param(vflip, int, 0444);
MODULE_PARM_DESC(vflip, "Vertical image flip. Defaults to 0");

static int debug;
Expand All @@ -62,6 +63,19 @@ static struct usb_device_id stkwebcam_table[] = {
};
MODULE_DEVICE_TABLE(usb, stkwebcam_table);

/* The stk webcam laptop module is mounted upside down in some laptops :( */
static const struct dmi_system_id stk_upside_down_dmi_table[] = {
{
.ident = "ASUS G1",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "G1")
}
},
{}
};


/*
* Basic stuff
*/
Expand Down Expand Up @@ -817,10 +831,16 @@ static int stk_vidioc_g_ctrl(struct file *filp,
c->value = dev->vsettings.brightness;
break;
case V4L2_CID_HFLIP:
c->value = dev->vsettings.hflip;
if (dmi_check_system(stk_upside_down_dmi_table))
c->value = !dev->vsettings.hflip;
else
c->value = dev->vsettings.hflip;
break;
case V4L2_CID_VFLIP:
c->value = dev->vsettings.vflip;
if (dmi_check_system(stk_upside_down_dmi_table))
c->value = !dev->vsettings.vflip;
else
c->value = dev->vsettings.vflip;
break;
default:
return -EINVAL;
Expand All @@ -837,10 +857,16 @@ static int stk_vidioc_s_ctrl(struct file *filp,
dev->vsettings.brightness = c->value;
return stk_sensor_set_brightness(dev, c->value >> 8);
case V4L2_CID_HFLIP:
dev->vsettings.hflip = c->value;
if (dmi_check_system(stk_upside_down_dmi_table))
dev->vsettings.hflip = !c->value;
else
dev->vsettings.hflip = c->value;
return 0;
case V4L2_CID_VFLIP:
dev->vsettings.vflip = c->value;
if (dmi_check_system(stk_upside_down_dmi_table))
dev->vsettings.vflip = !c->value;
else
dev->vsettings.vflip = c->value;
return 0;
default:
return -EINVAL;
Expand Down Expand Up @@ -1276,8 +1302,18 @@ static int stk_camera_probe(struct usb_interface *interface,
dev->interface = interface;
usb_get_intf(interface);

dev->vsettings.vflip = vflip;
dev->vsettings.hflip = hflip;
if (hflip != -1)
dev->vsettings.hflip = hflip;
else if (dmi_check_system(stk_upside_down_dmi_table))
dev->vsettings.hflip = 1;
else
dev->vsettings.hflip = 0;
if (vflip != -1)
dev->vsettings.vflip = vflip;
else if (dmi_check_system(stk_upside_down_dmi_table))
dev->vsettings.vflip = 1;
else
dev->vsettings.vflip = 0;
dev->n_sbufs = 0;
set_present(dev);

Expand Down

0 comments on commit f3c079e

Please sign in to comment.