Archive

Author Archive

Ricoh Drivers for Ubuntu 10.10

October 12, 2010 Leave a comment

If you try to compile r5u870 driver for Ricoh webcams under Ubuntu 10.10 you’ll fail due to a recent renaming of some functions in the linux kernel.

In particular:

usb_buffer_alloc() is renamed to usb_alloc_coherent()
usb_buffer_free()  is renamed to usb_free_coherent()

For more information: http://kerneltrap.org/mailarchive/git-commits-head/2010/4/30/32383

To avoid this problem, make this substitution in the usbcam_util.c file that can be found here: ttp://www.palmix.org/download/r5u870_k2.6.30_i386.tar.bz2

Categories: GNU/Linux Tags: , , ,

inet_ntop() for Win32

October 9, 2010 3 comments

Like 4 years ago I made a little project for the operating system 2 class. I had to write an application capable of handling multiple file transfers for both Win32 and Linux. During the coding of the socket-side of the application I encountered an awkward problem: why the hell win32 does not have a compatibility function for the inet_ntop()?

Only recently, for Vista and 7, Microsoft introduced the InetNtop() function: http://tinyurl.com/3xrwaer

If you have to write something that needs to run on XP too (that still seems to be the most used operating system for home users: http://tinyurl.com/2w5ed8n ) just try this code :)


const char* inet_ntop(int af, const void* src, char* dst, int cnt){

	struct sockaddr_in srcaddr;

	memset(&srcaddr, 0, sizeof(struct sockaddr_in));
	memcpy(&(srcaddr.sin_addr), src, sizeof(srcaddr.sin_addr));

	srcaddr.sin_family = af;
	if (WSAAddressToString((struct sockaddr*) &srcaddr, sizeof(struct sockaddr_in), 0, dst, (LPDWORD) &cnt) != 0) {
		DWORD rv = WSAGetLastError();
		printf("WSAAddressToString() : %d\n",rv);
		return NULL;
	}
	return dst;
}
Follow

Get every new post delivered to your Inbox.