summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/aim-v4l2/aim-v4l2.bb
blob: 5233eed98820a7d79e3972b4db2286f0807ed7bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
DESCRIPTION = "Build V4L2 driver for MOST"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
DEPENDS = " mostcore"

inherit module

PV = "0.1"

SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/most;protocol=https"

S = "${WORKDIR}/git/driver/${PN}"
SRCREV = "${AUTOREV}"

# The inherit of module.bbclass will automatically name module packages with
# "kernel-module-" prefix as required by the oe-core build environment.

do_install_append () {
    # modprobe automatically at boot
    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
        install -d ${D}${sysconfdir}/modules-load.d
        echo "aim_v4l2" > ${D}${sysconfdir}/modules-load.d/aim_v4l2.conf
    fi
}
b74 } /* Literal.String.Regex */ .highlight .s1 { color: #e6db74 } /* Literal.String.Single */ .highlight .ss { color: #e6db74 } /* Literal.String.Symbol */ .highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #a6e22e } /* Name.Function.Magic */ .highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */ .highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */ .highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */ .highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */ .highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */ } @media (prefers-color-scheme: light) { .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/* 
 * Copyright (C) 2015 "IoT.bzh"
 * Author "Fulup Ar Foll"
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details..
 * 
 * Reference:
 *   https://developer.mozilla.org/en/docs/Web/API/FileReader 
 *   https://developer.mozilla.org/en-US/docs/Using_files_from_web_applications#Using_hidden_file_input_elements_using_the_click%28%29_method
 *   https://uncorkedstudios.com/blog/multipartformdata-file-upload-with-angularjs
 *   https://www.terlici.com/2015/05/16/uploading-files-locally.html
 *   https://github.com/nervgh/angular-file-upload/blob/master/src/services/FileUploader.js
 *   https://stuk.github.io/jszip/documentation/howto/read_zip.html
 *   http://onehungrymind.com/zip-parsing-jszip-angular/
 */

   
function changeInput() {
     console.log ('input imgClicked'); 
}   

(function() {
'use strict';

// WARNING: Angular ng-change does not work on input/file. Let's hook our callback through standard JS function
var tmpl =  '<input type="file" name="{{name}}-input" onchange="angular.element(this).scope().UpLoadFile(this.files)" accept="{{mimetype}}" style="display:none">'+
            '<div class="upload-file" ng-click="imgClicked()">' +
            '<img id="{{name}}-img" src="{{thumbnail}}">' +
            '<range-slider ng-show="!noslider" id="{{name}}-slider" automatic=true inithook="SliderInitCB"></range-slider>' +
            '</div>';
    

function Basename(path) {
   return path.split('/').reverse()[0];
}

// Service Create xform insert files in and Post it to url
function LoadFileSvc (scope, elem, posturl, files, thumbnailCB) {
    var xmlReq = new XMLHttpRequest();
    var xform  = new FormData();

    // Update slider during Upload
    xmlReq.upload.onprogress = function (event) {
        var progress = Math.round(event.lengthComputable ? event.loaded * 100 / event.total : 0);
        if (scope.slider) scope.slider.setValue (progress);
    };

    // Upload is finish let's notify controler callback
    xmlReq.onload = function () {
        elem.addClass ("success");
        var response ={
            status : xmlReq.status,
            headers: xmlReq.getAllResponseHeaders() 
        };
        scope.callback (response);
    };

    xmlReq.onerror = function () {
        elem.addClass ("error fail");
        var response ={
            status : xmlReq.status,
            headers: xmlReq.getAllResponseHeaders() 
        };
        scope.callback (response);
    };

    xmlReq.onabort = function () {
        elem.addClass ("error abort");
        var response ={
            status : xmlReq.status,
            headers: xmlReq.getAllResponseHeaders() 
        };
        scope.callback (response);
    };

    for (var i = 0; i < files.length; i++) {
        var file = files[i];
        if (!file.type.match(scope.mimetype)) {
            continue;
        }

        console.log ("Selected file=" + file.name + " size="+ file.size/1024 + " Type="+ file.type);

        // File to upload is too big
        if (file.size > scope.maxsize*1024) {
            scope.thumbnail = scope.istoobig; // warning if image path is wrong nothing happen
            scope.$apply('thumbnail'); // we short-circuit Angular resync Image
            return;
        }

        // This is not an uploadable file
        if(isNaN(file.size)) {
            scope.thumbnail = scope.isnotvalid; 
            scope.$apply('thumbnail');
            return;
        }

        scope.Basename=Basename(file.name);
        scope.imgElem[0].file = file;

        // If File is an image let display it now
        if (thumbnailCB) {
            var reader = new FileReader();
            reader.readAsArrayBuffer(file);
            reader.onload = thumbnailCB;
        }

        // if everything is OK let's add file to xform
        xform.append(scope.name, file, file.name);
    }


    // everything looks OK let's Post it
    xmlReq.open("POST", posturl , true);
    xmlReq.send(xform);
};

angular.module('UploadFiles',['ConfigApp', 'ModalNotification', 'RangeSlider'])

.directive('uploadImage', function(ConfigApp,  JQemu, Notification) {
    function mymethods(scope, elem, attrs) {
        
        // get widget image handle from template
        scope.imgElem    = elem.find('img');
        scope.inputElem  = elem.find('input');
        
        // Image was ckick let's simulate an input (file) click
        scope.imgClicked = function () {
            scope.inputElem[0].click(); // Warning Angular TriggerEvent does not work!!!
        };
        
        // Slider control handle registration after creation
        scope.SliderInitCB=function (slider) {
           scope.slider= slider; 
        };
        
        // Upload is delegated to a shared function
        scope.UpLoadFile=function (files) {
            var readerCB = function (upload) {
                // scope.thumbnail = upload.target.result;
                scope.imgElem[0].src = window.URL.createObjectURL(new Blob([upload.target.result], {type: "image"}));
                scope.$apply('thumbnail');    // we short-circuit Angular resync image
            };
            var posturl = attrs.posturl + "?token=" + ConfigApp.session.token;
            LoadFileSvc (scope, elem, posturl, files, readerCB);
        };

        // Initiallize default values from attributes values
        scope.name= attrs.name || 'avatar';
        scope.category= attrs.category  || 'image';
        scope.mimetype= (attrs.accept || 'image') + '/*';
        scope.maxsize= attrs.maxsize || 100; // default max size 100KB
        scope.regexp = new RegExp (attrs.accept+ '.*','i');

        if (attrs.thumbnail) scope.thumbnail= ConfigApp.paths[scope.category] +  attrs.thumbnail;
        else  scope.thumbnail=ConfigApp.paths[scope.category] + 'tux-bzh.png';
        
        if (attrs.thumbnail) scope.isnotvalid= ConfigApp.paths[scope.category] +  attrs.isnotvalid;
        else  scope.isnotvalid=ConfigApp.paths[scope.category] + 'isnotvalid.png';

        if (attrs.istoobig) scope.istoobig= ConfigApp.paths[scope.category] +  attrs.istoobig;
        else  scope.istoobig=ConfigApp.paths[scope.category] + 'istoobig.png';
        scope.noslider = attrs.noslider || false;

        if (!attrs.posturl) throw new TypeError('file-upload %s posturl=/api/xxxx/xxxx required', scope.attrs);            
    }
    return {
        restrict: 'E',
        template: tmpl,
        link: mymethods,
        scope: {
            callback : '='
        }
    };
})
    
.directive('uploadAudio', function(ConfigApp,  JQemu, Notification) {
    function mymethods(scope, elem, attrs) {
        
        // get widget image handle from template
        scope.imgElem    = elem.find('img');
        scope.inputElem  = elem.find('input');
        
        // Image was ckick let's simulate an input (file) click
        scope.imgClicked = function () {
            scope.inputElem[0].click(); // Warning Angular TriggerEvent does not work!!!
        };
        
        // Slider control handle registration after creation
        scope.SliderInitCB=function (slider) {
           scope.slider= slider; 
        };
        
        // Upload is delegated to a shared function
        scope.UpLoadFile=function (files) {
            var posturl = attrs.posturl + "?token=" + ConfigApp.session.token;
            LoadFileSvc (scope, elem, posturl, files, false);
        };

        // Initiallize default values from attributes values
        scope.name= attrs.name || 'audio';
        scope.category= attrs.category  || 'audio';
        scope.mimetype= (attrs.accept || 'audio') + '/*';
        scope.maxsize= attrs.maxsize || 10000; // default max size 10MB
        scope.regexp = new RegExp (attrs.accept+ '.*','i');

        if (attrs.thumbnail) scope.thumbnail= ConfigApp.paths[scope.category] +  attrs.thumbnail;
        else  scope.thumbnail=ConfigApp.paths[scope.category] + 'upload-music.png';
        
        if (attrs.thumbnail) scope.isnotvalid= ConfigApp.paths[scope.category] +  attrs.isnotvalid;
        else  scope.isnotvalid=ConfigApp.paths[scope.category] + 'isnotvalid.png';

        if (attrs.istoobig) scope.istoobig= ConfigApp.paths[scope.category] +  attrs.istoobig;
        else  scope.istoobig=ConfigApp.paths[scope.category] + 'istoobig.png';
        scope.noslider = attrs.noslider || false;

        if (!attrs.posturl) throw new TypeError('file-upload %s posturl=/api/xxxx/xxxx required', scope.attrs);            
    }
    return {
        restrict: 'E',
        template: tmpl,
        link: mymethods,
        scope: {
            callback : '='
        }
    };
    
})

.directive('uploadAppli', function(ConfigApp,  JQemu, Notification) {
    function mymethods(scope, elem, attrs) {
        
        // get widget image handle from template
        scope.imgElem    = elem.find('img');
        scope.inputElem  = elem.find('input');
        
        // Image was ckick let's simulate an input (file) click
        scope.imgClicked = function () {
            scope.inputElem[0].click(); // Warning Angular TriggerEvent does not work!!!
        };
        
        // Slider control handle registration after creation
        scope.SliderInitCB=function (slider) {
           scope.slider= slider; 
        };
        
        // Upload is delegated to a shared function
        scope.UpLoadFile=function (files) {
                       
            var readerCB = function (upload) {
                var zipapp = new JSZip(upload.target.result);
                var thumbnail = zipapp.file("afa-pkg/thumbnail.jpg");
                
                // Check is we have a thumbnail within loaded Zipfile
                if (!thumbnail) {
                    console.log ("This is not a valid Application Framework APP");
                    scope.thumbnail=ConfigApp.paths[scope.category] + 'isnotvalid.png';
                    scope.$apply('thumbnail');    // we short-circuit Angular resync image
                    return;
                } 
                scope.imgElem[0].src = window.URL.createObjectURL(new Blob([thumbnail.asArrayBuffer()], {type: "image"}));
                scope.$apply('thumbnail');    // we short-circuit Angular resync image
            };
                        
            var posturl = attrs.posturl + "?token=" + ConfigApp.session.token;
            LoadFileSvc (scope, elem, posturl, files, readerCB);
        };

        // Initiallize default values from attributes values
        scope.name= attrs.name || 'appli';
        scope.category= attrs.category  || 'appli';
        scope.mimetype= (attrs.accept || '.zip');
        scope.maxsize= attrs.maxsize || 100000; // default max size 100MB
        scope.regexp = new RegExp (attrs.accept+ '.*','i');

        if (attrs.thumbnail) scope.thumbnail= ConfigApp.paths[scope.category] +  attrs.thumbnail;
        else  scope.thumbnail=ConfigApp.paths[scope.category] + 'upload-appli.png';
        
        if (attrs.thumbnail) scope.isnotvalid= ConfigApp.paths[scope.category] +  attrs.isnotvalid;
        else  scope.isnotvalid=ConfigApp.paths[scope.category] + 'isnotvalid.png';

        if (attrs.istoobig) scope.istoobig= ConfigApp.paths[scope.category] +  attrs.istoobig;
        else  scope.istoobig=ConfigApp.paths[scope.category] + 'istoobig.png';
        scope.noslider = attrs.noslider || false;

        if (!attrs.posturl) throw new TypeError('file-upload %s posturl=/api/xxxx/xxxx required', scope.attrs);            
    }
    return {
        restrict: 'E',
        template: tmpl,
        link: mymethods,
        scope: {
            callback : '='
        }
    };
    
});

console.log ("UploadFile Loaded");
})();