diff options
author | Ezequiel GarcĂa <elezegarcia@gmail.com> | 2012-02-24 09:24:16 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-15 07:54:37 -0400 |
commit | f9482d01985b03633e39e1c772bd7d365ab82dc6 (patch) | |
tree | 377f9d54f94e1e6052a93de717870b5893b61ace | |
parent | 20c50af28aa9301b1f5bf0ba571068f663f7b0ac (diff) |
[media] staging: easycap: Push bInterfaceNumber saving to config_easycap()
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/staging/media/easycap/easycap_main.c | 72 |
1 files changed, 41 insertions, 31 deletions
diff --git a/drivers/staging/media/easycap/easycap_main.c b/drivers/staging/media/easycap/easycap_main.c index 6d7cdef58800..9d6dc09656be 100644 --- a/drivers/staging/media/easycap/easycap_main.c +++ b/drivers/staging/media/easycap/easycap_main.c | |||
@@ -3242,6 +3242,44 @@ static int create_video_urbs(struct easycap *peasycap) | |||
3242 | return 0; | 3242 | return 0; |
3243 | } | 3243 | } |
3244 | 3244 | ||
3245 | static void config_easycap(struct easycap *peasycap, | ||
3246 | u8 bInterfaceNumber, | ||
3247 | u8 bInterfaceClass, | ||
3248 | u8 bInterfaceSubClass) | ||
3249 | { | ||
3250 | if ((USB_CLASS_VIDEO == bInterfaceClass) || | ||
3251 | (USB_CLASS_VENDOR_SPEC == bInterfaceClass)) { | ||
3252 | if (-1 == peasycap->video_interface) { | ||
3253 | peasycap->video_interface = bInterfaceNumber; | ||
3254 | JOM(4, "setting peasycap->video_interface=%i\n", | ||
3255 | peasycap->video_interface); | ||
3256 | } else { | ||
3257 | if (peasycap->video_interface != bInterfaceNumber) { | ||
3258 | SAM("ERROR: attempting to reset " | ||
3259 | "peasycap->video_interface\n"); | ||
3260 | SAM("...... continuing with " | ||
3261 | "%i=peasycap->video_interface\n", | ||
3262 | peasycap->video_interface); | ||
3263 | } | ||
3264 | } | ||
3265 | } else if ((USB_CLASS_AUDIO == bInterfaceClass) && | ||
3266 | (USB_SUBCLASS_AUDIOSTREAMING == bInterfaceSubClass)) { | ||
3267 | if (-1 == peasycap->audio_interface) { | ||
3268 | peasycap->audio_interface = bInterfaceNumber; | ||
3269 | JOM(4, "setting peasycap->audio_interface=%i\n", | ||
3270 | peasycap->audio_interface); | ||
3271 | } else { | ||
3272 | if (peasycap->audio_interface != bInterfaceNumber) { | ||
3273 | SAM("ERROR: attempting to reset " | ||
3274 | "peasycap->audio_interface\n"); | ||
3275 | SAM("...... continuing with " | ||
3276 | "%i=peasycap->audio_interface\n", | ||
3277 | peasycap->audio_interface); | ||
3278 | } | ||
3279 | } | ||
3280 | } | ||
3281 | } | ||
3282 | |||
3245 | static const struct v4l2_file_operations v4l2_fops = { | 3283 | static const struct v4l2_file_operations v4l2_fops = { |
3246 | .owner = THIS_MODULE, | 3284 | .owner = THIS_MODULE, |
3247 | .open = easycap_open_noinode, | 3285 | .open = easycap_open_noinode, |
@@ -3340,37 +3378,9 @@ static int easycap_usb_probe(struct usb_interface *intf, | |||
3340 | return -ENODEV; | 3378 | return -ENODEV; |
3341 | } | 3379 | } |
3342 | 3380 | ||
3343 | if ((USB_CLASS_VIDEO == bInterfaceClass) || | 3381 | config_easycap(peasycap, bInterfaceNumber, |
3344 | (USB_CLASS_VENDOR_SPEC == bInterfaceClass)) { | 3382 | bInterfaceClass, |
3345 | if (-1 == peasycap->video_interface) { | 3383 | bInterfaceSubClass); |
3346 | peasycap->video_interface = bInterfaceNumber; | ||
3347 | JOM(4, "setting peasycap->video_interface=%i\n", | ||
3348 | peasycap->video_interface); | ||
3349 | } else { | ||
3350 | if (peasycap->video_interface != bInterfaceNumber) { | ||
3351 | SAM("ERROR: attempting to reset " | ||
3352 | "peasycap->video_interface\n"); | ||
3353 | SAM("...... continuing with " | ||
3354 | "%i=peasycap->video_interface\n", | ||
3355 | peasycap->video_interface); | ||
3356 | } | ||
3357 | } | ||
3358 | } else if ((USB_CLASS_AUDIO == bInterfaceClass) && | ||
3359 | (USB_SUBCLASS_AUDIOSTREAMING == bInterfaceSubClass)) { | ||
3360 | if (-1 == peasycap->audio_interface) { | ||
3361 | peasycap->audio_interface = bInterfaceNumber; | ||
3362 | JOM(4, "setting peasycap->audio_interface=%i\n", | ||
3363 | peasycap->audio_interface); | ||
3364 | } else { | ||
3365 | if (peasycap->audio_interface != bInterfaceNumber) { | ||
3366 | SAM("ERROR: attempting to reset " | ||
3367 | "peasycap->audio_interface\n"); | ||
3368 | SAM("...... continuing with " | ||
3369 | "%i=peasycap->audio_interface\n", | ||
3370 | peasycap->audio_interface); | ||
3371 | } | ||
3372 | } | ||
3373 | } | ||
3374 | 3384 | ||
3375 | /* | 3385 | /* |
3376 | * Investigate all altsettings. This is done in detail | 3386 | * Investigate all altsettings. This is done in detail |