Lorin Olivier’s GL860 driver

Lorin Olivier has created a kernel driver for his GL860 webcam. Lorin’s device is the 05e3:f191 variant, whereas mine is the more common 05e3:0503. There are differences between the devices that we don’t have much of a grasp on. The code we’ve written for each device is incompatible with the other, even though there are some protocol similarities.

Lorin reports that his driver works reasonably well with his device – it works with camorama, xawtv, ekiga, amsn, mplayer and xsane. He has also determined how to adjust various camera settings (luminosity, saturation, hue, sharpness, retrolighting, mirror effects, light source, AC power frequency).

Although Lorin doesn’t actually own an 0503 device, he’s attempted to implement support for it based on my earlier efforts. Given that I didn’t get very far, it probably doesn’t work that well. I haven’t had a chance to try it, but there’s no point me sitting on this any longer.

It’s in my git repository in the nvgl subdirectory:
git://projects.reactivated.net/~dsd/gl860.git (gitweb).

All credit goes to Lorin here – thanks! He’s done a great job, but do remember that its experimental code based on a reverse-engineered protocol, so don’t expect it to be flawless.

112 thoughts on “Lorin Olivier’s GL860 driver

  1. almighurt

    ok, i’ll try that in the evening, but i couldn’t find any option to get sizes greater than 640×480 in my webcam viewer… maybe there is another webcam tool for vista that does that or maybe i just missed that option.

  2. Sur3

    well, the only logfile which seems to have important information excerpt for the resize-logs is the flip_on_and_off.log.c, but perhaps i’m blind and Nol has more luck :-)
    anyway, last night i reverse engineered a bit and found out how to set fps and a kind of brightness. but i don’t know how to implement it in the code yet, but i will post a sample file in a few minutes..

    greets
    Simon

  3. nol

    How did you reverse ingeneered ? From logs ? in this case, put the logs online, If not from logs please explain me.

  4. nol

    For example in the brightness log file the information is :

    ctrl_out(dev, 0x40, 1, 0x6032, 0x00ff, 0, NULL);

    ctrl_out(dev, 0x40, 1, 0x6050, 0x00ff, 0, NULL);

    As value vary from 50 (32h) to 80 (50h), we infer that to change the brightness you have to send the webcam :

    ctrl_out(dev, 0x40, 1, 0x6000+brightness, 0x00ff, 0, NULL);

    (This a record, just one instruction is not the case for me or Malmostoso !)

  5. Sur3

    yes, sry, i didnt see this
    ctrl_out(dev, 0×40, 1, 0×6000+brightness, 0×00ff, 0, NULL);
    cause i searched for an other kind of commands.
    but it seemes not to work for me, i can’t recognise any difference, but perhaps i did something wrong.
    about my variant, working for me, i got it with studying and comparing logs and delta-debuging.

    greets
    Simon

  6. nol

    Me too, sorry.

    Gamma, brightness, hue, sharpness, white balance,contrast made exactly the same thing !
    The is no difference at all between all these commands !
    It is just crazy.

    Almighurt, does it work with your pictures ? when you change something, it happens. Or is the soft you use “crappy” ?
    as it does not propose you to make more than 640×480, it is very strange.

  7. Nol

    @ Sur3 :

    Once again Sur3, could you share your logs ?
    And could you tell me if the last release allow you to have a picture as Almighurt.

  8. Nol

    @ Almighurt : as expected you don’t have a real 320×240 or 160×120. It is just undersampled data from 640×480.
    You can see that in your log files as you will see all images decoded in your logs are 640×480. Not any one in 320×240 or 160×120.

  9. Sur3

    hm, in the datasheet there is a 8052 mentioned, would be great if one could manipulate the pictures with 8052-Assembler…

  10. almighurt

    well, i just made 5 another brightness-changing-logs, reviewing the images generated by relog.c. there is only one log, where the brightness of the generated pictures changes! i uploaded it here:

    http://michael-gerhaeuser.de/gl860/brightness1.log.c

    so i’m not sure about the logs posted this morning being useful. i’m pretty sure, they’re worthless. my cam soft is totally crappy, it’s called “Cyberlink YouCam”.

  11. nol

    @ Almighurt : no useful data in the last log.

    @ Sur3 : thanks for the new logs. Could you make logs while changing from 640×480 to a greater size and while changing one settings as did Almighurt (as expected, no real size below). These are the most important logs now that we have a picture.

    If you can set the fps, please post logs with different fps set.
    Concerning YU… change, i don’t think it has an effect, i try with my webcam but it has no effect, restarting the webcam apart.

  12. Sur3

    addon: and yes, there was usefull data in the last log for me, cause it helped me to find the new brightness-setting mentioned ;-)

    almi, will you test my gl860-dev-0503sur0.c, please give me feedback

    thanks&greets
    Simon

  13. almighurt

    @sur3: well, it works, but i can’t change any settings. i tried that by dragging the bars in the adjustment section of the camorama window, but no changes. when i start camorama i sometimes dmesg says something like this:

    kernel: [ 191.401177] gl860: ctrl transfer failed -110 [p40 r1 v6032 i00ff lg0]
    or
    kernel: [ 298.674248] gl860: short ctrl transfer -110/8

  14. Nol

    So you change something in the driver and you see what happened ? OK.
    However as you have still made Windows logs, why do you do not new logs, we could progess quickier !

    If you to test the brightness and contrast, just just have to fill the empty “dev_0503_camera_settings” function with :

    int dev_0503_camera_settings(struct usb_gl860 *dev)
    {
    int lum =dev->vsettings.brightness/256;
    int cntr =dev->vsettings.contrast/256;

    hell[3]=lum;
    hell[7]=cntr;
    ctrl_out(dev, 0x40, 3, 0x6000, 0x0200, 8, (void*)hell); // light

    return 0;
    }

    With that you will be able to control the effect of both settings.
    NOTE : this is based on a range of 0-255 for both settings, which is not always reality.

  15. almighurt

    @Nol:

    That works for me, thank you. I tried some of the webcam viewers from your link, but most of them are even much more crap than mine and until now i didn’t find anything useful. What can i do to help you? Am i doing something wrong when i try to log setting changes?

  16. Nol

    You don’t make something wrong, the data exchange between the viewer and the device is almost nothing, it ‘s the problem. Or there is something I don’t know which makes that an unlogged communication tell the webcam he is changing that setting and the logged exchange we have is just the new value. It will be very amazing.
    You saw that while changing brightness you have almost never changes in the images generated by relog, is it the case if you log with other viewer or with “Cyberlink YouCam” when you change other parameters than brightness ?

  17. Sur3

    Nol: thanks for the code for on the fly changing, it works, and yes the brightness has a scale from 0 to 255.
    But one has to be carefull with the contrast setting, because perhaps it is not really the contrast, and it has a strange scale, perhaps there is one bit in the middle which has no effect, i’ll experiment with some bitshifting.
    with camorama everithing seem to work, but mplayer sets the cntr to 127 and the brightness to 0 which results a very dark screen.

    thanks&greets
    Simon

  18. Jack Malmostoso

    Sur3: mplayer behaves funnily. I am not sure if it tries to access the webcam over v4l (instead of v4l2), but it’s the only application that does not seem to handle the webcam properly.

  19. Nol

    You can define what of v4l or v4l2 to use in the command line for mplayer. An example is in the README file… and for mencoder “rgb24” must be read instead of “bgr24”.
    The sole viewer which seems to use completly v4l2 is xawtv as we can set all parameters defined by the driver. The others seem to allow only for common settings to be set.

  20. almighurt

    weird… amcap doesn’t wok at all. the captured pictures look all over the same (no brightness change). the settings dialog is the same as is in Cyberlink YouCam (maybe provided by the driver? or some user-space program coming with the driver?). whenever i try to get higher resolutions beyond 640×480, with the web version i get

    Unable to activate the high-resolution still capture. Unbekannter Fehler [0x80004005 / 11011]

    the amcap version coming with my webcam driver doesn’t have an option to get higher resolutions at all.

    maybe not youcam is crap, but the driver and the cam is?

    Here my two logs (i’m pretty sure, they’re worthless, but just to be sure, you don’t miss anything that might be useful):
    http://www.michael-gerhaeuser.de/gl860/brightness_amcap_web.log.c
    http://www.michael-gerhaeuser.de/gl860/brightness_amcap_driver.log.c

  21. almighurt

    just saw after submitting my last comment: amcap of course works, but only for lower resolutions than 640×480 (only black screen with 640×480, just like youcam).

  22. Sur3

    @almi: yes the same for me, when the resolution is to great, then you see a black screen, because, it is not fast enough when you capture. but the logfiles are also usefull even if the screen is black.
    I can only change to higher resolution when i choose the YUY2 format, perhaps that is the same for you?

    greets
    Simon

  23. nol

    I suppose your driver must be somewhat crappy, so you can’t do anything with it.
    Could you make logs while changing the size.
    I’ll include the brightness change in the next release.

  24. Sur3

    good news,
    i managed to get 1280×1024@10fps will upload the code ths evening after some more testing.

    greets
    Simon

    ps:
    the resoluton 1600×1200 of amcap seems to be just upsampled/nterpolated.

  25. nol

    :)

    Try the modified relog.c in SF. Now it gives on the screen the size of images it spots in the logs. If you see that the images are 1600×1200, they are not interpolated. Malmostoso have a real 1600×1200 with its 0503.

  26. Nol

    Could you share your logs and explain me how do you do ?
    I cannot think that you achieve the 1280×960 by delta-debuging.
    So I think you use logs as you have still shared logs in the early days.
    If you can make logs, what don’t you make logs as Almighurt tried with all settings ?

  27. Sur3

    well the code was already in the logs i uploaded,
    furthermore my driver seemes to be same as crapy as Almighurts
    and my keyboard is brocken, so it’s actually not that easy to do anything. :-(

    greets Simon

  28. Nol

    OK, could you explain how you did to have a greater size than 640×480 as it seemed to be impossible to Almighurt.
    The process could be interesting to someone who would like to help with log.

  29. Sur3

    well i just used my logfiles and compared it to the code i alredy had, not easy to explain in one sentence ;-)
    how did you contact almi, kind of jabber?, i cant see any posts here,
    perhaps he has just to reduce the fps in the driver, if its to high he wont see anything… ?
    or his webcam doesnt support this res if he even cant use it in windows without usbsnoop installed…?
    anyway there are still buffer-overflows when starting the cam, and resizing for other sizes than 640×480 or 1280×960 doesnt work.

    greets Simon

    ps:
    i made myself a sourceforge account ( sur3 ), but i can’t find howto subscribe to a project, could you explain me?

  30. Sur3

    ah, perhaps i missunderstood your question, i good the high-res logs by using usbsnoop and amcap, but i had to change the picture-format from I420 to YUY2 to be ably to select an higher resolution, and yes i didnt see anything, but the code needed was in the logfiles afterwards, but i allready mentioned this in an earlier comment.

    greets Simon

  31. Nol

    On SourceForge, you will find an updated “sim” version. It is not as light as the one of Sur3, but it should work. Only the brightness is included.
    I will change the management of the different 0503 version in order that you will be able to be naturally at 640×480 or 1280×960 with camorama as it should be at 800×600 et 1600×1200 for you if I make no mistake.

    @ Sur3 : sorry, I didn’t understood that the 1280×960 comes from the 1600×1200 log so that I thought you had new logs not shared.
    Are you sure for the setting of fps ? 38Hz, 60Hz and so on are really high value.
    Could you post images of the same field of view with different “contrast” settings and the value of the setting.

  32. Nol

    When you change format to i420 or YUY2, do the images are really in these format (have you to change something in gl860-bayer.c to display properly the image) ?
    I don’t know how to contact Almighurt.
    I add you to the project but I don’t know what you allowed to do… SF is still new to me.

  33. nol

    New release at SF with the respect of possible size. Now, you should run basically Camorama in 640×480 and in 1280×960 in the great size.

  34. almighurt

    Sorry, i had to do some other work about genetic algorithms… no time last week, but i tested the new version and it works wonderful! thanks for your great work :)

    do you need more logs from me? if you do, just let me know. to contact me just mail to gl860 at michael-gerhaeser.de

  35. nol

    :) So you have both size and brightness control ?
    I would like a log with a change to 800×600 and logs with changes of fps and the range of fps allowed by the driver. That information should be send to the webcam chip.

  36. almighurt

    good morning :)

    1. i uploaded the gl860.inf from the driver for windows vista 32 bit to sourceforge
    2. i was able to make 2 logs, one with sizechange from 1600×1200 to 1280×800:
    http://michael-gerhaeuser.de/gl860/sizechange_from_1600x1200_to_1280x800.log.c
    and one with sizechange from 1600×1200 to 640×480:
    http://michael-gerhaeuser.de/gl860/sizechange_from_1600x1200_to_640x480.log.c
    because amcap doesn’t let me choose 800×600, so i took the resolutions around 800×600 that amcap let me choose.
    3. there is an option in amcap settings dialog about changing the fps, but i can’t change it to any other than 30.00. so i made no logs about that

  37. nol

    Good Morning Almighurt

    Bad news for the settings, the driver sets brightness, contrast, etc as expected from the gl860.inf. Really stange, I will extend the supported settings by the mean of a post-processing step to have the v4l basis settings.

    From the gl860.inf it appears that the webcam can achieve 1600×1200 in YUYV.
    What I need is a log of 640×480 to 1600×1200. From 1600×1200 to 640×480, i get the informations to reveive 640×480 images, what is already known.

  38. nol

    If you have contrast, that means you use Sur3’s 0503, not the one in SF’s archive ! I have not included the contrast since it is not well understood.

  39. almighurt

    sorry, i don’t have contrast, just brightness (and size invoking camorama with -x and -y parameters).

  40. Nol

    The size has not really changed to 1600×1200, it is exactly the same instruction sequence as to change to 1280×960.

  41. almighurt

    Maybe because there is no real 1280×960 but just 640×480 and 1600×1200?

Comments are closed.