[cpia] USB works... a bit...

Jochen Scharrlach Jochen.Scharrlach@schwaben.de
Sun, 23 Jan 2000 23:10:32 +0100 (MET)


sbertin@mindspring.com writes:
 > Keep the pointer to the list head in the high level driver, otherwise
 > you end up with a list in each lowlevel driver.  This will require
 > keeping track of which lowlevel driver is responsible for the camera.

Well I *want* to have one list per lowlevel-driver because this makes
life much easier. With my macros in the header-file you actually have
very few references in the cpia_xx.c:

1. the static listpointer:

static struct cam_data *cam_list;

2. adding the driver after registration:

  if((cam=cpia_register_camera(&cpia_usb_ops, cpia))==NULL) {
    LOG("failed to cpia_register_camera\n");
    return NULL;
  }
  ADD_TO_LIST(cam_list, cam);

3. removing the driver by a disconnect-call:

  REMOVE_FROM_LIST(cpia);

4. the cleanup:

  struct cam_data *cam;
  while((cam = cam_list) != NULL)
    cpia_disconnect(NULL, cam);


Well, we can talk about this, after you solved my other problem - I
have trouble with rvmalloc. Installing the driver seems to be ok:

[...]
V4L-Driver for Vision CPiA based cameras v0.5.0
usbcore: Registered new driver cpia
USB CPiA camera found
cpia.c(1104460):goto_low_power(2264):camera now in LOW power state
cpia.c(1104469):goto_high_power(2252):camera now in HIGH power state
cpia.c(1104481):dispatch_commands(2021):1 1 0 0 1 1 1 1
cpia.c(1104481):dispatch_commands(2022):0 1 1 1 1 1 0 1
cpia.c(1104486):save_camera_state(2284):1/0/0/1/0/0/0/128
cpia.c(1104486):save_camera_state(2288):32/6/92
  CPiA Version: 1.20 (2.0)
  CPiA PnP-ID: 0553:0002:0100
  VP-Version: 1.0 0100
usbcore: cpia driver claimed interface c0df8d80
[...]

but then it crashes in rvmalloc. I changed rvmalloc to get more info:

[...]
        DBG("vmalloc ok.\n");

	memset(mem, 0, size); /* Clear the ram out, no junk to the user */
	adr = (unsigned long) mem;
	while (size > 0) {
	  DBG("size = %d, adr = %d\n", size, adr);
	  
		page = kvirt_to_pa(adr);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0))
		mem_map_reserve(MAP_NR(phys_to_virt(page)));
#else
	  DBG("page = %d\n", page);
		mem_map_reserve(MAP_NR(__va(page)));
#endif
		adr += PAGE_SIZE;
		if (size > PAGE_SIZE)
			size -= PAGE_SIZE;
		else
			size = 0;
	}
	DBG("rvmalloc done.\n");
[...]

After starting gqcam I get the following kernel-messages:

[...]
cpia.c(1104793):rvmalloc(266):vmalloc ok.
cpia.c(1104794):rvmalloc(271):size = 204800, adr = -936071168
cpia.c(1104794):rvmalloc(277):page = 1073741872
cpia.c(1104794):rvmalloc(271):size = 200704, adr = -936067072
cpia.c(1104794):rvmalloc(277):page = 19242972
cpia.c(1104794):rvmalloc(271):size = 196608, adr = -936062976
cpia.c(1104794):rvmalloc(277):page = 1073741826
cpia.c(1104794):rvmalloc(271):size = 192512, adr = -936058880
cpia.c(1104794):rvmalloc(277):page = 1073741832
cpia.c(1104794):rvmalloc(271):size = 188416, adr = -936054784
cpia.c(1104794):rvmalloc(277):page = 18708540
cpia.c(1104794):rvmalloc(271):size = 184320, adr = -936050688
cpia.c(1104794):rvmalloc(277):page = 17215444
cpia.c(1104794):rvmalloc(271):size = 180224, adr = -936046592
kernel BUG at cpia.c:225!
invalid operand: 0000
CPU:    1
EIP:    0010:[<c80a5190>]
EFLAGS: 00010292
eax: 0000001a   ebx: 00064c68   ecx: c0250150   edx: c5aedf84
esi: 0002c000   edi: c8351000   ebp: c834b000   esp: c1f93f18
ds: 0018   es: 0018   ss: 0018
Process gqcam (pid: 1379, stackpage=c1f93000)
Stack: c6050780 c60515e0 00000000 0010db99 c80ad048 00031ba5 c5a5a4d8 00000000
       c80a31b3 c5a5a4d8 00000000 00000000 c274a7e0 00000051 00000000 000000ff
       c021e89e c0252e04 c014065e c6050780 c274a7e0 c274a7e0 00000000 c6050780
Call Trace: [<c80ad048>] [<c80a31b3>] [<c021e89e>] [<c014065e>] [<c013ed96>] [<c013f0c1>] [<c010da15>]
       [<c010d904>]
Code: 0f 0b 8b 15 d8 15 25 c0 89 f8 25 ff 0f 00 00 0b 44 1a 40 89
[...]

The number of loops until it crashes differs with each try. Any idea?
I am currently using 2.3.37, BTW.

Bye,
Jochen
 
-- 
new signature coming RSN (tm)