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. Sur3

    heyhoo, sounds nice, but your repo just says: “403 – Forbidden” or “fatal: Not a git repository Failed to find a valid git directory.” :-/

  2. Sur3

    thx, but the gl860-dev-0503b.c dosn’t work, i get really ugly pix with it:
    http://131.234.130.200/neuron/gentoo/usb_05e3_0503/0503b%40640×480.png (this swaps with blankscreen at 15 fps)

    with gl860-dev-0503.c and gl860-dev-0503a.c i get 1/16 of the viewport at 10 fps

    the best result is with the f131-driver at 1280×960, but even with this i just see half of the viewport of the camera, i should be in the middle of the pic (and its only 2 fps :-( ):
    http://131.234.130.200/neuron/gentoo/usb_05e3_0503/F191%401280×960.png

    anyway i will have to rewrite the gl860-bayer.c, but that is not the problem.

    greets
    Simon

  3. Nol

    OK, thanks for the try. I’ll study one more times your log and submit you a new version. Could you make a capture log with Windows and run “relog yourlog.log sim” to send me ypurlog.log.c ? (relog.c is in the tarball on SourceForge) ?

  4. Sur3

    thank, so here you are:

    k, this was in the log at the beginning, dont know what it is, probably unimportant:
    http://131.234.130.200/neuron/gentoo/usb_05e3_0503/irgendwas.log.c

    this is the log from just capturing, but i didnt see a picture in windows, and relog produced only damaged pics:
    http://131.234.130.200/neuron/gentoo/usb_05e3_0503/capturing.log.c

    me trying different image sizes and formats (and finding out, that i can see pics while sniffing, when i make the pics small enough):
    http://131.234.130.200/neuron/gentoo/usb_05e3_0503/resize_format.log.c

    just starting cap and changing to 320×240 and diff formats:
    http://131.234.130.200/neuron/gentoo/usb_05e3_0503/320x240_format.log.c

    hf
    greets Simon

  5. Sur3

    @myself: hm, wieso wird mein vorheriger kommentar nicht angezeigt…? *grübel*

  6. Sur3

    well, it’s a medion laptop:

    :: MD96384 Data ::
    Processor: Intel® Core 2 Duo (“Merom”) T7300 , 2,00 GHz
    Soundcard: Azalia 5.1ch, High Definition Audio (onBoard)
    Main Memory:2x 1024 MB Hynix DDR2 SO-DIMM (667 MHz) (no free banks, 2GB max.)
    Turbo Memory: 1GB Intel® Robson-Modul (NAND-Flash-Memory), PCIe Minicard
    Graphics:nVidia ® GeForce® 8600M GS (256 MB GDDRII-Memory, MS DirectX 10 Support)
    BIOS/Chipset:Phoenix BIOS, Intel i945PM / ICH8M Chipset
    Display:17″ TFT WXGA-Display (Resolution: 1440 x 900 Pixel, 16:10, glare)
    Input/Output:
    * 4x USB 2.0
    * 1x DVI-I Out
    * 1x HDMI Out
    * 1x RJ 45 (LAN)
    * 1x RJ 11 (Modem)
    * 1x PCI Express Card/54
    * 1x Mikrofon In
    * 1x Line In
    * 1x Line Out
    * 1x S/P-DIF out
    * 1x 4-in-1 Cardreader (SD, MMC, MS & MS Pro)
    Modem/ISDN: no
    Network:10/100Mbit Fast Ethernet (onBoard) Intel® PRO / Wireless 4965 (802.11 a/g/Draft-N up to 300Mbi t/s)
    DVD/CD-RW:Toshiba TS-L802A Slim (HD DVD)
    Akku:Li-Ion 4500 mAH, 10.8V
    PowerTransformator:19.0V / max 4.74A, 100-240V (50/60 Hz), 90 W
    Floppy-LW:no
    FastStartKeys:no
    HDD:WD Scorpio WD 1600 BEVS (160 GB, SATA, 5400 RPM)
    weight:ca. 3500 g (incl. Akku)
    more:Integrated 1.3 MP Webcam (USB: ID 05e3:0503 Genesys Logic, Inc.)
    Messure:393 x 280 x 22/33 mm (B x H x T)

    ps:
    i wrote a comment about the log.c-files, but it is not shown, here, strange…

  7. almighurt

    I also got a medion laptop with 05e3:0503 Genesys Logic Webcam, but its a MD 96420. I tried 0.1b-d with all possible gl860-dev-0503*.c. nvgl0.1d with gl860-dev-0503a.c gives the best result but I can’t see a lot: http://michael-gerhaeuser.de/dump/gl860-a.png

    Anyway, thanks a lot for your great work.

  8. nol

    Ok, thanks for the try. If you have Windows, you can help both of us by providing logs. Your picture is different from all what I have already seen, so there would be no connexion with other drivers. Have you shutdown your computer between each try? Maybe with that shutdown you’ll get something OK. It’s the case of Malmostoso who had something bad with the eventually good driver. But after restart it was OK. Let me know if the help you.

  9. almighurt

    After a reboot the driver gives the same picture as seen on the screenshot posted above. i still have installed the preinstalled vista home premium, how can i generate these logs?

  10. almighurt

    Ok, i foudn the USB logs from Windows section in your README file, i’ll try it and upload some logs as soon as possible :)

  11. Sur3

    i just recognised some dmesg errors with the gl860-dev-0505sim.c . . .
    after insmod:
    “gl860: ctrl transfer failed -32 [p40 r11 v0000 i0000 lg0]”

    while capturing there are lots of:
    “gl860: Iso frame 0 of USB has error -71”
    with all framenumbers from 0 to 15,
    i think this could be the major problem.

    And when stopping the capturing:
    “gl860: Error (-2) re-submitting urb in gl860_isoc_handler:1.
    gl860: Error (-2) re-submitting urb in gl860_isoc_handler:1.”

    any idea about this?

    thanks&greets
    Simon

  12. nol

    @ Sur3
    It seems to be quite common that something in [p40 r11 … ] failed but i include it because it is in the logs.
    The -71 is something i’ve already seen with Malmostoso but i have no idea what it means.
    The -2 is also something you share with Malmostoso and it surprise me because I have another error ID when stopping the cam. I also don’t know what it means. My error ID seems normal but -2 is quite strange.
    I will restudy your logs.

  13. Nol

    I made a little modification in the tarball, I hope this will resolve the -71.
    Now you have to use “pregen503” in command line. After that you choose which
    version you want to and it will compile and load the module.

  14. Sur3

    lmao, now it’s error -75 instead :-/
    btw, i have no videodev module, because it’s compiled into the kernel is there a reason for compiling it as module?

    greets
    Simon

  15. Sur3

    @almighurt:
    it gave you the same result as the first picture and wasn’t greyscale? thats weired, are you sure you used the my bayer.c there?
    your pic seemes to be similar to mine, it’s probably YUY2, but i did’nt test it.
    also i get only a small size of the viewport of the camera.
    do you manage to get some usb-log-files?

    i’m also trying to understand the language of the controller, but the protocol is quite strange.. :-/

    greets
    Simon

  16. almighurt

    @sur3:
    i compiled it with your bayer.c, i’m pretty sure. i first called camorama without any parameters. the second time i called camorama with these parameters:
    -D -R –width=640 –height=480
    and it looked like seen on the last screenshot i posted.

    @Nol:
    ok, here are three logs from my webcam using SniffUSB and Windows Vista

    This is a replug by using the replug-button in sniffusb (the webcam is built-in, i can’t really unplug it, as far as i know)
    http://michael-gerhaeuser.de/gl860/replug.log.c

    The start and stop log:
    http://michael-gerhaeuser.de/gl860/start_stop.log.c

    Finally, a log taken while resizing the image from 160×120 to 320×240:
    http://michael-gerhaeuser.de/gl860/double_size_160x120to320x240.log.c

    The log.c files were created by
    ./relog .log almi

    hope i did it the right way and it helps :)

  17. Nol

    Almighurt, your logs are certainly the most magnificent thing I saw about the 0503, maiden images of Malmostoso apart. Your logs are similar to the ones of Simon, so 2 Medion’s, one driver. I’ll compare the logs with those of Simon just to see if they are really identical.
    Your picture is different from the first one you post (which has a repeating pattern), is it different at each new launch of camorama ?

  18. almighurt

    No, it’s not different each time i launch camorama. I just tested both gl860-bayer.c i got, first the original one. Calling camorama without any parameters gives the picture i first posted here. Calling camorama with parameters “-D -R –width=640 –height=480” it gives a picture like in my second screenshot, but softly blue colored like the first screenshot.

    Using the bayer.c from Sur3 i get the same results, but in grey, without this blue shine on it.

  19. Nol

    Grey images are normal with the Sur3’s bayer.c. Indeed, a webcam sends only one color information by pixel instead of three (red, green, blue). Depending on the webcam chip, the rule to convert one color to three colors varies. The purpose of Sur3’s bayer.c is to keep the raw data instead of trying to obtain some color. Grom these raw data you cas infer the conversion rule.
    Important : have you change parameters during the log ? (eg. luminosity, hue, …)
    There’s some unknown traffic in your log while video streaming compared to Sur3, otherwise, you have the same logs.
    In such case, could you make logs while changing ONE parameter only and tell me the name, the min/max value and from which value you go to which value (eg 0-128, from 32 to 45). It helps me to differentiate between instructions sent to webcam and settings.

  20. almighurt

    No, the only setting i changed was the resolution in the third log. But i could make some more logs, changing some settings, maybe i won’t find any time for today but i’ll do this tomorrow then.

  21. Nol

    @ Almighurt and Sur3 : a new version of the driver is online at SF. I made a change in the way to communicate with the webcam, I hope that was the problem. Use “./pregen503” and choose “sim” before compiling.

  22. Sur3

    hm, that looks interresting, the screen is jittering and very dark so one could think there is nothing but on some starts of camorama and when paying much attention i can see me as a repeating pattern and it seemes to be the full viewport this time, also i saw lots of bufferowerflows in dmesg and messeges a la “gl860: VIDIOCMCAPTURE format=4 (r3_5 r2_4 u_9 y_8)”
    i will have to do more research.

    thanks&greets
    Simon

  23. Nol

    An image please !
    I will suppress the VIDIOCMCAPTURE messages, they are no more useful. I need to know if your image is the same after several camorama stops. In this case it is not once the image is like this, another times like that.

  24. Nol

    I think the driver is now working, but I have not send some commands to modify luminosity of something like this.
    I did not included in the driver all commands sent to the webcam because I received a lot of images before these commands and this may be some useful settings. I include them. It will not be necessary to restart the computer.

    @ Sur3 : have you shutdown your computer between the two tries you did today ? This could explain that the driver is not working properly for you.

  25. Nol

    New release taking into account the modification of the “sim” version for all other versions.
    Also I added the last commands sent by the “sim” to the webcam, I hope you will have a clearer image.
    In this case, if the color is abnormal, please post a picture.

    So Almighurt and Sur3 (Medion) : version “sim”.
    Daniel, version “a”.

  26. Nol

    Great, the colorspace issue is not resolved, there is a pattern on the image. One line out of two is OK. It is the same for Jack Malmostoso with the already working device.
    I also need logs to take control over the settings of the webcam and the size change.

  27. Sur3

    ohh, i’m sorry, i recognised, that the modified dev-0503sim doesn’t work after reboot.
    also the color-channels will probably need some coefficient, cause the red looks a bit orange, but thats not this important at this developing-stage.

    greets simon

  28. Sur3

    so, i improved the dev-0503sim, now it even works after reboot, but i dont if if i better put the init_dev code to the init_cam code, i think one should split it, but thats an oher topic.. :-P

  29. Nol

    I included your bayer function in the gl860-bayer.h but it is not used because I don’t know how to use it.
    AMsn, Ekiga, xawtv, camorama, mplayer, ask for a different format and it is easy to make a rgb/bgr 24/32 of your function, for bayer->YUYV/UYUV it’s another story. But the most important thing is that I don’t know who needs exactly your function. The f191 don’t need it, the 0503 of Malmostoso and Almighurt have a pattern but it is not as of your “fancy” picture.
    I also include a raw data output which can be called from mplayer with the “outfmt=y8” instead of “outfmt=rgb24”.

    About the corrections in dev-0503sim, I can’t include it because I have no explanation about what you are doing. Have you pictures like that of Almighurt (http://www.michael-gerhaeuser.de/gl860/works.png) or not ? If with the same “sim” you don’t have this, you need a different driver from that of Almighurt and we need a “sim” version and a “almi” version.
    Moreover if you have logs with setting changes and size changes, please put them online so I can include. Also i made change in “a”, “ms” and “sim” part while you are changing yourself.

    So, please tell me if we have to split “almi” and “sim” version and please give me your logs.
    On SF, there’s a new release with a new version of relog.c which give more informations.

    I really like what you want to help but as i don’t know what you do, i don’t know what to do with your work.

  30. Sur3

    I’m sorry for so much confusion, the true.png is already the result of the new bayer and sim i referenced.
    the fancy pic was just a joke which rusults from experimenting, just forget it. ;-)

    the sim file results from studying logs and your old sim and experimenting,
    it’s just a shortened version of your file with the same result, almi will have to test it, if it doesn’t work for him, then we will have to split, but i hope it also works for him.

    i always start now with “camorama –width=640 –height=480” that has the right format.
    i have to go now, will check your later..

    greets Simon

  31. Sur3

    well, further explaination for the b2bgr24lattice:
    it has just the same purpose as your b2bgr24, but it works :-P
    it was easier for me to adapt my old algorithm then to correct yours.
    also mine need less reccources cause it calculates with less pixels…

    the major difference is that my algorithm interpolates the colors between 4 pixels and cuts just one line in width and one in height, while yours calculates the color of 5 or 9 pixels with one of it at the position of the old pixels, and cuts 2 lines of width and 2 lines of hights.
    so my algo calculates from pixels with distance sqrt(0.5) while your algo calculates from 1 pixel with distance 0 and 4 or 8 pixels with distance 1. (so with more wrong colors, don’t expect that the error negate each other)
    calculating from more pixels is not really better, it blures and costs more ressources..

    i hope that explains my b2bgr24lattice-Algo.

    thanks&greets Simon

  32. Nol

    So of I understand well, your bgr24lattice and bgr24 convert from exactly a same bayered image into a bgr24 with just less computations ? It is not a version due to the fact that you think there’s a difference of the bayer pattern between the f191 and the 0503 ?

    The debayering functions are the ones of the Syntek driver with just a swap of the blue and red components.

  33. Nol

    There is now a new release of the driver which fixes a color issue (but still not with your function Simon, I’ll try later) for all 0503’s.

    The F191 is full supported (if there is one driver for all laptops…).
    The 0503 is full supported for the Asus Z37E, supported in 640×480 without settings for Medion. I have no news about the third version.

  34. almighurt

    my last 2 posts are missing… maybe there are too many links in it, i’ll try to split the post

  35. nol

    I will study that tonight.
    Try to make log in size greater than 640×480. My webcam and that of Malmostoso don’t have true sizes below 640×480. It’s the driver which undersamples a 640×480 image. If you have no images it could be because there is too data to log and your system does not cope with, anyway, the commands are problably sent to the webcam, it is just data which are missed. Make several logs (3 or 4) with the same size change to be sure there is no instructions to webcam lost.

Comments are closed.