[Risolto] webcam visualizza l' immagine al contrario

niente da fare :frowning:

vogliamo capovolgerla a livello del driver ?
( si tratta della http://www.fedoraonline.it/modules/smartsection/item.php?itemid=364 modificata ai nuovi driver )

in caso affermativa procedi così:
da root:

[code]

yum update kernel

yum groupinstall “strumenti di sviluppo”

yum install kernel-devel[/code]

dai un restart alla macchina

da utente:

$ git clone git://linuxtv.org/media_build.git
$ cd media_build
$ gedit build

modifica le linee:
system (“make allyesconfig”) == 0 or die “can’t select all drivers”;
system (“make”) == 0 or die “build failed”;
in:
**#system (“make allyesconfig”) == 0 or die “can’t select all drivers”;
#system (“make”) == 0 or die “build failed”;
**
salva chiudi.

dai un:

$ ./build

al termine modifica il sorgente del modulo uvcvideo.

$ gedit linux/drivers/media/video/uvc/uvc_video.c

modifica la sezione:

static void uvc_video_decode_data(struct uvc_streaming *stream,
        struct uvc_buffer *buf, const __u8 *data, int len)
{
    struct uvc_video_queue *queue = &stream->queue;
    unsigned int maxlen, nbytes;
    void *mem;

    if (len <= 0)
        return;

    /* Copy the video data to the buffer. */
    maxlen = buf->buf.length - buf->buf.bytesused;
    mem = queue->mem + buf->buf.m.offset + buf->buf.bytesused;
    nbytes = min((unsigned int)len, maxlen);
    memcpy(mem, data, nbytes);
    buf->buf.bytesused += nbytes;

    /* Complete the current frame if the buffer size was exceeded. */
    if (len > maxlen) {
        uvc_trace(UVC_TRACE_FRAME, "Frame complete (overflow).\n");
        buf->state = UVC_BUF_STATE_READY;
    }
}

con il codice:

[code]
static void uvc_video_decode_data(struct uvc_streaming *stream,
struct uvc_buffer *buf, const __u8 *data, int len)
{
struct uvc_video_queue *queue = &stream->queue;
unsigned int maxlen, nbytes, row_size, to_be_copied, shift_right;
void *mem;

if (len <= 0)
return;

/* Copy the video data to the buffer. /
maxlen = buf->buf.length - buf->buf.bytesused;
mem = queue->mem + buf->buf.m.offset + buf->buf.bytesused;
nbytes = min((unsigned int)len, maxlen);
row_size = stream->cur_frame->wWidth *
stream->format->bpp / 8;
/
Each loop “nbytes” is decremented of the number of bytes just copied.
* So are there any other bytes to be copied?
/
while (nbytes > 0) {
/
As the rows of modified frames have to be fulfilled from
* bottom-left to top-right, each cycle tries to complete a
* single row.
* In this cycle where is it needed to start to store bytes
* within the selected row? From the beginning or shifted
* right? Because other bytes could have been already stored in
* that row without completing it, so it could be needed a right
* shift.
/
shift_right = buf->buf.bytesused % row_size;
/
In this cycle how many byte can we copy in the selected row?
/
if (nbytes > row_size - shift_right)
to_be_copied = row_size - shift_right ;
else
to_be_copied = nbytes;
/
“queue->mem + buf->buf.m.offset” is the base-address where to
* start to store the current frame. This address refers to a
* preallocated area (just for a sigle frame) taking part in a
* circular buffer, where to store a fixed number of sequent
* frames.
/
memcpy(queue->mem + buf->buf.m.offset
/
Go to the end of this frame. /
+ row_size * stream->cur_frame->wHeight
/
Go back for the number of bytes corrisponding to the
* already fully completed rows.
/
- (buf->buf.bytesused - shift_right)
/
Go back at the starting point of the upper row. /
- row_size
/
Shift right on this row if it is needed. /
+ shift_right,
data,
to_be_copied );
/
Update “data”, “byteused” and “nbytes” values. /
data += to_be_copied;
buf->buf.bytesused += to_be_copied ;
nbytes -= to_be_copied;
}
/
Complete the current frame if the buffer size was exceeded. */
if (len > maxlen) {
uvc_trace(UVC_TRACE_FRAME, “Frame complete (overflow).\n”);
buf->state = UVC_BUF_STATE_DONE;
}
}[/code]

salva chiudi.

dai un:

$ make

se il make termina senza errori, allora :

[code]$ su

make install[/code]

dai un reboot.
testa la tua cam.

se durante la procedura ottieni errori, fermati e posta la segnalazione.

sono curioso di sapere se ha funzionato.

scusa il ritardo ma ho potuto provare solo stamattina, sembra incredibile ma niente da fare, non ho ricevuto errori ho fatto la compilazione come mi hai detto tu ma non va :frowning:

molto strano.

un’ altra cosa strana è che ho provato ad aprire guvcview e l’ immagine è dritta come se non avessi fatto modifiche

vuoi ricontrollare se il file: $HOME/media_build/linux/drivers/media/video/uvc/uvc_video.c
effettivamente contiene le modifiche indicate,

in caso affermativo dai l’output di:

[code]# updatedb

locate uvcvideo.ko

uname -a[/code]

/lib/modules/2.6.40-4.fc15.x86_64/kernel/drivers/media/video/uvc/uvcvideo.ko
/lib/modules/2.6.40.3-0.fc15.x86_64/kernel/drivers/media/video/uvc/uvcvideo.ko
/lib/modules/2.6.40.4-5.fc15.x86_64/kernel/drivers/media/video/uvc/uvcvideo.ko

Linux idra.metodi 2.6.40.4-5.fc15.x86_64 #1 SMP Tue Aug 30 14:38:32 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

output di:

[code]

ll /lib/modules/2.6.40-4.fc15.x86_64/kernel/drivers/media/video/uvc/uvcvideo.ko

ll /lib/modules/2.6.40.3-0.fc15.x86_64/kernel/drivers/media/video/uvc/uvcvideo.ko

ll /lib/modules/2.6.40.4-5.fc15.x86_64/kernel/drivers/media/video/uvc/uvcvideo.ko[/code]

-rwxr–r-- 1 root root 95200 29 lug 21.16 /lib/modules/2.6.40-4.fc15.x86_64/kernel/drivers/media/video/uvc/uvcvideo.ko

-rwxr–r-- 1 root root 95200 16 ago 06.23 /lib/modules/2.6.40.3-0.fc15.x86_64/kernel/drivers/media/video/uvc/uvcvideo.ko

-rwxr–r-- 1 root root 95200 30 ago 16.53 /lib/modules/2.6.40.4-5.fc15.x86_64/kernel/drivers/media/video/uvc/uvcvideo.ko

non ha installato il modulo modificato.
hai cancellato la directory : $HOME/media_build ?

no anzi la ho appena aperta per vedere le modifiche sul file uvc

output di:

$ ll $HOME/media_build/v4l/uvcvideo.ko

ls: impossibile accedere a /root/media_build/v4l/uvcvideo.ko: File o directory non esistente

però se uso questo percorso funziona

ll /home/massimoprando/media_build/v4l/uvcvideo.h
lrwxrwxrwx 1 massimoprando massimoprando 43 18 set 10.29 /home/massimoprando/media_build/v4l/uvcvideo.h -> …/linux/drivers/media/video/uvc/uvcvideo.h

il comando lo dovevi dare da utente, ridai output:

$ ll /home/massimoprando/media_build/v4l/uvcvideo.ko

ls: impossibile accedere a /home/massimoprando/media_build/v4l/uvcvideo.ko: File o directory non esistente

fino alla cartella v4l arriva con il comando cd poi non trovo il resto

non ha costruito il modulo kernel, vediamo output da utente:

$ ll $HOME/media_build/v4l/uvc_video* $ ll $HOME/media_build/v4l/uvcvideo* $ ll $HOME/media_build/linux/drivers/media/video/uvc/uvc_video.c

lrwxrwxrwx 1 massimoprando massimoprando 44 18 set 10.29 /home/massimoprando/media_build/v4l/uvc_video.c -> …/linux/drivers/media/video/uvc/uvc_video.c

lrwxrwxrwx 1 massimoprando massimoprando 43 18 set 10.29 /home/massimoprando/media_build/v4l/uvcvideo.h -> …/linux/drivers/media/video/uvc/uvcvideo.h

-rw-r–r-- 1 root root 38428 18 set 10.29 /home/massimoprando/media_build/linux/drivers/media/video/uvc/uvc_video.c

ma hai dato un make ? i moduli non sembrano compilati.

procedi da utente:

$ cd /home/massimoprando/media_build $ make
aspetta che finisca.

poi posta di nuovo:

$ ll $HOME/media_build/v4l/uvc_video* $ ll $HOME/media_build/v4l/uvcvideo* $ ll $HOME/media_build/linux/drivers/media/video/uvc/uvc_video.c