Hi ! ( GitHub Page currently doesnt work, so i post here )
Have tried to add to the c # opensource projekt a camera class.
Besides, I have read in "inits.txt" file from c projekt and did send
the inits to the camera. Everything wonderfully runs, camera works.
The only problem, besides: libusbdotnet library obviously supports no
async usb callback. Tried everything, always win32error... Any clue or
other idea which usb-library to use in c#?
here the code switching on the camera :
public struct caminit
{
public byte[] init;
public caminit(byte[] initArray)
{
init = initArray;
}
};
/// <summary>
/// sends the inits read from "inits.txt" (file taken from c
project)
/// </summary>
public void SendInits()
{
// init_send ??
UsbSetupPacket setup = new UsbSetupPacket(0x80, 0x06,
0x3ee, 0x0, 0x12);
int len = 0;
byte[] buf = new byte[18];
MyUsbDevice.ControlTransfer(ref setup, buf,
(ushort)buf.Length, out len);
// send the inits list
buf = new byte[0x2000];
foreach (caminit ci in inits)
{
setup = new UsbSetupPacket(0x40, 0x0, 0x0, 0x0,
(ushort)ci.init.Length);
MyUsbDevice.ControlTransfer(ref setup, ci.init,
(ushort)ci.init.Length, out len);
setup = new UsbSetupPacket(0xc0, 0x0, 0x0, 0x0,
0x200);
len = 0;
while (len == 0)
MyUsbDevice.ControlTransfer(ref setup, buf,
(ushort)buf.Length, out len);
// TODO : test of response buffer
}
}
private static void ReadInitsFile()
{
// get new inits list
inits = new List<caminit>();
// open the file
StreamReader sr = new StreamReader("inits.txt");
// Read in the data in a list
List<string> list = new List<string>();
string l;
while ((l = sr.ReadLine()) != null)
list.Add(l); // Add to list.
sr.Close();
// loop throug the file lines
foreach (string line in list)
{
// continue if empty or not out commented
if (line == "") continue;
if (line[0] == '#') continue;
// split the line, continue if not 4 parts
(cmd,tag,cdata,rdata)
string[] split = line.Split(',');
if (split.Length != 4) continue;
// get command and tag
Int16 command = Convert.ToInt16(split[0], 16);
Int16 tag = Convert.ToInt16(split[1], 16);
// get the commands and the lenght count ( in UINT16
len count )
Int16 len = 0;
Int16[] cmddata = new Int16[1024];
for (int i = 0; i < split[2].Length / 4; i++)
{
len++;
cmddata[i] = Convert.ToInt16(split[2].Substring(i
* 4, 4), 16);
}
// create init command buffer, first two bytes "magic"
bytes
byte[] init = new byte[8 + (len * 2)];
init[0] = 0x47;
init[1] = 0x4d;
// set the data in the init buffer, first two bytes
empty, then len, command, tag, then the commanddata
byte[] bytes = BitConverter.GetBytes(len);
init[2] = bytes[0]; init[3] = bytes[1];
bytes = BitConverter.GetBytes(command);
init[4] = bytes[0]; init[5] = bytes[1];
bytes = BitConverter.GetBytes(tag);
init[6] = bytes[0]; init[7] = bytes[1];
for (Int16 i = 0; i < len; i++)
{
// here, take bytes[1] first
bytes = BitConverter.GetBytes(cmddata[i]);
init[8 + i * 2] = bytes[1]; init[9 + i * 2] =
bytes[0];
}
// and add the caminit struct
caminit ci = new caminit(init);
inits.Add(ci);
}
}
On 12 Nov., 13:34, Joshua Blake <
joshbl...@gmail.com> wrote:
> Hello everyone!
>
> I'll be sending out periodic status updates to make it easy to track the
> progress of this effort. Here is the latest status!
>
> *Opening words*
>
> WOW! I'm really amazed at the response from the community about open source
> Kinect drivers and the possibilities of what we can do with them.
>
> For those who don't know me, I started this group and have taken on the role
> of project lead. I knew there was going to be people hacking away at Kinect,
> it only makes sense to combine efforts (especially now that the divise
> competition is over!) I expected maybe a handful of people to join this
> mailing list and maybe make some progress towards one or two pet projects. I
> never expected this many people, and this is great! I've got a little bit of
> news for you guys:
>
> I just approved a set of applications which put of over the edge of *400+
> members!* Actually we have 405 members, and I'm sure that by the time I'm
> done with this there will be more people asking to join. I loved reading the
> little blurbs you write about yourselves, and we automatically approve
> anyone who tells us about themselves. The diversity in this group is
> amazing. Developers. Artists. Robiticists. Doctoral candidates. Professors.
> Interaction designers. Game designers. And that is just browsing the last 50
> or so people who joined. With this group of motivated people I know we can
> accomplish great things!
>
> *Software status*
>
> So let me get you up-to-date on the actual software effort. We have now
> successfully combined the three different codebases that individuals had
> been working on after the USB dumps were posted and while this group was
> organizing. The main source repository is at:
https://github.com/OpenKinect/openkinect
> All developers should be using this repo as the base for development
> efforts.
>
> Working right now in this repository are drivers and extremely bare-bones
> sample application for Linux and OS X. We are currently working hard on the
> Windows version as well and plan to support all three platforms. We will
> also have managed wrappers for .NET development.
>
> *Licensing*
>
> I've been discussing with the contributing developers so far and we've also
> come to an agreement on the licensing. The products of this group will be
> available under two licenses. Users can choose to use this project under the
> terms of Apache 2.0 <
http://www.apache.org/licenses/LICENSE-2.0.html> or GPL
> v2 <
http://www.gnu.org/licenses/gpl-2.0.html>. In non-lawyer speak, that
> means that you can use this project almost any way you want. You can even
> modify it and combine it with proprietary code (with Apache 2.0) or use it
> with other GPL code. This maximizes the reach of the project, which I think
> is appropriate considering the amazing innovative ways to use it that you
> guys will come up with.
>
> *Project information*
>
> Now that the code bases are merged and getting organized, I've also written
> up the first bit of information about this project and group on the OpenKinect
> Wiki <
https://github.com/OpenKinect/openkinect/wiki>. I'd encourage everyone
> to take a look and browse some of the pages especially under Project
> Information. I'll just point out that the
> RoadMap<
https://github.com/OpenKinect/openkinect/wiki/Roadmap>page is
> probably of interest to everyone.
>
> I'll continue to send periodic updates so you can track the project status.
> Most of the developers hang out on IRC in #OpenKinect on
freenode.net as
> well so you can drop by and see what is going on in real-time.
>
> As we progress on the driver and software side, we'll figure out ways to
> enable more of you to contribute to the project, even those who do not code.
> See this page <
https://github.com/OpenKinect/openkinect/wiki/Contributing>for
> some ideas.
>
> *Discussion and a new announcement-only list*
>
> Please feel free to discuss (as some of you are already) ideas about how to
> use Kinect or technical topics about the software on this list. If this list
> gets too much email traffic for your taste, please join the
> OpenKinect-Announce list here:
http://groups.google.com/group/openkinect-announce
> There is no application and only project administrators can post. We'll only
> post status updates every few days so it will be low traffic, perfect for if
> you want to keep tabs on our progress but not get too much email.
>
> I'm inspired by you guys. The community is coming together and making this
> happen. Big thanks to ceupcat for helping me click approve a few hundred
> times, and marcan, qDot, ofTheo, and Majority for the work so far on the
> code.
>
> Thanks,
> Josh
>
> P.S. I was right -- we're now up to 407 members.
>
> ---
> Joshua Blake
> Microsoft Surface MVP
>
> (cell)
703-946-7176
> Twitter:
http://twitter.com/joshblake<
https://mail.infostrat.com/exchweb/bin/redir.asp?URL=http://twitter.c...>