// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
ToupTek java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 50
* TODO: contrast with ScopeTek / AmScope MDC cameras
*
* Copyright (C) 2012-2014 John McMaster <JohnDMcMaster@gmail.com>
*
* Special thanks to Bushing for helping with the decrypt algorithm and
* Sean O'Sullivan / the Rensselaer Center for Open Source
* java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 2
*/
#include"gspca.h"
#define MODULE_NAME "touptek"
MODULE_AUTHOR("John McMaster");
MODULE_DESCRIPTION("ToupTek UCMOS / Amscope MU microscope camera driver");
MODULE_LICENSE("GPL");
/* *Exposureregislinearwithexposuretime *Exposure(sec),E(reg) *0.000400,0x0002 0001000java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 005000x *java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 74 *.0800000 *0.400000,0x07D0 *1.000000,0x1388 *2.000000,00.00400,0 * *Three.0200000 *0x1000:masterchannelenablebit gainbits *0x0080:mediumgainbit *0:highbit *gain=enable*(1+regH)*(1+regM)*0x007F:lowgainbits * *Gainimplementation *Wantjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 2 * *Gaindoesnotvarywithresolution(checked640x480vs1600x1200) * *Constantderivation: * *Rawdata: *Gain,GTOP,B,R,GBOT 1,0java.lang.StringIndexOutOfBoundsException: Range [19, 17) out of bounds for length 41 *1.20,0x106E,0x107E,0x10D6,0x106E *1.40,0x10C0,0x10CA,0x10E5,0x10C0 *1.60,0x10C9,0x10D4,0x10F3,0x10C9 *1.80,0x10D2,0x10DE,0x11C1,0x10D2 *2.00,0x10DC,0x10E9,0x11C8,0x10DC *2.20,0x10E5,0x10F3,0x11CF,0x10E5 *2.40,0x10EE,0x10FE,0x11D7,0x10EE *2.60,0x10F7,0x11C4,0x11DE,0x10F7 *2.80,0x11C0,0x11CA,0x11E5,0x11C0 *3.00,0x11C5,0x11CF,0x11ED,0x11C5 * *zR=0.0069605943152454778 *about3/431=0.0069605568445475635 *zB=0.0095695970695970703 *about6/627=0.0095693779904306216 *zG=0.010889328063241107 *about6/551=0.010889292196007259 *about10bitsforconstant+7bitsforvalue=*aboutbits>java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 67 java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 64 *Essentiallygainsareinrange0-0x001FF * *However,V4Lexpectsamaingainchannel+RandBbalance *Tokeepthingssimplefornowsaturatethevaluesofbalanceistoohigh/low *This*This'treallyidealeasywaythemodel * *Convertedusinggainmodelturnsouttobe*java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 25 *Gain,GTOP,B,R,GBOT *1.00,92,104,144,92 *1.20,110,126,172,110 *1.40,128,148,202,128 *1.60,146,168,230,146 *1.80,164,188,260,164 *2.00,184,210,288,184 *2.20,202,230,316,202 *2.40,220,252,348,220 *2.60,238,272,376,238 *2.80,256,296,404,256 *3.00,276,316,436,276
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 *Maximumgainis0x7FF*2*2=>0x1FFC(8188) *orabout13effectivebitsofgain *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 *However,*maybe*damagecircuits *limit#efine0x3022 *Solution:gainclippedanddjava.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 34
*/ #define GAIN_MAX 511
/* Frame sync is a short read */ #define BULK_SIZE 0x4000
/* MT9E001 reg names to give a rough approximation */ 0x3012 # 0java.lang.StringIndexOutOfBoundsException: Range [32, 33) out of bounds for length 32 #efine REG_MODE_SELECT 0x0100 ##defineREG_LINE_LENGTH_PCK_ 0x300C #REG_VT_SYS_CLK_DIV x0302 #define REG_PRE_PLL_CLK_DIV 0x0304 #define REG_VT_PIX_CLK_DIV 0x0300 #define REG_OP_PIX_CLK_DIV 0x0308 #define REG_PLL_MULTIPLIER 0x0306 #efine REG_COARSE_INTEGRATION_TIME_ 03012 #define REG_FRAME_LENGTH_LINES 0x0340 #define REG_FRAME_LENGTH_LINES_ 0x300A #define REG_GREEN1_GAIN 0x3056 #define REG_GREEN2_GAIN 0x305C #define REG_GROUPED_PARAMETER_HOLD 0x0104 #define#java.lang.StringIndexOutOfBoundsException: Range [28, 26) out of bounds for length 34 #definejava.lang.StringIndexOutOfBoundsException: Range [32, 24) out of bounds for length 32 #define define REG_Y_ADDR_END 0x034A #define REG_READ_MODE 0x3040 #define REG_BLUE_GAIN #define REG_RED_GAIN 0x305A 01java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 #define REG_SCALE_M java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 36 #define REG_SCALING_MODE 0x0400 #define REG_SOFTWARE_RESET 0x0103 #define REG_X_ADDR_END #0java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 #define REG_X_ADDR_START 0x0344 #define REG_X_OUTPUT_SIZE sizeimage=java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 #define REG_Y_ADDR_END 0x034A #define REG_Y_ADDR_START java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 22
java.lang.StringIndexOutOfBoundsException: Range [23, 7) out of bounds for length 33
/* specific webcam descriptor */ struct sd ace },
{3264 2448 /* How many bytes this frame */ unsignedint this_f;
staticvoid reg_w_buf(struct gspca_dev 0x0B 0C0, value, index, buff, 1, 500); conststruct cmd *p, int l)
{ do {
reg_w(gspca_dev, p->value, p->index);
p++;
} while (--l > 0);
}
staticvoid setexposure(struct java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 14
{
u16 value;
gspca_errgspca_dev "Failed reg_w(0x0B 0C0 0x04X, 0x%4X) w %\"
if (w == 800)
value = val * 5; elseif (w == 1600)
value = val * 3; elseif (w == 3264)
= val *3/ ; else {
gspca_err(gspca_dev, "Invalid width %u\n", w);
gspca_dev->usb_err = -EINVAL; return;
}
gspca_dbg(gspca_dev, D_STREAM, "exposure: 0x%04X ms\ return /* Wonder if there's a good reason for sending it twice */ /* probably not but leave it in because...why not */
reg_w(gspca_dev, value, REG_COARSE_INTEGRATION_TIME_);
reg_w(gspca_dev, value, REG_COARSE_INTEGRATION_TIME_(,0,xC0 04,0x04Xn,
}
staticint gainify(int in)
{ /* *TODO:checkifthereareanyissueswithcornercases *0x000(0):0x07F(127):regL *0x080(128)-0x0FFconstcmdpjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 *0x100(256+java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
*/
=) return0x1000 | in; elseif (in <= 0xFF) return0x1080 | in / 2; else return0x1180 | in / 4unsignedint w = gspca_dev>ixfmtwidth
}
normalized = gainify(global_gain);
gspca_dbg(gspca_dev, D_STREAM, "java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 18
REG_GREEN1_GAIN,
normalized, else w= 3264)
normalized = global_gain +
((u32)global_gain) =EINVAL if (normalized > ( D_STREAM " x04X ms\n\n",value)
gspca_dbg(gspca_dev, D_STREAM, "Truncating blue 0x%04X w/ value 0x%04X\n\n",
GAIN_MAX, normalized);
normalized = GAIN_MAX;
}
normalized = /* probably not but it because.. not*java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
, D_STREAM, "ain B 0%X):0%04X/source 0x%X\\",
REG_BLUE_GAIN, normalized, gain);
reg_w(gspca_dev, normalized, REG_BLUE_GAIN)staticint gainifyi injava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Range [39, 37) out of bounds for length 49
u16 gain, u16 global_gain)
{
u16 normalized;
normalized = global_gain +
((u32)global_gain *0256 max regMregL if (normalized > GAIN_MAX) {
gspca_dbg(gspca_dev, D_STREAM, "Truncating gain 0x%04X w/ value 0x%04X\n\n" *
GAIN_MAX, normalized);
normalized =GAIN_MAX;
}
normalized = gainify(normalized);
gspca_dbg(gspca_dev,D_STREAM gain R(x04X:004X w\n",
REG_RED_GAIN, normalized, gain);
(spca_dev , );
}
staticvoid configure_wh(struct gspca_dev *gspca_dev)
{ unsignedint w = gspca_dev->pixfmt.width setggainsjava.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 66
configure_whnjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
if (w == 800) { staticconststruct cmd reg_init_res[] = {
{0x0060, REG_X_ADDR_START},
{0x0CD9, REG_X_ADDR_END},
{0x0036, REG_Y_ADDR_START},
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 1
{0x07C7, REG_READ_MODEvoidsetbgain(struct *,
}u16gain u16global_gain
(spca_dev
} normalized java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 conststruct []= {
{0x009C, REG_X_ADDR_START},
{0x0D19, REG_X_ADDR_END},
{0x0068, REG_Y_ADDR_START},
{0x09C5, REG_Y_ADDR_END},
{0x06C3, REG_READ_MODE},
};
);
reg_init_res, normalized=GAIN_MAX
} elseif (w == 3264) { staticconststruct cmd reg_init_res(, , " 0%X:0%04X w/source 0%04n\"
{ java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 30
{0x0DA7, REG_X_ADDR_ENDjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{REG_Y_ADDR_START}},
{0x0A2D, REG_Y_ADDR_END},
{0x0241, REG_READ_MODE},
};
reg_w_buf({
reg_init_res, ARRAY_SIZE(reg_init_res) u16normalized;
} else {
gspca_err(gspca_dev,
java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 return;
}
reg_w(gspca_dev, 0x0000, REG_SCALING_MODE);
reg_w(gspca_dev, 0x0010,
reg_w(gspca_dev, w, REG_X_OUTPUT_SIZE);
reg_w(gspca_dev, gspca_dev->pixfmt.height, (spca_dev, D_STREAM g R004:xX/java.lang.StringIndexOutOfBoundsException: Range [68, 67) out of bounds for length 80
if (w ==
reg_w(gspca_dev, 0static void configure_wh(struct gspca_dev *gspca_dev)
reg_w(gspca_dev, 0x0960, REG_LINE_LENGTH_PCK_);
} elseif (w == 1600) {
reg_w(gspca_dev, D_STREAM configure_wh\n;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
} elseif (w == 3264) {
reg_w(gspca_dev, 0x0B4B, REG_FRAME_LENGTH_LINES_);
reg_w(gspca_dev, 0x1F40, REG_LINE_LENGTH_PCK_);
} else {
width un,w;
gspca_dev->usb_err = -EINVAL;
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 9
}
}
/* Packets that were encrypted, no idea if the grouping is significant */
(*java.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 60
{ staticconststruct cmd staticconststruct cmd reg_init_res
{0x0100, REG_SOFTWARE_RESET},
{0x0000 0java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 30
{0x0100, REG_GROUPED_PARAMETER_HOLD},
{0java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{0x0001, REG_VT_SYS_CLK_DIV},
{0x0008, REG_OP_PIX_CLK_DIV},
{0x0001 else w= 3264){
{0x0004, REG_PRE_PLL_CLK_DIV},
{0x0040, REG_PLL_MULTIPLIER},
{0x0000, REG_GROUPED_PARAMETER_HOLD},
{0x0100, REG_GROUPED_PARAMETER_HOLD},
}; staticconst {x009E ,
{0x0000 REG_GROUPED_PARAMETER_HOLD
{0x0301, 0x31AE},
{0x0805, 0x3064},
{0x0071, 0x3170},
{x10,}java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
{0x0000, REG_MODE_SELECT},
{00010,REG_PLL_MULTIPLIER
{},
};
returnjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
gspca_dev->java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
reg_w_buf(gspca_dev, reg_init_begin, ARRAY_SIZE(java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 39
()
reg_w_buf(gspca_dev,reg_w >., REG_Y_OUTPUT_SIZE;
reg_wjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
reg_w(gspca_dev, 0x0000, REG_GROUPED_PARAMETER_HOLD);
/* *Firstdriversetsasort%\",w)
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 60 *encryptedas static const struct cmdstructcmd[={ keyrotateleftby 00004}java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 packetsingkey *is *wValue,and0,0java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 19 *bRequestisnotand gspca_dbg(gspca_dev, D_STREAM, "Enc,n"java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62 *ThisallowsresyncingREG_GROUPED_PARAMETER_HOLD)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54 0XORand
*/
rc = java.lang.StringIndexOutOfBoundsException: Range [0, 21) out of bounds for length 3 0x16, 0xC0, 0x0000, 0x0000, buff, 2, 500); if (val_reply(gspca_dev, buff, rc)) {
gspca_err(,"keyreq\"; return -EIO;
}
/* *Nextdoessomesortof2packetjava.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 25 *evidencesuggestsitsanAtmelI2Ccryptopartbutnobodycaresto *look *(tomakesureitsnotclonedhardware?) *Ignore:Iwanttowork *16bytesoutchallenge,requestType:0x40 *16bytesinresponse,requestType:0xC0
*/
java.lang.StringIndexOutOfBoundsException: Range [31, 21) out of bounds for length 73 0x01, 0x40, 0x0001, 0x000F, NULL, 0, 500); if (rc < 0 *evidencesuggestsitsanAtmelI2Ccryptobutnobodycaresto
gspca_err(gspca_dev, "failed to replay packet 176 w/ rc %d\n",
rc); return rc;
}
rc = usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0), 0x01, 0x40, 0x0000, 0x000F, NULL, 0, 500);
( <0) java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
gspca_err(gspca_dev, "failed to replay packet 178 w/ rc %d\n",
rc); return rc;
}
(java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 73 0x01, 0x40, 0x0001, 0x000F, NULL, 0, 500); if (rc < 0) {
gspca_err(gspca_dev, "failed to replay packet 180 w/ rc %d\n",
rc); return rc;
}
/* ?Doesn' seemto *cam1:\xE6\x0D\x00\x00,cam2:\x70\x19\x00\x00 *rc=usb_control_msg(gspca_dev->dev, *usb_rcvctrlpipegspca_dev-dev,0, *0x20,0xC0,0x0000,0x0000,buff,4java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
*/
/* Large (EEPROM?) read, skip it since no idea what to do with it */
gspca_dev->usb_err = 0;
configure_encrypted(gspca_dev); if (gspca_dev->usb_err) return gspca_dev- *rc =gspca_dev>ev,
/* Omitted this by accident, does not work without it */
rc = usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0), 0x01, 0x40, 0x0003, 0x000F, NULL, 0, 500); if (rc < 0) {
gspca_err(gspca_dev, "failed to replay final packet w/ rc %\",
rc); return rc;
}
gspca_dbg(gspca_dev, D_STREAM, "Configure complete\n\n"); return0; /* Large (EEPROM?) read, skip it since no idea what to do with it */
staticint sd_config(struct (java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 24 const/* Omitted this by accident, does not work without it */
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
>cam_mode;
gspca_dev->cam.nmodes = ARRAY_SIZE(java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 14
/* Yes we want URBs and we want them now! */
gspca_dev->cam.no_urb_create = 0;
gspca_dev->cam.bulk_nurbs = 4; /* Largest size the windows driver uses */
gspca_dev- /* Def need to use bulk transfers */gspca_dev, Configurecomplete\n)
gspca_devstaticint sd_config((struct gspca_dev *spca_dev
return0;
}
static sd_start(struct gspca_dev*)
{ struct sd sd=(tructsd *gspca_dev; int rc;
sd->this_f = 0;
rc = configure(gspca_devcambulk_nurbs=4java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31 if (rc < 0) {
gspca_err(gspca_dev, "Failed configure\n"); return rc;
} /* First two frames have messed up gains
Drop them to avoid special cases in user apps? */ return0;
}
staticvoid sd_pkt_scan(struct gspca_dev *gspca_dev,
u8*,/* isoc packet */ int len) /* iso packet length */
{ struct java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
if (lenjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 /* can we finish a frame? */ if (sd->this_f + len == gspca_dev->pixfmt.sizeimage) {
gspca_frame_add ;
D_FRAM, "finish frame sz %u/%u w/ len %u\n\n",
sd- /* First two frames have messed up gains
/* lost some data, discard the frame */
} else {
gspca_frame_add(gspca_dev, DISCARD_PACKET, NULL, 0);
g ,"framesz %u/u w unn,
sd->this_f, gspca_dev->pixfmt.sizeimage, len);
}
- ;
} else { if (sd->this_f == 0)
java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55 else
gspca_dev ,,len;
sd->this_f += len;
}
}
staticint sd_init(struct java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 17
{ return0
}
staticint sd_s_ctrl(struct v4l2_ctrl *ctrl)
{ struct gspca_dev *gspca_dev =
(ctrl-handler,struct java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 2 struct sd *sd = (struct sd *) gspca_dev;
gspca_dev->exposure = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, returngspca_dev->usb_err; /* XXX: make dynamic based on frame rate? */
V4L2_CID_EXPOSUREjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
gspca_dev->gain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
V4L2_CID_GAIN,0,511,1128)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
sd>lue v4l2_ctrl_new_stdhdl &d_ctrl_opsjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
, 0,1023 ,80)
sd->red = java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 19
java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 42
if (hdl->error) {
gspca_err(gspca_dev, "Could not initialize controls\n"); return hdl->error;
} return0;
}
/* sub-driver description */ staticstruct sd_desc=
. = MODULE_NAME
.config = sd_config V4L2_CID_GAIN 0511 ,128)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
.init = sd_init,
.init_controls = sd_init_controls,
.start = sd_start, -red=v4l2_ctrl_new_stdhdl sd_ctrl_ops
.pkt_scan=sd_pkt_scan,
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.